[Pkg] The Trunk: SUnit-ar.76.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue May 11 03:55:12 UTC 2010
Andreas Raab uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-ar.76.mcz
==================== Summary ====================
Name: SUnit-ar.76
Author: ar
Time: 10 May 2010, 8:54:50.15 pm
UUID: 7b624ddc-b133-894a-a273-7757b0c1b742
Ancestors: SUnit-ul.75
Time out tests by default to avoid a test deadlocking or requiring unexpected user input. The timeout can either be set on a per-class basis (for example DecompilerTests>>defaultTimeout) or using the <timeout: seconds> tag on a per-test basis (for example LocalTest>>testLocaleChanged).
The change heavily simplifies automated testing since tests that deadlock or require user input unexpectedly no longer lock up the testing process but rather fail the individual test.
=============== Diff against SUnit-ul.75 ===============
Item was changed:
----- Method: TestCase>>runCase (in category 'running') -----
runCase
+ [[self setUp.
+ self performTest] ensure: [self tearDown]]
+ valueWithin: self timeoutForTest seconds
+ onTimeout:[TestFailure signal: 'Test timed out'].
+ !
- [self setUp.
- self performTest] ensure: [self tearDown]
- !
Item was added:
+ ----- Method: SUnitTest>>testTestTimeoutLoop (in category 'testing') -----
+ testTestTimeoutLoop
+ <timeout: 1>
+ self should:[[true] whileTrue.] raise: TestFailure.
+ !
Item was added:
+ ----- Method: SUnitTest>>testTestTimeoutTag (in category 'testing') -----
+ testTestTimeoutTag
+ <timeout: 1>
+ self should:[(Delay forSeconds: 3) wait] raise: TestFailure.
+ !
Item was added:
+ ----- Method: TestCase>>timeoutForTest (in category 'accessing') -----
+ timeoutForTest
+ "Answer the timeout to use for this test"
+
+ | method |
+ method := self class lookupSelector: testSelector asSymbol.
+ (method pragmaAt: #timeout:) ifNotNil:[:tag| ^tag arguments first].
+ ^self defaultTimeout!
Item was added:
+ ----- Method: TestCase>>defaultTimeout (in category 'accessing') -----
+ defaultTimeout
+ "Answer the default timeout to use for tests in this test case.
+ The timeout is a value in seconds."
+
+ ^5 "seconds"!
Item was added:
+ ----- Method: SUnitTest>>testTestTimeout (in category 'testing') -----
+ testTestTimeout
+ self should:[(Delay forSeconds: 6) wait] raise: TestFailure.
+ !
More information about the Packages
mailing list