mirrored from git://git.sv.gnu.org/smalltalk.git
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathSUnit.st
1118 lines (898 loc) · 23.4 KB
/
SUnit.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Object subclass: TestSuite [
| tests resources name |
<category: 'SUnit'>
<comment: '
This is a Composite of Tests, either TestCases or other TestSuites. The common protocol is #run: aTestResult and the dependencies protocol'>
TestSuite class >> named: aString [
<category: 'Creation'>
^(self new)
name: aString;
yourself
]
run [
<category: 'Running'>
| result |
result := TestResult new.
self resources
do: [:res | res isAvailable ifFalse: [^res signalInitializationError]].
[self run: result] sunitEnsure: [self resources do: [:each | each reset]].
^result
]
run: aResult [
<category: 'Running'>
self tests do:
[:each |
self sunitChanged: each.
each run: aResult]
]
addTest: aTest [
<category: 'Accessing'>
self tests add: aTest
]
addTests: aCollection [
<category: 'Accessing'>
aCollection do: [:eachTest | self addTest: eachTest]
]
defaultResources [
<category: 'Accessing'>
^self tests inject: Set new
into:
[:coll :testCase |
coll
addAll: testCase resources;
yourself]
]
isLogging [
<category: 'Accessing'>
^true
]
logPolicy: aLogPolicy [
<category: 'Accessing'>
self tests
do: [:each | each isLogging ifTrue: [each logPolicy: aLogPolicy]]
]
name [
<category: 'Accessing'>
^name
]
name: aString [
<category: 'Accessing'>
name := aString
]
resources [
<category: 'Accessing'>
resources isNil ifTrue: [resources := self defaultResources].
^resources
]
resources: anObject [
<category: 'Accessing'>
resources := anObject
]
tests [
<category: 'Accessing'>
tests isNil ifTrue: [tests := OrderedCollection new].
^tests
]
addDependentToHierachy: anObject [
<category: 'Dependencies'>
self sunitAddDependent: anObject.
self tests do: [:each | each addDependentToHierachy: anObject]
]
removeDependentFromHierachy: anObject [
<category: 'Dependencies'>
self sunitRemoveDependent: anObject.
self tests do: [:each | each removeDependentFromHierachy: anObject]
]
]
Object subclass: TestResource [
| name description |
<category: 'SUnit'>
<comment: nil>
TestResource class [
| current |
]
TestResource class >> reset [
<category: 'Creation'>
current notNil ifTrue: [[current tearDown] ensure: [current := nil]]
]
TestResource class >> signalInitializationError [
<category: 'Creation'>
^TestResult
signalErrorWith: 'Resource ' , self name , ' could not be initialized'
]
TestResource class >> isAbstract [
"Override to true if a TestResource subclass is Abstract and should not have
TestCase instances built from it"
<category: 'Testing'>
^self name = #TestResource
]
TestResource class >> isAvailable [
<category: 'Testing'>
^self current notNil and: [self current isAvailable]
]
TestResource class >> isUnavailable [
<category: 'Testing'>
^self isAvailable not
]
TestResource class >> current [
<category: 'Accessing'>
current isNil ifTrue: [current := self new].
^current
]
TestResource class >> current: aTestResource [
<category: 'Accessing'>
current := aTestResource
]
TestResource class >> resources [
<category: 'Accessing'>
^#()
]
description [
<category: 'Accessing'>
description isNil ifTrue: [^''].
^description
]
description: aString [
<category: 'Accessing'>
description := aString
]
name [
<category: 'Accessing'>
name isNil ifTrue: [^self printString].
^name
]
name: aString [
<category: 'Accessing'>
name := aString
]
resources [
<category: 'Accessing'>
^self class resources
]
setUp [
"Does nothing. Subclasses should override this
to initialize their resource"
<category: 'Running'>
]
signalInitializationError [
<category: 'Running'>
^self class signalInitializationError
]
tearDown [
"Does nothing. Subclasses should override this
to tear down their resource"
<category: 'Running'>
]
isAvailable [
"override to provide information on the
readiness of the resource"
<category: 'Testing'>
^true
]
isUnavailable [
"override to provide information on the
readiness of the resource"
<category: 'Testing'>
^self isAvailable not
]
printOn: aStream [
<category: 'Printing'>
aStream nextPutAll: self class printString
]
initialize [
<category: 'Init / Release'>
self setUp
]
]
Object subclass: TestResult [
| failures errors passed |
<category: 'SUnit'>
<comment: '
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.'>
TestResult class >> error [
<category: 'Exceptions'>
^SUnitNameResolver errorObject
]
TestResult class >> failure [
<category: 'Exceptions'>
^TestFailure
]
TestResult class >> resumableFailure [
<category: 'Exceptions'>
^ResumableTestFailure
]
TestResult class >> signalErrorWith: aString [
<category: 'Exceptions'>
self error sunitSignalWith: aString
]
TestResult class >> signalFailureWith: aString [
<category: 'Exceptions'>
self failure sunitSignalWith: aString
]
correctCount [
"depreciated - use #passedCount"
<category: 'Accessing'>
^self passedCount
]
defects [
<category: 'Accessing'>
^(OrderedCollection new)
addAll: self errors;
addAll: self failures;
yourself
]
errorCount [
<category: 'Accessing'>
^self errors size
]
errors [
<category: 'Accessing'>
^self unexpectedErrors
]
expectedDefectCount [
<category: 'Accessing'>
^self expectedDefects size
]
expectedDefects [
<category: 'Accessing'>
^errors , failures asOrderedCollection
select: [:each | each shouldPass not]
]
expectedPassCount [
<category: 'Accessing'>
^self expectedPasses size
]
expectedPasses [
<category: 'Accessing'>
^passed select: [:each | each shouldPass]
]
unexpectedErrorCount [
<category: 'Accessing'>
^self unexpectedErrors size
]
unexpectedErrors [
<category: 'Accessing'>
^errors select: [:each | each shouldPass]
]
unexpectedFailureCount [
<category: 'Accessing'>
^self unexpectedFailures size
]
unexpectedFailures [
<category: 'Accessing'>
^failures select: [:each | each shouldPass]
]
unexpectedPassCount [
<category: 'Accessing'>
^self unexpectedPasses size
]
unexpectedPasses [
<category: 'Accessing'>
^passed select: [:each | each shouldPass not]
]
failureCount [
<category: 'Accessing'>
^self failures size
]
failures [
<category: 'Accessing'>
^failures
]
passed [
<category: 'Accessing'>
^self expectedPasses, self expectedDefects
]
passedCount [
<category: 'Accessing'>
^self passed size
]
runCount [
<category: 'Accessing'>
^passed size + failures size + errors size
]
tests [
<category: 'Accessing'>
^(OrderedCollection new: self runCount)
addAll: passed;
addAll: errors;
addAll: failures;
yourself
]
hasErrors [
<category: 'Testing'>
^self errors size > 0
]
hasFailures [
<category: 'Testing'>
^self failures size > 0
]
hasPassed [
<category: 'Testing'>
^self hasErrors not and: [self hasFailures not]
]
isError: aTestCase [
<category: 'Testing'>
^self errors includes: aTestCase
]
isFailure: aTestCase [
<category: 'Testing'>
^self failures includes: aTestCase
]
isPassed: aTestCase [
<category: 'Testing'>
^self passed includes: aTestCase
]
initialize [
<category: 'Init / Release'>
errors := Set new.
failures := Set new.
passed := OrderedCollection new.
]
runCase: aTestCase [
<category: 'Running'>
| testCasePassed |
aTestCase logPolicy startTestCase: aTestCase.
testCasePassed :=
[
[aTestCase runCase.
true] sunitOn: self class failure
do:
[:signal |
failures add: aTestCase.
signal sunitExitWith: false]]
sunitOn: self class error
do:
[:signal |
(errors includes: aTestCase) ifFalse: [aTestCase logError: signal].
errors add: aTestCase.
signal sunitExitWith: false].
aTestCase logPolicy flush.
testCasePassed ifTrue: [passed add: aTestCase]
]
printOn: aStream [
<category: 'Printing'>
aStream
nextPutAll: self runCount printString;
nextPutAll: ' run'.
self expectedPassCount > 0 ifTrue: [
aStream
nextPutAll: ', ';
nextPutAll: self expectedPassCount printString;
nextPutAll: ' passes' ].
self expectedDefectCount > 0 ifTrue: [
aStream
nextPutAll: ', ';
nextPutAll: self expectedDefectCount printString;
nextPutAll: ' expected failures' ].
self unexpectedFailureCount > 0 ifTrue: [
aStream
nextPutAll: ', ';
nextPutAll: self unexpectedFailureCount printString;
nextPutAll: ' failures' ].
self unexpectedErrorCount > 0 ifTrue: [
aStream
nextPutAll: ', ';
nextPutAll: self unexpectedErrorCount printString;
nextPutAll: ' errors' ].
self unexpectedPassCount > 0 ifTrue: [
aStream
nextPutAll: ', ';
nextPutAll: self unexpectedPassCount printString;
nextPutAll: ' unexpected passes' ]
]
]
Object subclass: TestLogPolicy [
| logDevice testCase |
<category: 'SUnit'>
<comment: '
A TestLogPolicy is a Strategy to log failures and successes within an
SUnit test suite. Besides providing a null logging policy, this class
provides some common accessors and intention-revealing methdods.
Instance Variables:
logDevice <Stream> the device on which the test results are logged
testCase <Object> the test case that''s being run
'>
TestLogPolicy class >> null [
<category: 'Instance Creation'>
^TestLogPolicy on: (WriteStream on: String new)
]
TestLogPolicy class >> on: aStream [
<category: 'Instance Creation'>
^self new initialize: aStream
]
initialize: aStream [
<category: 'Initializing'>
logDevice := aStream
]
logDevice [
<category: 'Accessing'>
^logDevice
]
testCase [
<category: 'Accessing'>
^testCase
]
flush [
<category: 'logging'>
logDevice flush
]
logError: exception [
<category: 'logging'>
]
logFailure: failure [
<category: 'logging'>
]
logSuccess [
<category: 'logging'>
]
nextPut: aCharacter [
<category: 'logging'>
logDevice nextPut: aCharacter
]
nextPutAll: aString [
<category: 'logging'>
logDevice nextPutAll: aString
]
print: anObject [
<category: 'logging'>
anObject printOn: logDevice
]
showCr: aString [
<category: 'logging'>
logDevice
nextPutAll: aString;
nl
]
space [
<category: 'logging'>
logDevice nextPut: $
]
startTestCase: aTestCase [
<category: 'logging'>
testCase := aTestCase
]
]
TestLogPolicy subclass: TestVerboseLog [
| hadSuccesses |
<category: 'SUnit'>
<comment: '
TestVerboseLog logs tests in this format
TestCaseName>>#testMethod1 .
TestCaseName>>#testMethod2 ..
TestCaseName>>#testMethod3 ....
FAILURE: failure description 1
...
ERROR
FAILURE: failure description 2
TestCaseName>>#testMethod4 .................
where each dot is a successful assertion.'>
flush [
<category: 'logging'>
hadSuccesses ifTrue: [self showCr: ''].
hadSuccesses := false.
super flush
]
logError: exception [
<category: 'logging'>
exception messageText displayNl.
Smalltalk backtrace.
self flush.
self showCr: 'ERROR'
]
logFailure: failure [
<category: 'logging'>
self flush.
(failure isNil)
ifTrue: [self showCr: 'FAILURE: Assertion failed'];
ifFalse: [self showCr: 'FAILURE: ' , failure]
]
logSuccess [
<category: 'logging'>
hadSuccesses := true.
self nextPut: $.
]
startTestCase: aTestCase [
<category: 'logging'>
super startTestCase: aTestCase.
hadSuccesses := true.
self
print: aTestCase;
space
]
]
TestVerboseLog subclass: TestCondensedLog [
| realLogDevice hadProblems |
<category: 'SUnit'>
<comment: '
TestCondensedLog logs tests in the same format as TestVerboseLog,
but omits tests that pass.
'>
flush [
<category: 'logging'>
super flush.
hadProblems
ifTrue:
[realLogDevice
nextPutAll: self logDevice contents;
flush].
self logDevice reset
]
initialize: aStream [
<category: 'logging'>
realLogDevice := aStream.
super initialize: (WriteStream on: String new)
]
logError: exception [
<category: 'logging'>
hadProblems := true.
super logError: exception
]
logFailure: failure [
<category: 'logging'>
hadProblems := true.
super logFailure: failure
]
startTestCase: aTestCase [
<category: 'logging'>
hadProblems := false.
super startTestCase: aTestCase
]
]
TestLogPolicy subclass: TestFailureLog [
<category: 'SUnit'>
<comment: '
TestFailureLog implements logging exactly like SUnit 3.1.
'>
logFailure: failure [
<category: 'logging'>
failure isNil
ifFalse:
[self
print: self testCase;
nextPutAll: ': ';
showCr: failure]
]
]
Object subclass: TestCase [
| testSelector logPolicy |
<category: 'SUnit'>
<comment: '
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.'>
TestCase class >> debug: aSymbol [
<category: 'Instance Creation'>
^(self selector: aSymbol) debug
]
TestCase class >> run: aSymbol [
<category: 'Instance Creation'>
^(self selector: aSymbol) run
]
TestCase class >> selector: aSymbol [
<category: 'Instance Creation'>
^self new setTestSelector: aSymbol
]
TestCase class >> suite [
<category: 'Instance Creation'>
^self buildSuite
]
TestCase class >> buildSuite [
<category: 'Building Suites'>
| suite |
^self isAbstract
ifTrue:
[suite := self suiteClass named: self name asString.
self allSubclasses
do: [:each | each isAbstract ifFalse: [suite addTest: each buildSuiteFromSelectors]].
suite]
ifFalse: [self buildSuiteFromSelectors]
]
TestCase class >> buildSuiteFromAllSelectors [
<category: 'Building Suites'>
^self buildSuiteFromMethods: self allTestSelectors
]
TestCase class >> buildSuiteFromLocalSelectors [
<category: 'Building Suites'>
^self buildSuiteFromMethods: self testSelectors
]
TestCase class >> buildSuiteFromMethods: testMethods [
<category: 'Building Suites'>
^testMethods inject: (self suiteClass named: self name asString)
into:
[:suite :selector |
suite
addTest: (self selector: selector);
yourself]
]
TestCase class >> buildSuiteFromSelectors [
<category: 'Building Suites'>
^self shouldInheritSelectors
ifTrue: [self buildSuiteFromAllSelectors]
ifFalse: [self buildSuiteFromLocalSelectors]
]
TestCase class >> suiteClass [
<category: 'Building Suites'>
^TestSuite
]
TestCase class >> allTestSelectors [
<category: 'Accessing'>
^self sunitAllSelectors select: [:each | 'test*' sunitMatch: each]
]
TestCase class >> resources [
<category: 'Accessing'>
^#()
]
TestCase class >> sunitVersion [
<category: 'Accessing'>
^'3.1'
]
TestCase class >> testSelectors [
<category: 'Accessing'>
^self sunitSelectors select: [:each | 'test*' sunitMatch: each]
]
TestCase class >> isAbstract [
"Override to true if a TestCase subclass is Abstract and should not have
TestCase instances built from it"
<category: 'Testing'>
^self name = #TestCase
]
TestCase class >> shouldInheritSelectors [
"I should inherit from an Abstract superclass but not from a concrete one by default, unless I have no testSelectors in which case I must be expecting to inherit them from my superclass. If a test case with selectors wants to inherit selectors from a concrete superclass, override this to true in that subclass."
<category: 'Testing'>
^self superclass isAbstract or:
[self testSelectors isEmpty
"$QA Ignore:Sends system method(superclass)$"]
]
assert: aBoolean [
<category: 'Accessing'>
aBoolean
ifTrue: [self logSuccess]
ifFalse:
[self logFailure: nil.
TestResult failure sunitSignalWith: 'Assertion failed']
]
assert: aBoolean description: aString [
<category: 'Accessing'>
aBoolean
ifTrue: [self logSuccess]
ifFalse:
[self logFailure: aString.
TestResult failure sunitSignalWith: aString]
]
assert: aBoolean description: aString resumable: resumableBoolean [
<category: 'Accessing'>
| exception |
aBoolean
ifTrue: [self logSuccess]
ifFalse:
[self logFailure: aString.
exception := resumableBoolean
ifTrue: [TestResult resumableFailure]
ifFalse: [TestResult failure].
exception sunitSignalWith: aString]
]
assert: actual equals: expected [
<category: 'Accessing'>
^ self
assert: expected = actual
description: [self comparingStringBetween: actual and: expected]
]
deny: aBoolean [
<category: 'Accessing'>
self assert: aBoolean not
]
deny: aBoolean description: aString [
<category: 'Accessing'>
self assert: aBoolean not description: aString
]
deny: aBoolean description: aString resumable: resumableBoolean [
<category: 'Accessing'>
self
assert: aBoolean not
description: aString
resumable: resumableBoolean
]
logError: aSignal [
<category: 'Accessing'>
self logPolicy logError: aSignal
]
logFailure: anObject [
<category: 'Accessing'>
self logPolicy logFailure: anObject
]
logPolicy [
<category: 'Accessing'>
logPolicy isNil ifTrue: [logPolicy := self defaultLogPolicy].
^logPolicy
]
logPolicy: aLogPolicy [
<category: 'Accessing'>
logPolicy := aLogPolicy
]
logSuccess [
<category: 'Accessing'>
self logPolicy logSuccess
]
defaultLogPolicy [
<category: 'Accessing'>
^self isLogging
ifTrue: [self defaultLogPolicyClass on: self failureLog]
ifFalse: [TestLogPolicy null]
]
defaultLogPolicyClass [
<category: 'Accessing'>
^TestCondensedLog
]
resources [
<category: 'Accessing'>
| allResources resourceQueue |
allResources := Set new.
resourceQueue := OrderedCollection new.
resourceQueue addAll: self class resources.
[resourceQueue isEmpty] whileFalse:
[| next |
next := resourceQueue removeFirst.
allResources add: next.
resourceQueue addAll: next resources].
^allResources
]
selector [
<category: 'Accessing'>
^testSelector
]
should: aBlock [
<category: 'Accessing'>
self assert: aBlock value
]
should: aBlock description: aString [
<category: 'Accessing'>
self assert: aBlock value description: aString
]
should: aBlock raise: anExceptionalEvent [
<category: 'Accessing'>
^self assert: (self executeShould: aBlock inScopeOf: anExceptionalEvent)
]
should: aBlock raise: anExceptionalEvent description: aString [
<category: 'Accessing'>
^self assert: (self executeShould: aBlock inScopeOf: anExceptionalEvent)
description: aString
]
shouldnt: aBlock [
<category: 'Accessing'>
self deny: aBlock value
]
shouldnt: aBlock description: aString [
<category: 'Accessing'>
self deny: aBlock value description: aString
]
shouldnt: aBlock raise: anExceptionalEvent [
<category: 'Accessing'>
^self
assert: (self executeShould: aBlock inScopeOf: anExceptionalEvent) not
]
shouldnt: aBlock raise: anExceptionalEvent description: aString [
<category: 'Accessing'>
^self
assert: (self executeShould: aBlock inScopeOf: anExceptionalEvent) not
description: aString
]
signalFailure: aString [
<category: 'Accessing'>
TestResult failure sunitSignalWith: aString
]
debug [
<category: 'Running'>
self resources
do: [:res | res isAvailable ifFalse: [^res signalInitializationError]].
[(self class selector: testSelector)
logPolicy: TestLogPolicy null;
runCase]
sunitEnsure: [self resources do: [:each | each reset]]
]
debugAsFailure [
<category: 'Running'>
| semaphore |
semaphore := Semaphore new.
self resources
do: [:res | res isAvailable ifFalse: [^res signalInitializationError]].
[semaphore wait.
self resources do: [:each | each reset]] fork.
(self class selector: testSelector) runCaseAsFailure: semaphore
]
failureLog [
<category: 'Running'>
^SUnitNameResolver defaultLogDevice
]
isLogging [
"By default, we're not logging failures. If you override this in
a subclass, make sure that you override #failureLog"