TestRunInfo.st
author Claus Gittinger <cg@exept.de>
Sun, 01 Jul 2018 12:52:19 +0200
changeset 719 2c96860ad5cb
parent 359 ab2200b0b6b8
permissions -rw-r--r--
#FEATURE by cg class: TestCase::Should class definition added: #assertSelector #beInstanceOf: #equal: #not #raise: changed: #be:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/sunit' }"
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
     3
Object subclass:#TestCaseOutcome
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
     4
	instanceVariableNames:'testCase result properties'
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	classVariableNames:''
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	poolDictionaries:''
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	category:'SUnit-Base'
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    10
!TestCaseOutcome class methodsFor:'documentation'!
335
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    11
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    12
documentation
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    13
"
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    14
    will keep additional info for a testCase run:
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    15
        startTime, endTime,
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    16
        backtrace (if fail or error)
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    17
        and collectedStdout
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    18
"
22712dd44b8e added: #documentation
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    19
! !
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    21
!TestCaseOutcome class methodsFor:'instance creation'!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    22
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    23
forCase: aTestCase
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    24
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    25
    ^self new testCase: aTestCase; yourself
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    26
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    27
    "Created: / 16-08-2011 / 15:24:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    28
! !
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    30
!TestCaseOutcome methodsFor:'accessing'!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    31
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    32
collectedOutput
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    33
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    34
    ^self propertyAt: #collectedOutput
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    35
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    36
    "Modified: / 16-08-2011 / 15:27:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    37
    "Created: / 16-08-2011 / 18:19:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    40
collectedOutput: aString
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    41
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    42
    ^self propertyAt: #collectedOutput put: aString
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    43
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    44
    "Modified: / 16-08-2011 / 15:28:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    45
    "Created: / 16-08-2011 / 18:19:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
!
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
endTime
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    49
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    50
    ^self propertyAt: #endTime
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    51
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    52
    "Modified: / 16-08-2011 / 15:28:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
!
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    55
endTime: anObject
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    56
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    57
    ^self propertyAt: #endTime put: anObject
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    58
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    59
    "Modified: / 16-08-2011 / 15:28:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
!
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
exceptionDetail
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    63
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    64
    ^self propertyAt: #exceptionDetail
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    65
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    66
    "Modified: / 16-08-2011 / 15:29:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    67
!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    68
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    69
exceptionDetail: anObject
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    70
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    71
    ^self propertyAt: #exceptionDetail put: anObject
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    72
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    73
    "Modified: / 16-08-2011 / 15:29:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    74
!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    75
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    76
propertyAt: aSymbol
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    77
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    78
    self propertyAt: aSymbol ifAbsent: [nil]
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    79
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    80
    "Created: / 16-08-2011 / 15:26:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
!
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    83
propertyAt: aSymbol ifAbsent: aBlock
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    84
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    85
    properties isNil ifTrue: [^aBlock value].
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    86
    ^properties at: aSymbol ifAbsent:aBlock.
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    87
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    88
    "Created: / 16-08-2011 / 15:27:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    89
!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    90
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    91
propertyAt: aSymbol put: anObject
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    92
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    93
    properties isNil ifTrue: [properties := Dictionary new].
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    94
    properties at: aSymbol put: anObject.
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    95
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    96
    "Created: / 16-08-2011 / 15:28:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    97
!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    98
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
    99
result
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   100
    ^ result
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   101
!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   102
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   103
result:something
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   104
    result := something.
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   105
!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   106
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   107
selector
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   108
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   109
    ^testCase selector
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   110
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   111
    "Created: / 16-08-2011 / 15:38:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
!
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
startTime
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   115
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   116
    ^self propertyAt: #startTime
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   117
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   118
    "Modified: / 16-08-2011 / 15:29:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   119
!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   120
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   121
startTime: anObject
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   122
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   123
    ^self propertyAt: #startTime put: anObject
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   124
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   125
    "Modified: / 16-08-2011 / 15:29:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
!
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   128
testCase
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   129
    ^ testCase
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   130
!
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   131
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   132
testCase:something
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   133
    testCase := something.
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
! !
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
346
f64d6716acce Refactored to use TestResultOutcome
vrany
parents: 335
diff changeset
   136
!TestCaseOutcome class methodsFor:'documentation'!
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
version_CVS
359
ab2200b0b6b8 initial checkin
vrany
parents: 357
diff changeset
   139
    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestRunInfo.st,v 1.5 2011-08-16 18:17:40 vrany Exp $'
334
0c788a78c209 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
! !