TestCaseOutcome.st
changeset 741 5385d22dcc62
parent 736 481186cd77cf
equal deleted inserted replaced
740:7f2cc93c7a75 741:5385d22dcc62
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "{ Package: 'stx:goodies/sunit' }"
     3 "{ Package: 'stx:goodies/sunit' }"
     2 
     4 
     3 "{ NameSpace: Smalltalk }"
     5 "{ NameSpace: Smalltalk }"
     4 
     6 
     5 Object subclass:#TestCaseOutcome
     7 Object subclass:#TestCaseOutcome
    74 
    76 
    75     "Modified: / 16-08-2011 / 15:29:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    77     "Modified: / 16-08-2011 / 15:29:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    76 !
    78 !
    77 
    79 
    78 executionTime
    80 executionTime
    79     "the execution time in millis; nil if not yet executed"
    81     "the execution time in millis; 
       
    82      nil if not yet executed.
       
    83      If still running, the millis spent executing 
       
    84      is returned"
    80 
    85 
    81     |startTime endTime|
    86     |startTime endTime|
    82 
    87 
    83     (startTime := self startTime) isNil ifTrue:[
    88     (startTime := self startTime) isNil ifTrue:[
    84         "/ not yet executed
    89         "/ not yet executed
    89         endTime := Timestamp now
    94         endTime := Timestamp now
    90     ].
    95     ].
    91     ^ (endTime millisecondDeltaFrom:startTime)
    96     ^ (endTime millisecondDeltaFrom:startTime)
    92 
    97 
    93     "Modified (format): / 18-08-2011 / 21:02:28 / cg"
    98     "Modified (format): / 18-08-2011 / 21:02:28 / cg"
       
    99     "Modified (comment): / 28-03-2019 / 13:29:02 / Claus Gittinger"
       
   100 !
       
   101 
       
   102 executionTimeDuration
       
   103     "the execution time as TimeDuration; 
       
   104      nil if not yet executed.
       
   105      If still running, the time spent executing 
       
   106      is returned"
       
   107 
       
   108     |startTime endTime|
       
   109 
       
   110     (startTime := self startTime) isNil ifTrue:[
       
   111         "/ not yet executed
       
   112         ^ nil
       
   113     ].
       
   114     (endTime := self endTime) isNil ifTrue:[
       
   115         "/ assume it is still running...
       
   116         endTime := Timestamp now
       
   117     ].
       
   118     ^ (endTime - startTime)
       
   119 
       
   120     "Created: / 28-03-2019 / 13:28:53 / Claus Gittinger"
    94 !
   121 !
    95 
   122 
    96 propertyAt: aSymbol
   123 propertyAt: aSymbol
    97 
   124 
    98     ^ self propertyAt: aSymbol ifAbsent: [nil]
   125     ^ self propertyAt: aSymbol ifAbsent: [nil]