SUnit for 3.10
Last updated at 1:59 pm UTC on 10 March 2007
Script to load improved SUnit
usage:
Installer installUrl: 'wiki.squeak.org/squeak/SUnit%20for%203.10'.
author: kph
script:
Installer mantis fixBug: 5319.
Additional Features
- SUnit
- Suite defining mechanism
- Suite and Filter publishing interface
- TestResultTimed
- Collects test timings
- Collects whether a test uses the network
- TestCaseVersioned - Specialized TestCase class
- Categorize tests for platforms
- Categorize tests for image version
- Categorize tests for vm Version
- ClassClonerTestResource
- Enables testing of the class side without disturbing the classes' soleInstance
- TestReporter - Non Gui test runner
- Reports test run progress
- Reports failures/errors to file
- Can read failures/errors file into a method browser
- TestRunner
- Browse selected test cases in a method browser
- Method browser shows timings/net use
- UI for selecting published suites
- UI for applying filters to remove tests
- UI for applying filters to select tests
- UI for marking tests, as long
From the class comment:
The magic that a TestCase subclass with no test selectors automatically inherits testSelectors. This can and should be explicitly set by overriding #shouldInheritSelectors to true so as to make the behaviour explicit.
Simplification/refactoring/enhancement:
All hard wired references to 'test*' have been removed from the suiteBuild protocol, indeed the suiteBuild protocol has been greatly simplified/removed.
More flexible suite building API:
Asking an abstract class for #suite: will build the entire suite for all of its concrete subclasses.
Asking a concrete class for #suite: will just return the suite for that one class.
Suites are defined as class methods for a testcase class.
example:
myTestSuite
"all 'test*' methods, but not those in category 'long tests', or tests flagged with #BrokenTest"
^ #( 'include:test*' 'exclude@long tests' 'exclude#BrokenTest' )
Suites are obtained via either
a) a selector which references a defined suite or
b) an explicit string
c) an array of a & b.
TestCase suite: #myTestSuite.
TestCase suite: 'include:test*'.
TestCase suite: #( 'include:test*' 'include:longtest*').
The array can be used to combine other suites
example:
myTestSuiteWithLongTests
^ #( #myTestSuite 'include@long tests' )
Published Suites API
- publishedSuites provides a list of test suites published by each TestCase class that can be picked in the TestRunner. This provides a natural UI for selecting from a range of testing scenarios. e.g. tests for different products, releases, platforms, performance monitoring tests, long tests, tests needing additional services (db)
Published Filters API
- published filters provides a list of filters that can be picked in the TestRunner. This provides a natural UI for including/excluding groups of tests from a suite.
publishedFilters
^#( #filterOutBrokenTests )
filterOutBrokenTests
^ 'exclude#BrokenTest'
With this new publishing suites API the functionality of LongTestCase is no longer needed. It could be removed but is left for backwards compatibility.
Additional asserts
added #assert:equals and #assert:includes
Future:
The expectedFailures mechanism may not be needed anymore, and needlessly complicates the results.