TestResultStX.st
changeset 505 f624d7b45d5e
parent 500 b097ce6e7e84
child 508 c6352c44c013
equal deleted inserted replaced
504:81de3dfd9886 505:f624d7b45d5e
    91     (method := con method) notNil ifTrue:[
    91     (method := con method) notNil ifTrue:[
    92         cls := method mclass.
    92         cls := method mclass.
    93         cls notNil ifTrue:[
    93         cls notNil ifTrue:[
    94             relPath := cls package copyReplaceAll:$: with:$/.
    94             relPath := cls package copyReplaceAll:$: with:$/.
    95             relPath := relPath copyReplaceAll:$\ with:$/.
    95             relPath := relPath copyReplaceAll:$\ with:$/.
    96             relPath := (relPath asFilename construct:cls classFilename) name.
    96             relPath := (relPath asFilename construct:cls theNonMetaclass classFilename) name.
    97 
    97 
    98             classSourceFile := Smalltalk getPackageFileName:relPath.
    98             classSourceFile := Smalltalk getPackageFileName:relPath.
    99             classSourceFile isNil ifTrue:[    
    99             classSourceFile isNil ifTrue:[    
   100                 classSourceFile := self class sourceFilenameOfClass:cls.
   100                 classSourceFile := self class sourceFilenameOfClass:cls.
   101             ].
   101             ].
   146     ^outcome endTime: Timestamp now
   146     ^outcome endTime: Timestamp now
   147 
   147 
   148     "Created: / 16-08-2011 / 17:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   148     "Created: / 16-08-2011 / 17:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   149 !
   149 !
   150 
   150 
   151 rememberException:detail
   151 rememberException:ex
   152     "common for failure and error:
   152     "common for failure and error:
   153      called when a test fails. testCase is the failed 
   153      called when a test fails. testCase is the failed 
   154      testcase, detail is platform specific object describing 
   154      testcase, ex is platform specific object describing 
   155      the failure. Actually, on all platforms exeptt GemStone, 
   155      the failure. Actually, on all platforms exeptt GemStone, 
   156      detail is an instance of an exception that caused the failure"
   156      ex is an instance of an exception that caused the failure"
   157 
   157 
   158     |backtrace|
   158     |backtrace|
   159 
   159 
   160     ((Smalltalk respondsTo:#isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifTrue:[
   160     ((Smalltalk respondsTo:#isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifTrue:[
   161         "remember the backtrace (as string, to prevent objects from being kept forwever
   161         "remember the backtrace (as string, to prevent objects from being kept forwever
   168                         |con topReached|
   168                         |con topReached|
   169 
   169 
   170                         "could use printAllOn:s, but noone is interested in contexts above the
   170                         "could use printAllOn:s, but noone is interested in contexts above the
   171                          testcase's runtest context"
   171                          testcase's runtest context"
   172                         topReached := false.
   172                         topReached := false.
   173                         con := detail suspendedContext.
   173                         con := ex suspendedContext.
   174                         [ 
   174                         [ 
   175                             con notNil and:[topReached not]
   175                             con notNil and:[topReached not]
   176                         ] whileTrue:[
   176                         ] whileTrue:[
   177                             self printLineForContextForJavaCompatibleStackTrace:con on:s.
   177                             self printLineForContextForJavaCompatibleStackTrace:con on:s.
   178                             topReached := (con selector == outcome selector)
   178                             topReached := (con selector == outcome selector)
   181                             con := con sender.
   181                             con := con sender.
   182                         ]
   182                         ]
   183                      ].
   183                      ].
   184 
   184 
   185         outcome exceptionDetail:(Dictionary new
   185         outcome exceptionDetail:(Dictionary new
   186                                     at:#exception put:detail signal;
   186                                     at:#exception put:ex signal;
   187                                     at:#description put:detail description;
   187                                     at:#description put:ex description;
   188                                     at:#backtrace put:backtrace;
   188                                     at:#backtrace put:backtrace;
   189                                     yourself).
   189                                     yourself).
   190         ^ self.
   190         ^ self.
   191     ].
   191     ].
   192 
   192 
   195     "Created: / 06-08-2011 / 11:29:23 / cg"
   195     "Created: / 06-08-2011 / 11:29:23 / cg"
   196     "Created: / 16-08-2011 / 17:32:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   196     "Created: / 16-08-2011 / 17:32:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   197 !
   197 !
   198 
   198 
   199 rememberOutput: aString
   199 rememberOutput: aString
   200 
       
   201     outcome collectedOutput: aString
   200     outcome collectedOutput: aString
   202 
   201 
   203     "Created: / 16-08-2011 / 18:18:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   202     "Created: / 16-08-2011 / 18:18:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   204 !
   203 !
   205 
   204 
   234 ! !
   233 ! !
   235 
   234 
   236 !TestResultStX class methodsFor:'documentation'!
   235 !TestResultStX class methodsFor:'documentation'!
   237 
   236 
   238 version
   237 version
   239     ^ '$Header: /cvs/stx/stx/goodies/sunit/TestResultStX.st,v 1.6 2012-11-06 21:14:37 cg Exp $'
   238     ^ '$Header: /cvs/stx/stx/goodies/sunit/TestResultStX.st,v 1.7 2012-11-07 01:09:14 cg Exp $'
   240 !
   239 !
   241 
   240 
   242 version_CVS
   241 version_CVS
   243     ^ '$Header: /cvs/stx/stx/goodies/sunit/TestResultStX.st,v 1.6 2012-11-06 21:14:37 cg Exp $'
   242     ^ '$Header: /cvs/stx/stx/goodies/sunit/TestResultStX.st,v 1.7 2012-11-07 01:09:14 cg Exp $'
   244 ! !
   243 ! !