TestCase.st
author sr
Tue, 03 Dec 2019 11:46:05 +0100
changeset 765 25cfb3b6f834
parent 764 b8d399e72948
child 766 9fbada22f0db
permissions -rw-r--r--
#FEATURE by Stefan Reise class: TestCase class added: #isRunningUnderBorland32 #isRunningUnderGcc32 #isRunningUnderGcc64 #isRunningUnderMingw64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
763
5e18fecc685b #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
     1
"{ Encoding: utf8 }"
5e18fecc685b #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
     2
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
     3
"{ Package: 'stx:goodies/sunit' }"
0
9365d5753f11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
599
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
     5
"{ NameSpace: Smalltalk }"
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
     6
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
     7
TestAsserter subclass:#TestCase
377
71ada743cae2 removed leftover rubbish
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
     8
	instanceVariableNames:'testSelector'
71ada743cae2 removed leftover rubbish
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
     9
	classVariableNames:''
71ada743cae2 removed leftover rubbish
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
    10
	poolDictionaries:''
71ada743cae2 removed leftover rubbish
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
    11
	category:'SUnit-Base'
0
9365d5753f11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
!
9365d5753f11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
    14
TestCase class instanceVariableNames:'lastOutcomes'
81
10852410025d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 73
diff changeset
    15
10852410025d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 73
diff changeset
    16
"
10852410025d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 73
diff changeset
    17
 No other class instance variables are inherited by this class.
10852410025d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 73
diff changeset
    18
"
10852410025d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 73
diff changeset
    19
!
10852410025d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 73
diff changeset
    20
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    21
Object subclass:#Should
719
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
    22
	instanceVariableNames:'assertSelector shouldNot value testCase'
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    23
	classVariableNames:''
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    24
	poolDictionaries:''
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    25
	privateIn:TestCase
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    26
!
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    27
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    28
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    29
!TestCase class methodsFor:'initialization'!
12
4a6597527f92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6
diff changeset
    30
435
vrany
parents: 433
diff changeset
    31
flushAll
vrany
parents: 433
diff changeset
    32
vrany
parents: 433
diff changeset
    33
    "Flush all remembered outcomes in all testcases"
vrany
parents: 433
diff changeset
    34
vrany
parents: 433
diff changeset
    35
    self withAllSubclassesDo:[:cls|
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    36
	cls flushRememberedOutcomes
435
vrany
parents: 433
diff changeset
    37
    ]
vrany
parents: 433
diff changeset
    38
vrany
parents: 433
diff changeset
    39
    "Created: / 17-11-2011 / 19:18:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
vrany
parents: 433
diff changeset
    40
!
vrany
parents: 433
diff changeset
    41
vrany
parents: 433
diff changeset
    42
flushRememberedOutcomes
vrany
parents: 433
diff changeset
    43
vrany
parents: 433
diff changeset
    44
    "Flushes all remembered outcomes for the receiver"
vrany
parents: 433
diff changeset
    45
vrany
parents: 433
diff changeset
    46
    | outcomes |
vrany
parents: 433
diff changeset
    47
vrany
parents: 433
diff changeset
    48
    lastOutcomes isNil ifTrue:[^self].
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    49
    outcomes := lastOutcomes.
435
vrany
parents: 433
diff changeset
    50
    lastOutcomes := nil.
vrany
parents: 433
diff changeset
    51
    outcomes do:[:outcome|
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    52
	self lastTestRunResultChanged: outcome selector.
435
vrany
parents: 433
diff changeset
    53
    ]
vrany
parents: 433
diff changeset
    54
vrany
parents: 433
diff changeset
    55
    "Created: / 17-11-2011 / 19:17:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
vrany
parents: 433
diff changeset
    56
!
vrany
parents: 433
diff changeset
    57
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    58
initialize
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    59
    ResumableTestFailure autoload
138
90efce9992ea *** empty log message ***
boris
parents: 131
diff changeset
    60
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    61
    "
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    62
     self initialize
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    63
    "
326
4732cd296e5f added: #postAutoload
Stefan Vogel <sv@exept.de>
parents: 305
diff changeset
    64
!
4732cd296e5f added: #postAutoload
Stefan Vogel <sv@exept.de>
parents: 305
diff changeset
    65
4732cd296e5f added: #postAutoload
Stefan Vogel <sv@exept.de>
parents: 305
diff changeset
    66
postAutoload
433
592799735a04 changed: #postAutoload
sr
parents: 430
diff changeset
    67
    |pd|
592799735a04 changed: #postAutoload
sr
parents: 430
diff changeset
    68
592799735a04 changed: #postAutoload
sr
parents: 430
diff changeset
    69
    (pd := self projectDefinitionClass) notNil ifTrue:[
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    70
	pd loadExtensions
433
592799735a04 changed: #postAutoload
sr
parents: 430
diff changeset
    71
    ]
592799735a04 changed: #postAutoload
sr
parents: 430
diff changeset
    72
592799735a04 changed: #postAutoload
sr
parents: 430
diff changeset
    73
    "Modified: / 02-11-2011 / 15:44:58 / sr"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    74
! !
138
90efce9992ea *** empty log message ***
boris
parents: 131
diff changeset
    75
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    76
!TestCase class methodsFor:'instance creation'!
2
6f450bf08bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1
diff changeset
    77
288
3a993cee08a0 added: #asTestCase
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
    78
asTestCase
3a993cee08a0 added: #asTestCase
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
    79
    ^ self
3a993cee08a0 added: #asTestCase
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
    80
3a993cee08a0 added: #asTestCase
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
    81
    "Created: / 02-08-2011 / 09:12:13 / cg"
3a993cee08a0 added: #asTestCase
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
    82
!
3a993cee08a0 added: #asTestCase
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
    83
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    84
debug: aSymbol
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    85
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    86
	^(self selector: aSymbol) debug
138
90efce9992ea *** empty log message ***
boris
parents: 131
diff changeset
    87
!
2
6f450bf08bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1
diff changeset
    88
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    89
run: aSymbol
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    90
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    91
	^(self selector: aSymbol) run
138
90efce9992ea *** empty log message ***
boris
parents: 131
diff changeset
    92
!
90efce9992ea *** empty log message ***
boris
parents: 131
diff changeset
    93
0
9365d5753f11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
selector: aSymbol
103
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
    95
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    96
	^self new setTestSelector: aSymbol
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    97
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    98
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    99
suite
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   100
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   101
	^self buildSuite
0
9365d5753f11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
! !
9365d5753f11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   104
!TestCase class methodsFor:'accessing'!
66
31ae5b8fc382 category rename
Claus Gittinger <cg@exept.de>
parents: 65
diff changeset
   105
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   106
allTestSelectors
328
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   107
    | answer pivotClass lookupRoot |
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   108
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   109
    answer := Set withAll: self testSelectors.
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   110
    self shouldInheritSelectors ifTrue:[
669
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   111
        pivotClass := self superclass.
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   112
        lookupRoot := self lookupHierarchyRoot.
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   113
        [pivotClass == lookupRoot] whileFalse:[
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   114
            answer addAll: pivotClass testSelectors.
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   115
            pivotClass := pivotClass superclass.
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   116
        ]
328
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   117
    ].
669
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   118
    answer := answer asOrderedCollection.
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   119
    answer sort.
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   120
    ^ answer 
420
84e640399605 changed: #allTestSelectors
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
   121
421
9b8b2a70d775 changed: #allTestSelectors
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   122
    "Modified: / 21-08-2011 / 15:06:11 / cg"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   123
!
66
31ae5b8fc382 category rename
Claus Gittinger <cg@exept.de>
parents: 65
diff changeset
   124
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   125
forgetLastTestRunResult
390
c2c3895aabd6 changed: #forgetLastTestRunResult
vrany
parents: 382
diff changeset
   126
c2c3895aabd6 changed: #forgetLastTestRunResult
vrany
parents: 382
diff changeset
   127
    Smalltalk changed:#lastTestRunResult with:(Array with:self with:nil).
c2c3895aabd6 changed: #forgetLastTestRunResult
vrany
parents: 382
diff changeset
   128
    self changed:#lastTestRunResult.
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   129
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   130
    "Modified: / 06-08-2006 / 11:40:07 / cg"
390
c2c3895aabd6 changed: #forgetLastTestRunResult
vrany
parents: 382
diff changeset
   131
    "Modified: / 20-08-2011 / 15:10:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   132
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   133
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   134
isTestSelector:aSelector
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   135
705
8158508603f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   136
    ^aSelector notNil 
8158508603f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   137
    and:[(aSelector startsWith:'test')
8158508603f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   138
    "/ temporary hack - the callers of testCount should use countTests instead
8158508603f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   139
    and:[aSelector ~= 'testCount']]
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   140
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   141
    "Created: / 06-08-2006 / 11:46:17 / cg"
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   142
    "Modified: / 05-12-2009 / 18:50:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
290
7b52b68d57cb changed: #isTestSelector:
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   143
    "Modified: / 02-08-2011 / 17:46:51 / cg"
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   144
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   145
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   146
lastTestRunResultOrNil
578
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   147
    "Returns a state (TestResult stateXXX), depending
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   148
     on the state of the tests:
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   149
	statePass if all tests passed,
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   150
	stateError if any error,
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   151
	stateFail if any fail,
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   152
     or nil if never run
578
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   153
    "
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   154
578
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   155
    |anyFail|
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   156
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   157
    lastOutcomes isNil ifTrue:[^nil].
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   158
    lastOutcomes size ~= self testSelectors size ifTrue:[^nil].
578
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   159
    anyFail := false.
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   160
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   161
    lastOutcomes do:[:outcome|
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   162
	outcome result == (TestResult stateError) ifTrue:[
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   163
	    ^ TestResult stateError
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   164
	].
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   165
	outcome result == (TestResult stateFail) ifTrue:[
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   166
	    anyFail := true
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   167
	].
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   168
    ].
578
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   169
    anyFail ifTrue:[ ^ TestResult stateFail ].
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   170
    ^ TestResult statePass
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   171
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   172
    "Modified: / 20-08-2011 / 14:59:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   173
!
87
24e88e7f5d88 remember individual failed cases.
Claus Gittinger <cg@exept.de>
parents: 82
diff changeset
   174
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   175
lookupHierarchyRoot
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   176
	^TestCase
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   177
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   178
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   179
rememberOutcome: thisOutcome
626
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   180
    |thisTestCase someOtherOutcome someOtherTestCase    
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   181
     thisTestCaseSelector thisTestCaseClassName|
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   182
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   183
    thisTestCase := thisOutcome testCase.
626
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   184
    thisTestCaseSelector := thisTestCase selector.
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   185
    thisTestCaseClassName := thisTestCase class name.
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   186
    
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   187
    lastOutcomes isNil ifTrue:[
626
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   188
        lastOutcomes := OrderedCollection new.
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   189
    ].
445
874deaef2599 changed:
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   190
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   191
    "Not a nice code, but portable (what: doWithIndex: is not portable?)"
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   192
    1 to: lastOutcomes size do:[:i|
626
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   193
        someOtherOutcome := lastOutcomes at: i.
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   194
        someOtherTestCase := someOtherOutcome testCase.
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   195
        "/ compare by classes name - in case it got redefined
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   196
        (someOtherTestCase selector == thisTestCaseSelector
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   197
        and: [someOtherTestCase class name = thisTestCaseClassName]) ifTrue:[
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   198
            "remember; for the timestamp and other info"
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   199
            lastOutcomes at: i put: thisOutcome.
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   200
            someOtherOutcome result ~= thisOutcome result ifTrue:[
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   201
                "but only send out change notification to browser if state has changed"
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   202
                self lastTestRunResultChanged: thisOutcome selector.
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   203
            ].
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   204
            ^self.
4653000fda69 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   205
        ].
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   206
    ].
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   207
    lastOutcomes add: thisOutcome.
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   208
    self lastTestRunResultChanged: thisOutcome selector.
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   209
    ^self
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   210
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   211
    "Created: / 20-08-2011 / 12:43:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
445
874deaef2599 changed:
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   212
    "Modified: / 04-06-2012 / 16:19:07 / cg"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   213
!
81
10852410025d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 73
diff changeset
   214
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   215
rememberedOutcomeFor: selector
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   216
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   217
    lastOutcomes isNil ifTrue:[^nil].
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   218
    ^lastOutcomes
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   219
	detect: [:outcome| outcome testCase selector == selector]
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   220
	ifNone:[nil].
87
24e88e7f5d88 remember individual failed cases.
Claus Gittinger <cg@exept.de>
parents: 82
diff changeset
   221
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   222
    "Created: / 20-08-2011 / 14:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   223
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   224
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   225
resources
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   226
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   227
	^#()
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   228
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   229
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   230
shouldFork
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   231
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   232
    ^false
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   233
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   234
    "Created: / 13-06-2011 / 16:46:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
103
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
   235
!
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
   236
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   237
sunitVersion
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   238
	^'4.0'
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   239
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   240
391
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   241
testSelector:selector result: result
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   242
    "return true, if the last run of this test had the outcome result"
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   243
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   244
    lastOutcomes isNil ifTrue:[^false].
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   245
    ^ lastOutcomes
607
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   246
        contains:[:any|
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   247
            |tc|
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   248
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   249
            (tc := any testCase) class name = self name
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   250
            and:[tc selector == selector
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   251
            and:[any result == result]]
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   252
        ]
391
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   253
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   254
    "Created: / 20-08-2011 / 16:15:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
445
874deaef2599 changed:
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   255
    "Modified: / 04-06-2012 / 16:12:17 / cg"
391
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   256
!
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   257
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   258
testSelectorError:selector
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   259
    "return true, if the last run of this test failed"
391
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   260
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   261
    ^self testSelector: selector result: (TestResult stateError)
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   262
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   263
    "Created: / 15-03-2010 / 19:44:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   264
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   265
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   266
testSelectorFailed:selector
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   267
    "return true, if the last run of this test failed"
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   268
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   269
    ^self testSelector: selector result: (TestResult stateFail)
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   270
391
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   271
    "Modified: / 20-08-2011 / 16:16:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   272
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   273
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   274
testSelectorPassed:selector
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   275
    "return true, if the last run of this test passed"
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   276
523
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   277
   ^self testSelector: selector result: (TestResult statePass)
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   278
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   279
    "Created: / 15-03-2010 / 17:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   280
!
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   281
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   282
testSelectorSkipped:selector
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   283
    "return true, if the last run of this test was skipped"
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   284
dbbf2521cc0c class: TestCase
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   285
   ^self testSelector: selector result: (TestResult stateSkip)
211
3a40b828ce9a comment/format in: #testSelectors
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   286
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   287
    "Created: / 15-03-2010 / 17:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
607
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   288
!
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   289
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   290
testSelectorsWithLastOutcomes
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   291
    lastOutcomes isNil ifTrue:[^#()].
8d830a63bfc0 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   292
    ^lastOutcomes collect:[:outcome| outcome testCase selector] as:Set
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   293
! !
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   294
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   295
!TestCase class methodsFor:'building suites'!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   296
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   297
buildSuite
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   298
	| suite |
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   299
	self isAbstract
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   300
		ifTrue:
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   301
			[suite := self suiteClass named: self name asString.
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   302
			self allSubclasses
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   303
				do: [:each | each isAbstract ifFalse: [suite addTest: each buildSuiteFromSelectors]].
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   304
			^ suite]
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   305
		ifFalse: [^ self buildSuiteFromSelectors]
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   306
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   307
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   308
buildSuiteFromMethods: testMethods
68
9fd111438d60 category renames (lower case)
Claus Gittinger <cg@exept.de>
parents: 67
diff changeset
   309
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   310
	^testMethods
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   311
		inject: (self suiteClass named: self name asString)
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   312
		into: [:suite :selector |
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   313
			suite
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   314
				addTest: (self selector: selector);
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   315
				yourself]
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   316
!
138
90efce9992ea *** empty log message ***
boris
parents: 131
diff changeset
   317
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   318
buildSuiteFromSelectors
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   319
	^self buildSuiteFromMethods: self allTestSelectors
68
9fd111438d60 category renames (lower case)
Claus Gittinger <cg@exept.de>
parents: 67
diff changeset
   320
!
9fd111438d60 category renames (lower case)
Claus Gittinger <cg@exept.de>
parents: 67
diff changeset
   321
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   322
suiteClass
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   323
	^TestSuite
68
9fd111438d60 category renames (lower case)
Claus Gittinger <cg@exept.de>
parents: 67
diff changeset
   324
! !
9fd111438d60 category renames (lower case)
Claus Gittinger <cg@exept.de>
parents: 67
diff changeset
   325
203
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   326
!TestCase class methodsFor:'misc ui support'!
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   327
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   328
iconInBrowserSymbol
630
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   329
    "the browser will use this as index into the toolbariconlibrary"
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   330
203
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   331
    <resource: #programImage>
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   332
205
2236d74e0703 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
   333
    |lastResult|
2236d74e0703 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
   334
203
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   335
    self theNonMetaclass isAbstract ifTrue:[^ super iconInBrowserSymbol].
205
2236d74e0703 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
   336
2236d74e0703 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
   337
    lastResult := self lastTestRunResultOrNil.
578
be4d2b6894b9 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   338
    lastResult notNil ifTrue:[
630
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   339
        lastResult == TestResult statePass ifTrue:[
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   340
            ^ #testCasePassedIcon
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   341
        ].
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   342
        lastResult == TestResult stateFail ifTrue:[
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   343
            ^ #testCaseFailedIcon
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   344
        ].
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   345
        lastResult == TestResult stateError ifTrue:[
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   346
            ^ #testCaseErrorIcon
5b0539adf1c1 comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   347
        ].
205
2236d74e0703 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
   348
    ].
203
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   349
    ^ #testCaseClassIcon
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   350
! !
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   351
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   352
!TestCase class methodsFor:'private'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   353
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   354
addSelector: selector to: collection
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   355
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   356
    "Adds given selector from collection. Answers
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   357
     true iff selector was really added"
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   358
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   359
    (collection includes: selector)
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   360
	ifTrue:[^ false]
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   361
	ifFalse:[collection add: selector. ^ true]
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   362
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   363
    "Created: / 15-03-2010 / 18:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   364
    "Modified: / 21-04-2010 / 23:19:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   365
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   366
689
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   367
coveredClasses
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   368
    "return a collection of classes which are tested by this suite/case.
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   369
     Do not redefine this; redefine either coveredClassNames or
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   370
     coveredPackageNames 
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   371
     (these return names, to avoid creating
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   372
      a package dependecy due to the class references)
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   373
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   374
     These classes can be instrumented for coverage analysis,
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   375
     before running the suite to provide coverage analysis/report"
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   376
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   377
    |names|
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   378
    
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   379
    (names := self coveredPackageNames) notEmptyOrNil ifTrue:[
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   380
        ^ names 
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   381
            collectAll:[:eachPackageOrPattern |
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   382
                eachPackageOrPattern includesMatchCharacters ifTrue:[
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   383
                    Smalltalk allClassesForWhich:[:cls | (cls package ?'') matches:eachPackageOrPattern].
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   384
                ] ifFalse:[    
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   385
                    Smalltalk allClassesInPackage:eachPackageOrPattern
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   386
                ]
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   387
        ].
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   388
    ].
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   389
    ^ self coveredClassNames collect:[:each | Smalltalk classNamed:each]
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   390
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   391
    "Modified (comment): / 30-08-2017 / 11:09:22 / cg"
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   392
    "Modified: / 29-05-2019 / 01:30:01 / Claus Gittinger"
689
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   393
!
d8d6e704ac8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
   394
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   395
lastTestRunResultChanged: selector
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   396
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   397
    Smalltalk changed:#lastTestRunResult with:(Array with:self with:selector).
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   398
    self changed:#lastTestRunResult with:selector.
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   399
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   400
    "Created: / 15-03-2010 / 19:15:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   401
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   402
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   403
testSelectors
669
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   404
    "The API method is allTestSelectors which now includes #shouldInheritSelectors and so handles all cases.  Unlike that method, this does not guarantee to return a sorted ordered collection."
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   405
669
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   406
    |selectors|
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   407
    
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   408
    selectors := self sunitSelectors 
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   409
                    select: [:each | 'test*' sunitMatch: each].
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   410
    selectors := selectors asOrderedCollection.
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   411
    selectors sort.
5c60313710b3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   412
    ^ selectors
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   413
! !
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   414
417
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   415
!TestCase class methodsFor:'queries'!
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   416
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   417
coveredClassNames
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   418
    "should be redefined to return a collection of class names 
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   419
     which are tested by this suite/case. 
600
71cb19568d8b class: TestCase
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
   420
     If not redefined, coveredPackageNames should be.
599
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   421
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   422
     These classes can be instrumented for coverage analysis,
600
71cb19568d8b class: TestCase
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
   423
     before running the suite to provide coverage analysis/report"
417
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   424
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   425
    ^ #()
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   426
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   427
    "Created: / 06-07-2011 / 21:27:03 / cg"
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   428
    "Modified (comment): / 29-05-2019 / 01:32:23 / Claus Gittinger"
417
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   429
!
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   430
599
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   431
coveredPackageNames
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   432
    "redefine this in a concrete testCase class to return non-nil,
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   433
     to return a collection of packages which are tested by this suite/case.
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   434
     If not redefined, coveredClassNames should be redefined.
624
dcc5bcfd1485 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
   435
     The package names may be glob patterns.
599
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   436
     These classes can be instrumented for coverage analysis,
600
71cb19568d8b class: TestCase
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
   437
     before running the suite to provide coverage analysis/report"
599
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   438
400bc2cb5690 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   439
    ^ nil
636
0687cb5a8fd8 class: RBAbstractClass
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   440
!
0687cb5a8fd8 class: RBAbstractClass
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   441
764
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   442
doRunExpeccoRelatedUnitTestsOnly
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   443
    "
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   444
        self doRunExpeccoRelatedUnitTestsOnly
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   445
    "
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   446
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   447
    |runUnitTestsClass|
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   448
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   449
    runUnitTestsClass := Smalltalk at:#RunUnitTests.
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   450
    runUnitTestsClass isNil ifTrue:[
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   451
        ^ false
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   452
    ].
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   453
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   454
    ^ runUnitTestsClass doRunExpeccoRelatedUnitTestsOnly
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   455
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   456
    "Created: / 03-12-2019 / 11:03:06 / Stefan Reise"
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   457
!
b8d399e72948 #FEATURE by Stefan Reise
sr
parents: 763
diff changeset
   458
636
0687cb5a8fd8 class: RBAbstractClass
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   459
isAbstract
0687cb5a8fd8 class: RBAbstractClass
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   460
        "Override to true if a TestCase subclass is Abstract and should not have
0687cb5a8fd8 class: RBAbstractClass
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   461
        TestCase instances built from it"
0687cb5a8fd8 class: RBAbstractClass
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   462
0687cb5a8fd8 class: RBAbstractClass
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   463
        ^self == TestCase
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   464
!
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   465
765
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   466
isRunningUnderBorland32
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   467
    "
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   468
        self isRunningUnderBorland32
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   469
    "
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   470
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   471
    ^ OperatingSystem isMSWINDOWSlike
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   472
    and:[ExternalAddress pointerSize == 4]
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   473
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   474
    "Created: / 03-12-2019 / 11:45:25 / Stefan Reise"
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   475
!
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   476
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   477
isRunningUnderGcc32
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   478
    "
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   479
        self isRunningUnderGcc32  
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   480
    "
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   481
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   482
    ^ OperatingSystem isMSWINDOWSlike not
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   483
    and:[ExternalAddress pointerSize == 4]
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   484
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   485
    "Created: / 03-12-2019 / 11:45:54 / Stefan Reise"
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   486
!
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   487
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   488
isRunningUnderGcc64
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   489
    "
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   490
        self isRunningUnderGcc64
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   491
    "
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   492
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   493
    ^ OperatingSystem isMSWINDOWSlike not
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   494
    and:[ExternalAddress pointerSize == 8]
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   495
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   496
    "Created: / 03-12-2019 / 11:45:46 / Stefan Reise"
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   497
!
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   498
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   499
isRunningUnderMingw64
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   500
    "
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   501
        self isRunningUnderMingw64
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   502
    "
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   503
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   504
    ^ OperatingSystem isMSWINDOWSlike
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   505
    and:[ExternalAddress pointerSize == 8]
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   506
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   507
    "Created: / 03-12-2019 / 11:45:34 / Stefan Reise"
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   508
!
25cfb3b6f834 #FEATURE by Stefan Reise
sr
parents: 764
diff changeset
   509
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   510
requiredPackageNames
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   511
    "can be redefined to return a collection of packages 
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   512
     which are required to be present when running tests.
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   513
     If not redefined, coveredPackageNames is used."
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   514
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   515
    ^ nil
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   516
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   517
    "Created: / 29-05-2019 / 01:31:59 / Claus Gittinger"
417
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   518
! !
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
   519
197
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   520
!TestCase class methodsFor:'quick testing'!
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   521
686
7e6f03915ad9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   522
assert: aBooleanOrBlock
707
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   523
    <resource: #skipInDebuggersWalkBack>
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   524
686
7e6f03915ad9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   525
    ^ self new assert: aBooleanOrBlock
197
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   526
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   527
    "
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   528
     TestCase assert: true
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   529
    "
686
7e6f03915ad9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   530
7e6f03915ad9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   531
    "Modified (format): / 13-07-2017 / 15:13:29 / cg"
197
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   532
!
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   533
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   534
should: aBlock raise: anError
707
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   535
    <resource: #skipInDebuggersWalkBack>
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   536
197
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   537
    ^ self new should: aBlock raise: anError
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   538
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   539
    "
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   540
     TestCase should:[ self error ] raise: Error
587
570faa368e0d class: TestCase
Stefan Vogel <sv@exept.de>
parents: 578
diff changeset
   541
     TestCase should:[ 22 ] raise: Error
197
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   542
    "
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   543
! !
f44d22a08808 quick tests
Claus Gittinger <cg@exept.de>
parents: 194
diff changeset
   544
601
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   545
!TestCase class methodsFor:'running'!
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   546
700
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   547
debug
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   548
    "run myself as a suite with debugging; return the result"
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   549
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   550
    ^ self suite debug
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   551
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   552
    "
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   553
     SOAP::XeXMLTests run
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   554
     RegressionTests::OperatingSystemTest run
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   555
    "
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   556
!
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   557
601
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   558
run
688
e2428b24d753 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   559
    "run myself as a suite; return the result"
e2428b24d753 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   560
e2428b24d753 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   561
    ^ self suite run
601
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   562
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   563
    "
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   564
     SOAP::XeXMLTests run
688
e2428b24d753 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   565
     RegressionTests::OperatingSystemTest run
601
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   566
    "
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   567
! !
d8c7bcbd1b66 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   568
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   569
!TestCase class methodsFor:'testing'!
103
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
   570
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   571
isTestCaseLike
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   572
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   573
    ^true
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   574
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   575
    "Created: / 06-03-2011 / 00:16:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   576
!
103
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
   577
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   578
rememberResult:result
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   579
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   580
    result outcomesDo:[:outcome|self rememberOutcome: outcome].
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   581
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   582
    "Created: / 05-08-2006 / 12:33:08 / cg"
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   583
    "Modified: / 20-08-2011 / 14:02:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   584
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   585
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   586
runTests
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   587
391
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   588
    ^self suite run
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   589
265
125e4f132d46 remember execution time (needed to generate prober reports)
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   590
    "Modified: / 30-07-2011 / 09:26:11 / cg"
391
fb104ea5136f added: #testSelector:result:
vrany
parents: 390
diff changeset
   591
    "Modified: / 20-08-2011 / 16:14:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   592
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   593
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   594
shouldInheritSelectors
710
82df3be055a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   595
    "I should inherit from an Abstract superclass but not from a concrete one by default, 
82df3be055a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   596
     unless I have no testSelectors in which case I must be expecting to inherit them from my superclass.  
82df3be055a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   597
     If a test case with selectors wants to inherit selectors from a concrete superclass, 
82df3be055a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   598
     override this to true in that subclass."
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   599
710
82df3be055a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   600
        ^self ~~ self lookupHierarchyRoot
82df3be055a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   601
                and: [self superclass isAbstract
82df3be055a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   602
                        or: [self testSelectors isEmpty]]
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   603
! !
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   604
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   605
!TestCase methodsFor:'accessing'!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   606
700
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   607
countTests
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   608
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   609
    ^1
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   610
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   611
    "Created: / 04-08-2011 / 13:03:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   612
!
2309c94fe81c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   613
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   614
resources
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   615
	"We give TestCase this instance-side method so that methods polymorphic with TestSuite can be code-identical.  Having this instance-side method also helps when writing tests of resource behaviour. Except for such tests, it is rare to override this method and should not be done without thought.  If there were a good reason why a single test case needed to share tests requiring different resources, it might be legitimate."
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   616
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   617
	^self class resources
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   618
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   619
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   620
selector
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   621
	^testSelector
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   622
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   623
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   624
shouldFork
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   625
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   626
    ^self class shouldFork
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   627
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   628
    "Created: / 13-06-2011 / 16:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
305
f532271f8daa added testCount to TestCase & TestSuite
vrany
parents: 296
diff changeset
   629
!
f532271f8daa added testCount to TestCase & TestSuite
vrany
parents: 296
diff changeset
   630
529
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   631
shouldSkip
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   632
    "Returns true, if this testcase should be skipped when a testsuite is run.
648
6d39f37eb1cd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   633
     This only a hint, a test runner is not obliged to respect return value.
6d39f37eb1cd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   634
     To skip a test, mark the method with a <skip> annotation
529
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   635
     Currently, the only user is stx/goodies/builder/reports"
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   636
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   637
    | method |
648
6d39f37eb1cd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   638
    
529
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   639
    method := self class lookupMethodFor: testSelector.
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   640
    method annotationsAt:#ignore orAt: #skip do:[:annotation|
648
6d39f37eb1cd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   641
         ^true
529
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   642
    ].
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   643
    ^false
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   644
6bcbe6998b73 added: #shouldSkip
vrany
parents: 524
diff changeset
   645
    "Created: / 28-11-2012 / 18:03:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
703
7cf6ad732dc9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   646
!
7cf6ad732dc9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   647
7cf6ad732dc9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   648
testCount
7cf6ad732dc9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   649
    "obsoleted, because all methods starting with 'test'
7cf6ad732dc9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   650
     are considered to be tests; so this is a bad name;
705
8158508603f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   651
     please use countTests.
8158508603f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   652
     See TestCase >> isTestSelector:"
703
7cf6ad732dc9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   653
7cf6ad732dc9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   654
    ^ self countTests
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   655
! !
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   656
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   657
!TestCase methodsFor:'accessing & queries'!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   658
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   659
unfinished
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   660
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   661
	"indicates an unfinished test"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   662
! !
97
1f7ff8664715 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 95
diff changeset
   663
1f7ff8664715 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 95
diff changeset
   664
!TestCase methodsFor:'assertions'!
66
31ae5b8fc382 category rename
Claus Gittinger <cg@exept.de>
parents: 65
diff changeset
   665
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   666
assert:aBlock completesInSeconds:aNumber
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   667
    "fail, if aBlock does not finish its work in aNumber seconds"
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   668
179
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   669
    <resource: #skipInDebuggersWalkBack>
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   670
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   671
    |done process semaphore|
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   672
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   673
    done := false.
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   674
    semaphore := Semaphore new.
174
3fff3dede568 #assert:completedInSeconds:
Stefan Vogel <sv@exept.de>
parents: 139
diff changeset
   675
    process := [
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   676
	aBlock value.
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   677
	done := true.
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   678
	semaphore signal
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   679
    ] fork.
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   680
    semaphore waitWithTimeout: aNumber.
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   681
    process terminate.
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   682
    self assert: done
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   683
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   684
    "
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   685
     self new assert:[Delay waitForSeconds:2] completesInSeconds:1
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   686
    "
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   687
    "
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   688
     self new assert:[Delay waitForSeconds:1] completesInSeconds:2
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   689
    "
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   690
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   691
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   692
assert: aBoolean message:messageIfFailing
531
13776d5be378 class: TestCase
vrany
parents: 529
diff changeset
   693
     <resource: #skipInDebuggersWalkBack>
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   694
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   695
    ^self assert: aBoolean description: messageIfFailing
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   696
531
13776d5be378 class: TestCase
vrany
parents: 529
diff changeset
   697
    "Modified: / 15-12-2012 / 17:20:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   698
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   699
763
5e18fecc685b #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
   700
assertEmpty:aCollection
5e18fecc685b #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
   701
    <resource: #skipInDebuggersWalkBack>
5e18fecc685b #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
   702
5e18fecc685b #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
   703
    ^ self assert:(aCollection isEmpty)
5e18fecc685b #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
   704
!
5e18fecc685b #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
   705
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   706
assertFalse:aBoolean
179
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   707
    <resource: #skipInDebuggersWalkBack>
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   708
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   709
    ^ self assert:aBoolean not
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   710
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   711
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   712
assertFalse:aBoolean named:testName
179
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   713
    <resource: #skipInDebuggersWalkBack>
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   714
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   715
    ^ self assert:aBoolean not
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   716
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   717
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   718
assertTrue:aBoolean
179
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   719
    <resource: #skipInDebuggersWalkBack>
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   720
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   721
    ^ self assert:aBoolean
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   722
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   723
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   724
assertTrue:aBoolean named:testName
179
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   725
    <resource: #skipInDebuggersWalkBack>
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   726
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   727
    ^ self assert:aBoolean
66
31ae5b8fc382 category rename
Claus Gittinger <cg@exept.de>
parents: 65
diff changeset
   728
! !
31ae5b8fc382 category rename
Claus Gittinger <cg@exept.de>
parents: 65
diff changeset
   729
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   730
!TestCase methodsFor:'dependencies'!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   731
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   732
addDependentToHierachy: anObject
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   733
	"an empty method. for Composite compability with TestSuite"
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   734
!
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   735
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   736
removeDependentFromHierachy: anObject
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   737
	"an empty method. for Composite compability with TestSuite"
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   738
! !
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   739
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   740
!TestCase methodsFor:'deprecated'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   741
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   742
should: aBlock
707
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   743
    <resource: #skipInDebuggersWalkBack>
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   744
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   745
    self assert: aBlock value
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   746
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   747
712
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   748
should:result be:expected 
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   749
    <resource: #skipInDebuggersWalkBack>
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   750
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   751
    ^ self assert: (result = expected) 
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   752
           description: 'should be ' , expected asString , ', but it''s ' , result asString
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   753
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   754
    "
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   755
     self new should:5 be:6
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   756
    "
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   757
!
61e5116a2649 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   758
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   759
should: aBlock description: aString
707
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   760
    <resource: #skipInDebuggersWalkBack>
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   761
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   762
    self assert: aBlock value description: aString
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   763
!
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   764
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   765
shouldnt: aBlock
707
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   766
    <resource: #skipInDebuggersWalkBack>
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   767
    self deny: aBlock value
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   768
!
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   769
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   770
shouldnt: aBlock description: aString
707
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   771
    <resource: #skipInDebuggersWalkBack>
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   772
    self deny: aBlock value description: aString
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   773
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   774
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   775
signalFailure: aString
707
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   776
    <resource: #skipInDebuggersWalkBack>
cf2be5373855 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   777
    TestResult failure sunitSignalWith: aString.
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   778
! !
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   779
733
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   780
!TestCase methodsFor:'initialize / release'!
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   781
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   782
setUp
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   783
    "can be redefined in a concrete test"
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   784
!
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   785
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   786
tearDown
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   787
    "can be redefined in a concrete test"
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   788
! !
89e7550d114b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 731
diff changeset
   789
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   790
!TestCase methodsFor:'printing'!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   791
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   792
getTestName
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   793
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   794
    ^testSelector.
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   795
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   796
    "Modified: / 05-12-2009 / 17:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   797
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   798
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   799
name
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   800
	^ self class name.
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   801
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   802
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   803
printOn: aStream
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   804
	self class printOn:aStream.
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   805
	aStream nextPutAll: '>>#'.
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   806
	testSelector printOn:aStream.
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   807
! !
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   808
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   809
!TestCase methodsFor:'private'!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   810
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   811
ensureRequiredPackagesAreLoaded
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   812
    |names|
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   813
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   814
    (names := self class requiredPackageNames) isNil ifTrue:[
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   815
        (names := self class coveredPackageNames)
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   816
    ].
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   817
    names notEmptyOrNil ifTrue:[
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   818
        "/ ensure that the packages are loaded
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   819
        names do:[:each |
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   820
            (Smalltalk loadPackage:each) ifFalse:[
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   821
                self error:('package not loaded: %1' bindWith:each)
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   822
            ].
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   823
        ].    
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   824
    ].
755
b62e3bf07b81 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 750
diff changeset
   825
    "/ cg: no setup here: would lead to double setup
b62e3bf07b81 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 750
diff changeset
   826
    "/ self setUp
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   827
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   828
    "Created: / 29-05-2019 / 01:32:58 / Claus Gittinger"
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   829
!
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   830
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   831
executeShould: aBlock inScopeOf: anExceptionalEvent
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   832
"/        ^[aBlock value.
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   833
"/        false] sunitOn: anExceptionalEvent
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   834
"/                do: [:ex | ex sunitExitWith: true]
103
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
   835
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   836
"/        [[aBlock value]
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   837
"/                on: anExceptionalEvent
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   838
"/                do: [:ex | ^true]]
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   839
"/                        on: TestResult exError
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   840
"/                        do: [:ex | ^false].
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   841
	[aBlock value]
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   842
		on: anExceptionalEvent
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   843
		do: [:ex | ^true].
103
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
   844
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   845
	^false.
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   846
!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   847
747
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   848
invokeTestMethod
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   849
    self perform: testSelector sunitAsSymbol
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   850
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   851
    "Created: / 29-05-2019 / 00:40:03 / Claus Gittinger"
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   852
!
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   853
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   854
performTest
747
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   855
    <modifier: #super> "must be called if redefined"
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   856
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   857
    "handle unimplemented #should message,
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   858
     so we can write:
747
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   859
        something should be:expectedResult
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   860
    "
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   861
    MessageNotUnderstood handle:[:ex |
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   862
        ex selector == #should ifTrue:[
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   863
            ex proceedWith:( Should new testCase:self; value:ex receiver )
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   864
        ].    
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   865
        ex reject.
747
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   866
    ] do:[
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   867
        |mthd timeoutAllotation maxSecondsToRun timeoutOccurred|
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   868
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   869
        timeoutOccurred := false.
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   870
        mthd := self class lookupMethodFor:testSelector.
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   871
        mthd notNil ifTrue:[
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   872
            (timeoutAllotation := mthd annotationAt:#timeout:) notNil ifTrue:[
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   873
                (maxSecondsToRun := timeoutAllotation argumentAt:1 ifAbsent:[nil]) isNil ifTrue:[
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   874
                    Logger warning:'bad timeout annotation in %1' with:mthd whoString.
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   875
                ].    
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   876
            ].    
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   877
        ].
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   878
        maxSecondsToRun notNil ifTrue:[
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   879
            [
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   880
                self invokeTestMethod
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   881
            ] valueWithWatchDog:[timeoutOccurred := true] afterMilliseconds:(maxSecondsToRun * 1000).
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   882
        ] ifFalse:[    
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   883
            self invokeTestMethod
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   884
        ].
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   885
        timeoutOccurred ifTrue:[
750
1719905cad36 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   886
            self error:('test did not complete within %1 seconds (timeout)' bindWith:maxSecondsToRun)
747
1dcb53cf964d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
   887
        ].    
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   888
    ].
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   889
750
1719905cad36 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   890
    "Modified: / 29-05-2019 / 02:07:34 / Claus Gittinger"
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   891
!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   892
576
55ef6aaf19cb class: TestCase
Stefan Vogel <sv@exept.de>
parents: 575
diff changeset
   893
safeTearDown
55ef6aaf19cb class: TestCase
Stefan Vogel <sv@exept.de>
parents: 575
diff changeset
   894
    "Have to handle Abort. When tearDown is called as inside an ensure block after
55ef6aaf19cb class: TestCase
Stefan Vogel <sv@exept.de>
parents: 575
diff changeset
   895
     an abort in the debugger of an errornous test case and raises an error with a debugger
55ef6aaf19cb class: TestCase
Stefan Vogel <sv@exept.de>
parents: 575
diff changeset
   896
     itself."
55ef6aaf19cb class: TestCase
Stefan Vogel <sv@exept.de>
parents: 575
diff changeset
   897
55ef6aaf19cb class: TestCase
Stefan Vogel <sv@exept.de>
parents: 575
diff changeset
   898
    AbortOperationRequest handle:[:ex| ] do:[self tearDown].
55ef6aaf19cb class: TestCase
Stefan Vogel <sv@exept.de>
parents: 575
diff changeset
   899
!
55ef6aaf19cb class: TestCase
Stefan Vogel <sv@exept.de>
parents: 575
diff changeset
   900
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   901
setTestSelector: aSymbol
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   902
	testSelector := aSymbol
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   903
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   904
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   905
signalFailure:aString resumable:isResumable
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   906
    "/        TestResult failure sunitSignalWith: aString
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   907
179
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   908
    <resource: #skipInDebuggersWalkBack>
caba0f640d13 context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   909
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   910
    isResumable ifTrue:[
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   911
	TestResult resumableFailure
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   912
	    raiseRequestWith:nil
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   913
	    errorString:aString
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   914
	    in:thisContext sender sender
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   915
    ] ifFalse:[
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   916
	TestResult failure
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   917
	    raiseErrorString:aString
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   918
	    in:thisContext sender sender
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   919
    ].
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   920
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   921
    "Modified: / 06-08-2006 / 22:55:55 / cg"
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   922
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   923
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   924
signalUnavailableResources
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   925
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   926
    self resources do:[:res |
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   927
	res isAvailable ifFalse:[
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   928
	    ^ res signalInitializationError
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   929
	]
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   930
    ].
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   931
! !
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   932
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   933
!TestCase methodsFor:'queries'!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   934
690
cb50d1d3ffeb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   935
isLogging
728
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   936
    "By default, we're not logging failures. If you override this in
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   937
     a subclass, make sure that you override #failureLog"
690
cb50d1d3ffeb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   938
728
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   939
    ^ self class isLogging
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   940
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   941
    "Modified: / 22-03-2019 / 12:48:09 / Claus Gittinger"
690
cb50d1d3ffeb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   942
!
cb50d1d3ffeb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   943
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   944
isTestCase
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   945
    ^ true
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   946
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   947
221
914934672e32 added: #isTestCaseLike
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   948
isTestCaseLike
914934672e32 added: #isTestCaseLike
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   949
    ^ true
914934672e32 added: #isTestCaseLike
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   950
914934672e32 added: #isTestCaseLike
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   951
    "Created: / 29-06-2011 / 20:37:57 / cg"
914934672e32 added: #isTestCaseLike
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   952
!
914934672e32 added: #isTestCaseLike
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   953
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   954
isTestSuite
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   955
    ^ false
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   956
! !
122
61e456491017 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 118
diff changeset
   957
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   958
!TestCase methodsFor:'running'!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
   959
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   960
debug
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   961
587
570faa368e0d class: TestCase
Stefan Vogel <sv@exept.de>
parents: 578
diff changeset
   962
    | testCase outcome result wasProceeded|
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   963
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
   964
    [
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   965
        result := TestResult stateError.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   966
        wasProceeded := false.
587
570faa368e0d class: TestCase
Stefan Vogel <sv@exept.de>
parents: 578
diff changeset
   967
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   968
        [
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   969
            (testCase := self class selector: testSelector) runCase.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   970
            wasProceeded ifFalse:[
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   971
                result := TestResult statePass.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   972
            ]
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   973
        ] sunitOn:(TestResult failure) do: [:ex |
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   974
            ex creator == TestSkipped ifTrue:[
731
8980c4ec29ec #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   975
                TestSkipped isHandled ifTrue:[ex reject].
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   976
                result := TestResult stateSkip.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   977
            ] ifFalse:[
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   978
                result := TestResult stateFail.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   979
            ].
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   980
            "I want a debugger to open here..."
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   981
            "the only really portable dialect query..."
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   982
            ((Smalltalk respondsTo:#isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifTrue:[
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   983
                "/ debug
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   984
                Debugger
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   985
                    enter:ex raiseContext
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   986
                    withMessage:(ex description)
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   987
                    mayProceed:true.
706
1c3bc0e12b31 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 705
diff changeset
   988
                ex creator == TestSkipped ifTrue:[ex return].
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   989
                wasProceeded := true.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   990
                ex proceed.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   991
            ] ifFalse:[
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   992
                "is there a portable way to open a debugger?"
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   993
                self halt:(ex description).
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   994
                wasProceeded := true.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   995
            ].
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   996
        ].
524
5cf0a462356a lastState fixes
Claus Gittinger <cg@exept.de>
parents: 523
diff changeset
   997
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   998
    ] ensure: [
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   999
        " if proceeded in the debugger, we arrive here; "
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1000
        " but still, this is not always a pass !! "
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1001
        outcome := TestCaseOutcome new.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1002
        outcome testCase: testCase.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1003
        outcome result: result.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1004
        outcome remember.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1005
        TestResource resetResources: self resources
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
  1006
    ].
254
7f4b9fc9756b changed: #debug - remembers test as passed if no error occur during debugging
vrany
parents: 240
diff changeset
  1007
7f4b9fc9756b changed: #debug - remembers test as passed if no error occur during debugging
vrany
parents: 240
diff changeset
  1008
    "Modified: / 07-07-2011 / 11:10:50 / jv"
7f4b9fc9756b changed: #debug - remembers test as passed if no error occur during debugging
vrany
parents: 240
diff changeset
  1009
    "Modified: / 07-07-2011 / 11:34:08 / Jan Vrany <jan.vrant@fit.cvut,cz>"
382
05683696d647 Fixs in remembering test outcomes
vrany
parents: 377
diff changeset
  1010
    "Modified: / 20-08-2011 / 14:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1011
    "Modified: / 13-07-2017 / 14:02:47 / cg"
731
8980c4ec29ec #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
  1012
    "Modified: / 23-03-2019 / 10:15:15 / Claus Gittinger"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1013
!
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1014
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1015
debugAsFailure
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1016
	| semaphore |
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1017
	semaphore := Semaphore new.
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1018
	[semaphore wait. TestResource resetResources: self resources] fork.
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1019
	(self class selector: testSelector) runCaseAsFailure: semaphore.
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1020
!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1021
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1022
debugUsing:aSymbol
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1023
    self signalUnavailableResources.
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1024
    [
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1025
	"/ used to be:
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1026
	"/  (self class selector:testSelector) perform:aSymbol
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1027
	"/ which is bad for subclasses which need more arguments.
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1028
	"/ why not use:
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1029
	"/  self copy perform:aSymbol
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1030
	"/ or even
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1031
	"/  self perform:aSymbol
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1032
	self perform:aSymbol
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1033
    ] ensure:[
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1034
	self resources do:[:each |
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1035
	    each reset
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1036
	]
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1037
    ]
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1038
!
103
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
  1039
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1040
failureLog
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1041
	^SUnitNameResolver class >> #defaultLogDevice
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1042
!
103
ad6897ce99e0 Merge SUnit 3.1 changes
Stefan Vogel <sv@exept.de>
parents: 101
diff changeset
  1043
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1044
logFailure: aString
728
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1045
    self isLogging ifTrue: [
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1046
        self failureLog cr; nextPutAll: aString; flush
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1047
    ]
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1048
728
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1049
    "Modified (format): / 22-03-2019 / 12:49:30 / Claus Gittinger"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1050
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1051
550
cf72a67f1973 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
  1052
logSkipped: aString
728
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1053
    self isLogging ifTrue: [
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1054
        self failureLog cr; nextPutAll: aString; flush
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1055
    ]
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1056
c628d3d488f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  1057
    "Modified (format): / 22-03-2019 / 12:49:40 / Claus Gittinger"
550
cf72a67f1973 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
  1058
!
cf72a67f1973 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
  1059
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1060
openDebuggerOnFailingTestMethod
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1061
	"SUnit has halted one step in front of the failing test method. Step over the 'self halt' and
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1062
	 send into 'self perform: testSelector' to see the failure from the beginning"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1063
594
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1064
	self
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1065
		"/halt;
617433e967e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1066
		performTest
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1067
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1068
    "Modified: / 05-12-2009 / 18:40:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1069
!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1070
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1071
run
688
e2428b24d753 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
  1072
    "run this suite; return the result"
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1073
461
c4a68cc4e547 use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1074
    ^self run: TestResult defaultResultClass new
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1075
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1076
    "Modified: / 29-07-2011 / 12:07:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1077
!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1078
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1079
run: aResult
688
e2428b24d753 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
  1080
    "run this suite; fill and return aResult"
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1081
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1082
    ^self run: aResult beforeEachDo: [:test :result|] afterEachDo: [:test :result|]
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1083
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1084
    "Modified: / 29-07-2011 / 12:07:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1085
!
7861684195ec category rename
Claus Gittinger <cg@exept.de>
parents: 66
diff changeset
  1086
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1087
run: aResult afterEachDo:block2
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1088
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1089
    ^self run: aResult beforeEachDo: [:test :result|] afterEachDo:block2
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1090
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1091
    "Modified: / 29-07-2011 / 12:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1092
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1093
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1094
run: aResult beforeEachDo:block1 afterEachDo:block2
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1095
    "run and fill (update) aResult"
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1096
    
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1097
    ^ self 
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1098
        run:aResult 
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1099
        beforeEachDo:block1 
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1100
        afterEachDo:block2 
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1101
        resetResources:true
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1102
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1103
    "Modified: / 29-07-2011 / 12:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1104
    "Modified (comment): / 28-03-2019 / 13:22:02 / Claus Gittinger"
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1105
!
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1106
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1107
run:aResult beforeEachDo:before afterEachDo:after resetResources:reset
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1108
    "run and fill (update) aResult"
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1109
430
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1110
    ^ self
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1111
        run:aResult
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1112
        beforeEachDo:before
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1113
        afterEachDo:after
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1114
        resetResources:reset
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1115
        debug:false
430
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1116
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1117
    "Created: / 29-07-2011 / 12:04:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1118
    "Modified: / 21-08-2011 / 17:45:17 / cg"
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1119
    "Modified (comment): / 28-03-2019 / 13:22:55 / Claus Gittinger"
430
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1120
!
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1121
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1122
run:result beforeEachDo:before afterEachDo:after resetResources:reset debug:doDebug
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1123
    "Workhorse for running a testcase and updating result.
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1124
     If reset is true, then
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1125
     the resources are reset, otherwise not"
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1126
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1127
    "1. Execute before block"
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1128
    "This code is ugly in Smalltalk/X but it is so because
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1129
     it is more portable - numArgs in ANSI (?)"
737
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1130
    Smalltalk isSmalltalkX ifTrue:[ 
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1131
        before valueWithOptionalArgument:self and:result.   
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1132
    ] ifFalse:[
737
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1133
        before numArgs == 2 ifTrue:[
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1134
            before value: self value: result
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1135
        ] ifFalse:[
737
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1136
            before numArgs == 1 ifTrue:[
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1137
                before value: self
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1138
            ] ifFalse:[
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1139
                before value.
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1140
            ]
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1141
        ].
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1142
    ].
737
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1143
    
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1144
    "2. Run the testcase"
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1145
    reset ifTrue:[
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1146
        [
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1147
            result runCase:self debugged:doDebug
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1148
        ] ensure: [
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1149
            TestResource resetResources: self resources
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1150
        ].
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1151
    ] ifFalse:[
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1152
        result runCase:self debugged:doDebug
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1153
    ].
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1154
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1155
    "3. Execute after block"
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1156
    "This code is ugly in Smalltalk/X but it is so because
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1157
     it is more portable - numArgs in ANSI (?)"
737
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1158
    Smalltalk isSmalltalkX ifTrue:[ 
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1159
        after valueWithOptionalArgument:self and:result.
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1160
    ] ifFalse:[    
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1161
        after numArgs == 2 ifTrue:[
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1162
            after value: self value: result
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1163
        ] ifFalse:[
737
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1164
            after numArgs == 1 ifTrue:[
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1165
                after value: self
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1166
            ] ifFalse:[
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1167
                after value.
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1168
            ]
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1169
        ].
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1170
    ].
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1171
    ^result
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1172
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1173
    "Created: / 29-07-2011 / 12:04:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
430
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1174
    "Created: / 21-08-2011 / 17:44:56 / cg"
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1175
    "Modified: / 13-07-2017 / 14:02:53 / cg"
737
a4f9d8da94aa #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  1176
    "Modified: / 28-03-2019 / 11:16:47 / Claus Gittinger"
745
418e472d0744 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1177
    "Modified (format): / 28-03-2019 / 13:26:15 / Claus Gittinger"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1178
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1179
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1180
run: aResult beforeEachTestCaseDo:block1 afterEachTestCaseDo:block2
262
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1181
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1182
    <resource: #obsolete>
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1183
    self obsoleteMethodWarning: 'Use #run:beforeEachDo:afterEachDo: instead'.
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1184
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1185
    ^self run: aResult beforeEachDo:block1 afterEachDo:block2
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1186
3c46acd3f64a TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents: 254
diff changeset
  1187
    "Modified: / 29-07-2011 / 12:06:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1188
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1189
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1190
runCase
570
c9c4c97948cc class: TestCase
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
  1191
    |didSetup|
c9c4c97948cc class: TestCase
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
  1192
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1193
    self ensureRequiredPackagesAreLoaded.
328
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
  1194
    self resources do: [:each | each availableFor: self].
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
  1195
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
  1196
    [
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1197
        didSetup := false.
758
b61a3defd6c7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
  1198
        Error handle:[:ex |
b61a3defd6c7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
  1199
            Transcript showCR:'error in setup: ',ex description.
b61a3defd6c7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
  1200
            ex reject.
b61a3defd6c7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
  1201
        ] do:[
b61a3defd6c7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
  1202
            self setUp.
b61a3defd6c7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
  1203
        ].
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1204
        didSetup := true.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1205
        self performTest.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1206
    ] ensure: [
713
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1207
        didSetup 
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1208
            ifTrue:[ self safeTearDown ]
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1209
            ifFalse:[ 
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1210
                "/ can we tearDown here????
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1211
                Transcript showCR:'error in setup - no teardown' 
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1212
                "/ self error:'error in setup' 
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1213
            ].
328
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
  1214
    ]
66cae160c956 added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
  1215
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1216
    "Modified: / 13-07-2017 / 14:03:01 / cg"
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1217
    "Modified: / 29-05-2019 / 01:34:01 / Claus Gittinger"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1218
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1219
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1220
runCaseAsFailure
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1221
    self ensureRequiredPackagesAreLoaded.
570
c9c4c97948cc class: TestCase
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
  1222
    self setUp.
c9c4c97948cc class: TestCase
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
  1223
    [
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1224
        [self openDebuggerOnFailingTestMethod] ensure: [self safeTearDown]
570
c9c4c97948cc class: TestCase
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
  1225
    ] fork
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1226
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1227
    "Modified: / 21-06-2000 / 10:04:33 / Sames"
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1228
    "Modified: / 29-05-2019 / 01:34:10 / Claus Gittinger"
139
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1229
!
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1230
5a48f282d789 back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
  1231
runCaseAsFailure: aSemaphore
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1232
    self ensureRequiredPackagesAreLoaded.
570
c9c4c97948cc class: TestCase
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
  1233
    [
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1234
        |didSetup|
570
c9c4c97948cc class: TestCase
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
  1235
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1236
        didSetup := false.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1237
        self resources do: [:each | each availableFor: self].
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1238
        [
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1239
            self setUp.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1240
            didSetup := true.
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1241
            self openDebuggerOnFailingTestMethod
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1242
        ] ensure: [
713
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1243
            didSetup 
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1244
                ifTrue:[ self tearDown ]
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1245
                ifFalse:[ 
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1246
                    "/ can we tearDown here????
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1247
                    Transcript showCR:'error in setup - no teardown' 
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1248
                    "/ self error:'error in setup' 
75290ec5aa59 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  1249
                ].
685
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1250
        ]
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1251
    ] ensure: [aSemaphore signal].
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1252
00195d0e5ebc #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
  1253
    "Modified: / 13-07-2017 / 14:03:44 / cg"
749
d8addd588fc0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1254
    "Modified: / 29-05-2019 / 01:34:30 / Claus Gittinger"
50
6db52a1a4543 updgraded to 3.0
Claus Gittinger <cg@exept.de>
parents: 40
diff changeset
  1255
! !
6db52a1a4543 updgraded to 3.0
Claus Gittinger <cg@exept.de>
parents: 40
diff changeset
  1256
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1257
!TestCase::Should class methodsFor:'documentation'!
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1258
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1259
documentation
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1260
"
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1261
    documentation to be added.
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1262
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1263
    [author:]
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1264
        Claus Gittinger
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1265
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1266
    [instance variables:]
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1267
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1268
    [class variables:]
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1269
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1270
    [see also:]
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1271
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1272
"
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1273
! !
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1274
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1275
!TestCase::Should methodsFor:'accessing'!
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1276
719
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1277
assertSelector
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1278
    ^ assertSelector ? #'assert:'
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1279
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1280
    "Created: / 01-07-2018 / 12:42:00 / Claus Gittinger"
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1281
!
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1282
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1283
testCase:something
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1284
    testCase := something.
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1285
!
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1286
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1287
value:something
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1288
    value := something.
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1289
! !
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1290
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1291
!TestCase::Should methodsFor:'verifying'!
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1292
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1293
be:expectedValue
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1294
    "for expressions like:
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1295
        value should be:expectedValue
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1296
     inside a testcase"
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1297
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1298
    <resource: #skipInDebuggersWalkBack>
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1299
719
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1300
    testCase perform:self assertSelector with:(value = expectedValue).
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1301
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1302
    "Created: / 01-07-2018 / 12:11:46 / Claus Gittinger"
719
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1303
!
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1304
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1305
beInstanceOf:expectedClass
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1306
    "for expressions like:
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1307
        value should be:expectedValue
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1308
     inside a testcase"
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1309
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1310
    <resource: #skipInDebuggersWalkBack>
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1311
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1312
    testCase perform:self assertSelector with:(value class == expectedClass).
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1313
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1314
    "Created: / 01-07-2018 / 12:38:38 / Claus Gittinger"
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1315
!
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1316
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1317
equal:expectedValue
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1318
    "for expressions like:
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1319
        value should equal:expectedValue
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1320
     inside a testcase"
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1321
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1322
    <resource: #skipInDebuggersWalkBack>
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1323
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1324
    testCase perform:self assertSelector with:(value = expectedValue).
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1325
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1326
    "Created: / 01-07-2018 / 12:30:08 / Claus Gittinger"
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1327
!
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1328
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1329
not
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1330
    assertSelector := #deny:
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1331
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1332
    "Created: / 01-07-2018 / 12:42:12 / Claus Gittinger"
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1333
!
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1334
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1335
raise:exceptionClass
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1336
    "for expressions like:
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1337
        value should be:expectedValue
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1338
     inside a testcase"
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1339
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1340
    <resource: #skipInDebuggersWalkBack>
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1341
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1342
    self assertSelector == #assert: ifTrue:[
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1343
        testCase should:value raise:exceptionClass
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1344
    ] ifFalse:[
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1345
        self assertSelector == #deny: ifTrue:[
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1346
            testCase shouldnt:value raise:exceptionClass
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1347
        ] ifFalse:[
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1348
            self error.
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1349
        ].    
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1350
    ].
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1351
2c96860ad5cb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1352
    "Created: / 01-07-2018 / 12:39:48 / Claus Gittinger"
717
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1353
! !
31366612f433 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1354
12
4a6597527f92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6
diff changeset
  1355
!TestCase class methodsFor:'documentation'!
4a6597527f92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6
diff changeset
  1356
290
7b52b68d57cb changed: #isTestSelector:
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1357
version
623
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1358
    ^ '$Header$'
290
7b52b68d57cb changed: #isTestSelector:
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1359
!
7b52b68d57cb changed: #isTestSelector:
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1360
203
ca0c9f44ee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
  1361
version_CVS
623
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1362
    ^ '$Header$'
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1363
!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1364
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1365
version_SVN
623
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1366
    ^ '$Id$'
12
4a6597527f92 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6
diff changeset
  1367
! !
81
10852410025d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 73
diff changeset
  1368
550
cf72a67f1973 class: TestCase
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
  1369
2
6f450bf08bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1
diff changeset
  1370
TestCase initialize!