SUnit

BadEqualer
I am an object that doesn't always report #= correctly. Used for testing the EqualityTester.
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
BadHasher
I am an object that doesn't always hash correctly. I am used for testing the HashTester.
hash
answer with a different hash some of the time
ClassFactoryForTestCase
A ClassFactoryForTestCase is xxxxxxxxx.
Instance Variables
createdClasses: <Object>
createdClasses
- xxxxx
cleanUp
cleanUpChangeSetForClassNames:
createdClassNames
createdClasses
createdClasses:
defaultCategory
defaultCategoryPostfix
delete:
deleteClasses
deletePackage
initialize
Subclasses should redefine this method to perform initializations on instance creation
newClass
newClassInCategory:
newName
newSubclassOf:instanceVariableNames:classVariableNames:
newSubclassOf:instanceVariableNames:classVariableNames:category:
packageName
ClassFactoryForTestCaseTest
A ClassFactoryForTestCaseTest is xxxxxxxxx.
Instance Variables
factory: <Object>
factory
- xxxxx
lastStoredRun
setUp
tearDown
testClassCreationInDifferentCategories
testClassFastCreationInDifferentCategories
testDefaultCategoryCleanUp
testMultipleClassCreation
testPackageCleanUp
testSingleClassCreation
testSingleClassFastCreation
ClassTestCase
This class is intended for unit tests of individual classes and their metaclasses.
It provides methods to determine the coverage of the unit tests.
Subclasses are expected to re-implement #classesToBeTested and #selectorsToBeIgnored.
They should also implement to confirm that all methods have been tested.
#testCoverage
super testCoverage.
categoriesForClass:
classToBeTested
isAbstract
mustTestCoverage
selectorsNotTested
selectorsTested
selectorsToBeIgnored
selectorsToBeTested
targetClass
testClassComment
testCoverage
testNew
testUnCategorizedMethods
EqualityTester
I provide a simple way to test the equality properties of any object.
resultFor:
Test that equality is the same over runs and answer the result
HashAndEqualsTestCase
I am a simple TestCase that tests for correct operation of #hash and #=.
Subclasses of me need to fill my prototypes with suitable objects to be tested.
setUp
subclasses will add their prototypes into this collection
testEquality
Check that TextFontChanges report equality correctly
testHash
test that TextFontChanges hash correctly
HashTester
I provide a simple way to test the hash properties of any object.
I am given an object that should be tested and I treat it like a prototype. I take a copy of it when I am given it so that it can't change whilst I am holding on to it. I can then test that multiple copies of this object all hash to the same value.
resultFor:
Test that the hash is the same over runs and answer the result
HashTesterTest
I am a simple test case to check that HashTester works correctly
testBasicBehaviour
LongTestCase
A LongTestCase is xxxxxxxxx.
Instance Variables
allTestSelectors
buildSuite
doNotRunLongTestCases
initialize
Subclasses should redefine this method to perform initializations on instance creation
isAbstract
runLongTestCases
LongTestCaseTest
A LongTestCaseTest is xxxxxxxxx.
Instance Variables
testLongTestCaseDoNotRun
self debug: #testLongTestCaseDoNotRun
testLongTestCaseRun
self debug: #testLongTestCaseRun
LongTestCaseTestUnderTest
A LongTestCaseTestUnderTest is xxxxxxxxx.
Instance Variables
hasRun
markAsNotRun
testWhenRunMarkTestedToTrue
PrototypeTester
I am a simple holder of a prototype object and hand out copies when requested.
defaultRuns
prototype
Get a prototype
prototype:
Set my prototype
result
Perform the test the default number of times
with:
ResumableTestFailure
A ResumableTestFailure triggers a TestFailure, but lets execution of the TestCase continue. this is useful when iterating through collections, and #assert: ing on each element. in combination with methods like testcase>>#assert:description:, this lets you run through a whole collection and note which tests pass.
here''s an example:

(1 to: 30) do: [ :each |
self assert: each odd description: each printString, ' is even' resumable: true]
for each element where #odd returns <false>, the element will be printed to the Transcript.
isResumable
Of course a ResumableTestFailure is resumable ;-)
sunitExitWith:
ResumableTestFailureTestCase
A ResumableTestFailureTestCase is xxxxxxxxx.
Instance Variables
errorTest
failureTest
lastStoredRun
okTest
regularTestFailureTest
resumableTestFailureTest
testResumable
SUnitExtensionsTest
A SUnitExtensionsTest is xxxxxxxxx.
Instance Variables
stream: <Object>
stream
- xxxxx
assertionFailedInRaiseWithExceptionDoTest
differentExceptionInShouldRaiseWithExceptionDoTest
errorInRaiseWithExceptionDoTest
failureLog
invalidShouldNotTakeMoreThan
invalidShouldNotTakeMoreThanMilliseconds
isLogging
By default, we're not logging failures. If you override this in
a subclass, make sure that you override #failureLog
lastStoredRun
noExceptionInShouldRaiseWithExceptionDoTest
shouldFixTest
shouldRaiseWithExceptionDoTest
shouldRaiseWithSignalDoTest
stream
testAssertionFailedInRaiseWithExceptionDo
testAutoAssertFalse
testAutoAssertTrue
testAutoDenyFalse
testAutoDenyTrue
testDifferentExceptionInShouldRaiseWithExceptionDo
testErrorInRaiseWithExceptionDo
testExceptionWithMatchingString
testExceptionWithoutMatchingString
testInvalidShouldNotTakeMoreThan
testInvalidShouldNotTakeMoreThanMilliseconds
testNoExceptionInShouldRaiseWithExceptionDo
testNoExceptionWithMatchingString
testNoExceptionWithNoMatchingString
testShouldFix
testShouldRaiseWithExceptionDo
testValidShouldNotTakeMoreThan
testValidShouldNotTakeMoreThanMilliseconds
validShouldNotTakeMoreThan
validShouldNotTakeMoreThanMilliseconds
SUnitTest
This is both an example of writing tests and a self test for the SUnit. The tests
here are pretty strange, since you want to make sure things blow up. You should
not generally have to write tests this complicated in structure, although they
will be far more complicated in terms of your own objects- more assertions, more
complicated setup. Kent says: "Never forget, however, that if the tests are hard
to write, something is probably wrong with the design".
assertForTestResult:runCount:passed:failed:errors:
error
Throw a generic Error exception.
errorShouldntRaise
fail
hasRun
hasSetup
lastStoredRun
noop
setRun
setUp
testAssert
testDefects
testDialectLocalizedException
testError
testException
testFail
testIsNotRerunOnDebug
testRanOnlyOnce
testResult
testRunning
testSelectorWithArg:
should not result in error
testShould
testSuite
testWithExceptionDo
SimpleTestResource
A SimpleTestResource is xxxxxxxxx.
Instance Variables
hasRanOnce: <Object>
hasRun: <Object>
hasSetup: <Object>
runningState: <Object>
hasRanOnce
- xxxxx
hasRun
- xxxxx
hasSetup
- xxxxx
runningState
- xxxxx
hasRun
hasSetup
isAvailable
override to provide information on the
readiness of the resource
runningState
runningState:
setRun
setUp
Does nothing. Subclasses should override this
to initialize their resource
startedStateSymbol
stoppedStateSymbol
tearDown
Does nothing. Subclasses should override this
to tear down their resource
SimpleTestResourceTestCase
A SimpleTestResourceTestCase is xxxxxxxxx.
Instance Variables
resource: <Object>
resource
- xxxxx
dummy
error
Throw a generic Error exception.
fail
lastStoredRun
resources
setRun
setUp
testResourceInitRelease
testResourcesCollection
TestCase
A TestCase is a Command representing the future running of a test case. Create one with the class method #selector: aSymbol, passing the name of the method to be run when the test case runs.
When you discover a new fixture, subclass TestCase, declare instance variables for the objects in the fixture, override #setUp to initialize the variables, and possibly override# tearDown to deallocate any external resources allocated in #setUp.
When you are writing a test case method, send #assert: aBoolean when you want to check for an expected value. For example, you might say "self assert: socket isOpen" to test whether or not a socket is open at a point in a test.
addDependentToHierachy:
an empty method. for Composite compability with TestSuite
addTestsFor:toSuite:
addToSuite:fromMethods:
addToSuiteFromSelectors:
allTestSelectors
assert:
Throw an assertion error if aBlock does not evaluates to true.
assert:description:
Throw an assertion error if aBlock does not evaluates to true.
assert:description:resumable:
assert:equals:
browserIcon
browserIcon:selector:
buildSuite
buildSuiteFromAllSelectors
buildSuiteFromLocalSelectors
buildSuiteFromMethods:
buildSuiteFromSelectors
cleanUpInstanceVariables
comparingStringBetween:and:
coverage
coverageAsString
coverageForClass:
coverageForClass:until:
coveragePercentage
debug
debug:
debugAsFailure
deny:
deny:description:
deny:description:resumable:
executeShould:inScopeOf:
executeShould:inScopeOf:withDescriptionContaining:
executeShould:inScopeOf:withDescriptionNotContaining:
executeShould:inScopeOf:withExceptionDo:
expectedFailures
fail
failureLog
generateLastStoredRunMethod
hasMethodBeenRun:
history
history:
initialize
Subclasses should redefine this method to perform initializations on instance creation
isAbstract
isLogging
By default, we're not logging failures. If you override this in
a subclass, make sure that you override #failureLog
lastRun
lastRunMethodNamed:
lastStoredRun
localCoverage
localCoverageAsString
localCoverageForClass:
localCoveragePercentage
logFailure:
methodChanged:
methodFailed:
methodPassed:
methodProgressed:
methodRaisedError:
methodRegressed:
newTestDictionary
openDebuggerOnFailingTestMethod
SUnit has halted one step in front of the failing test method. Step over the 'self halt' and
send into 'self perform: testSelector' to see the failure from the beginning
packageNamesUnderTest
performTest
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
removeDependentFromHierachy:
an empty method. for Composite compability with TestSuite
resetHistory
resources
run
run:
runCase
runCaseAsFailure:
selector
selector:
setTestSelector:
setUp
should:
should:description:
should:notTakeMoreThan:
Evaluate aBlock in a forked process and if it takes more than anInteger milliseconds
to run we terminate the process and report a test failure. It'' important to
use the active process for the test failure so that the failure reporting works correctly
in the context of the exception handlers.
should:notTakeMoreThanMilliseconds:
For compatibility with other Smalltalks
should:raise:
should:raise:description:
should:raise:whoseDescriptionDoesNotInclude:description:
should:raise:whoseDescriptionIncludes:description:
should:raise:withExceptionDo:
shouldFix:
shouldGenerateLastStoredRunMethod
shouldInheritSelectors
shouldPass
Unless the selector is in the list we get from #expectedFailures, we expect it to pass
shouldnt:
shouldnt:description:
shouldnt:raise:
shouldnt:raise:description:
shouldnt:raise:whoseDescriptionDoesNotInclude:description:
shouldnt:raise:whoseDescriptionIncludes:description:
signalFailure:
storedMethodFailed:
storedMethodPassed:
storedMethodRaisedError:
suite
suiteClass
sunitVersion
tearDown
testSelectors
TestFailure
Signaled in case of a failed test (failure). The test framework distinguishes between failures and errors. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like a division by 0 or an index out of bounds ...
defaultAction
The default action taken if the exception is signaled.
isResumable
Determine whether an exception is resumable.
TestResource
A TestResource is xxxxxxxxx.
Instance Variables
description: <Object>
name: <Object>
description
- xxxxx
name
- xxxxx
current
current:
description
description:
initialize
Subclasses should redefine this method to perform initializations on instance creation
isAbstract
isAvailable
override to provide information on the
readiness of the resource
isUnavailable
override to provide information on the
readiness of the resource
name
Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out..
name:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
reset
resources
setUp
Does nothing. Subclasses should override this
to initialize their resource
signalInitializationError
tearDown
Does nothing. Subclasses should override this
to tear down their resource
TestResult
This is a Collecting Parameter for the running of a bunch of tests. TestResult is an interesting object to subclass or substitute. #runCase: is the external protocol you need to reproduce. Kent has seen TestResults that recorded coverage information and that sent email when they were done.
classesTested
correctCount
depreciated - use #passedCount
defects
diff:
Return a collection that contains differences
dispatchResultsIntoHistory
error
Throw a generic Error exception.
errorCount
errors
exError
expectedDefectCount
expectedDefects
expectedPassCount
expectedPasses
failure
failureCount
failures
hasErrors
hasFailures
hasPassed
historyAt:
historyAt:put:
historyFor:
initialize
Subclasses should redefine this method to perform initializations on instance creation
isError:
isErrorFor:selector:
isFailure:
isFailureFor:selector:
isPassed:
isPassedFor:selector:
newTestDictionary
passed
passedCount
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
removeFromTestHistory:in:
resumableFailure
runCase:
runCount
selectResultsForTestCase:
signalErrorWith:
signalFailureWith:
tests
timeStamp
timeStamp:
unexpectedErrorCount
unexpectedErrors
unexpectedFailureCount
unexpectedFailures
unexpectedPassCount
unexpectedPasses
updateResultsInHistory
updateTestHistoryFor:status:
TestSuite
This is a Composite of Tests, either TestCases or other TestSuites. The common protocol is #run: aTestResult and the dependencies protocol
addDependentToHierachy:
addTest:
addTests:
defaultResources
name
Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out..
name:
named:
removeDependentFromHierachy:
resources
resources:
run
run:
tests