reports/Builder__TestReport.st
changeset 239 517a62e9f9ab
parent 237 8229efa1f621
child 240 d10369beab55
equal deleted inserted replaced
238:c5047b0ed211 239:517a62e9f9ab
   269 
   269 
   270 addError: testcase detail: exception
   270 addError: testcase detail: exception
   271 
   271 
   272     outcome result: (TestResult stateError).
   272     outcome result: (TestResult stateError).
   273     format writeTestCase: testcase outcome: outcome time: time exception: exception.
   273     format writeTestCase: testcase outcome: outcome time: time exception: exception.
   274     Transcript show:'ERROR'.
   274     Transcript show:'...ERROR'.
   275     self errorOutcomes add:outcome.      
   275     self errorOutcomes add:outcome.      
   276     nerror := nerror + 1.
   276     nerror := nerror + 1.
   277 
   277 
   278     "Created: / 03-08-2011 / 15:00:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   278     "Created: / 03-08-2011 / 15:00:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   279     "Modified: / 06-06-2014 / 01:00:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   279     "Modified: / 06-06-2014 / 09:34:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   280 !
   280 !
   281 
   281 
   282 addFailure: testcase detail: exception
   282 addFailure: testcase detail: exception
   283 
   283 
   284     outcome result: (TestResult stateFail).
   284     outcome result: (TestResult stateFail).
   285     format writeTestCase: testcase outcome: outcome time: time exception: exception.
   285     format writeTestCase: testcase outcome: outcome time: time exception: exception.
   286     Transcript show:'FAILED'.
   286     Transcript show:'...FAILED'.
   287     self failureOutcomes add: outcome.
   287     self failureOutcomes add: outcome.
   288     nfailed := nfailed + 1.
   288     nfailed := nfailed + 1.
   289 
   289 
   290     "Created: / 03-08-2011 / 15:00:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   290     "Created: / 03-08-2011 / 15:00:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   291     "Modified: / 06-06-2014 / 01:00:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   291     "Modified: / 06-06-2014 / 09:34:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   292 !
   292 !
   293 
   293 
   294 addPass: testcase
   294 addPass: testcase
   295 
   295 
   296     outcome result: TestResult statePass.
   296     outcome result: TestResult statePass.
   297     format writeTestCase: testcase outcome: outcome time: time exception: nil.
   297     format writeTestCase: testcase outcome: outcome time: time exception: nil.
   298     Transcript show:'OK'.
   298     Transcript show:'...OK'.
   299     npassed := npassed + 1.
   299     npassed := npassed + 1.
   300 
   300 
   301     "Created: / 03-08-2011 / 15:19:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   301     "Created: / 03-08-2011 / 15:19:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   302     "Modified: / 06-06-2014 / 01:00:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   302     "Modified: / 06-06-2014 / 09:34:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   303 !
   303 !
   304 
   304 
   305 addSkipped: testcase
   305 addSkipped: testcase
   306 
   306 
   307     outcome result: TestResult stateSkip.
   307     outcome result: TestResult stateSkip.
   308     format writeTestCase: testcase outcome: outcome time: time exception: nil.
   308     format writeTestCase: testcase outcome: outcome time: time exception: nil.
   309     Transcript show:'SKIPPED'.
   309     Transcript show:'...SKIPPED'.
   310     nskipped := nskipped + 1.
   310     nskipped := nskipped + 1.
   311 
   311 
   312     "Created: / 21-11-2012 / 15:35:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   312     "Created: / 21-11-2012 / 15:35:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   313     "Modified: / 06-06-2014 / 00:59:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   313     "Modified: / 06-06-2014 / 09:34:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   314 ! !
   314 ! !
   315 
   315 
   316 !TestReport::Result methodsFor:'initialization'!
   316 !TestReport::Result methodsFor:'initialization'!
   317 
   317 
   318 initialize
   318 initialize
   417 !TestReport::Result methodsFor:'running-private'!
   417 !TestReport::Result methodsFor:'running-private'!
   418 
   418 
   419 lightForkCase:aTestCase debugged: debugged timeout: timeout
   419 lightForkCase:aTestCase debugged: debugged timeout: timeout
   420     | thread sema stime etime timeouted error stack log logPos |
   420     | thread sema stime etime timeouted error stack log logPos |
   421 
   421 
   422     Transcript show:'forking...'.
   422     Transcript show:'F'.
   423     sema := Semaphore new.
   423     sema := Semaphore new.
   424     stime := OperatingSystem getMillisecondTime.
   424     stime := OperatingSystem getMillisecondTime.
   425     log := false.
   425     log := false.
   426     logPos := format stream stream position.
   426     logPos := format stream stream position.
   427     timeouted := false.
   427     timeouted := false.
   428     thread := [ super runCase:aTestCase debugged: debugged ] newProcess.
   428     thread := [ super runCase:aTestCase debugged: debugged ] newProcess.
   429     thread addExitAction:[sema signal].
   429     thread addExitAction:[sema signal].
   430     thread name: ('Testcase execution thread (%1)' bindWith: aTestCase).
   430     thread name: ('Testcase execution thread (%1)' bindWith: aTestCase).
   431     thread resume.
   431     thread resume.
   432 
   432 
   433     Transcript show: 'waiting for child...'.
   433     Transcript show: 'W'.
   434     (sema waitWithTimeout:timeout) isNil ifTrue: [
   434     (sema waitWithTimeout:timeout) isNil ifTrue: [
   435         Transcript show: 'timeout...'.
   435         Transcript show: 'T'.
   436         stack := String streamContents:[:s |  ReportRunner dumpProcessesOn:s ].
   436         stack := String streamContents:[:s |  ReportRunner dumpProcessesOn:s ].
   437         thread terminate.
   437         thread terminate.
   438         timeouted := true.
   438         timeouted := true.
   439         Transcript show: 'killed...'.
   439         Transcript show: 'K'.
   440     ].
   440     ].
   441 
   441 
   442     etime := OperatingSystem getMillisecondTime.
   442     etime := OperatingSystem getMillisecondTime.
   443     timeouted ifTrue:[
   443     timeouted ifTrue:[
   444         error := TimeoutError new messageText: 'Timed out'.
   444         error := TimeoutError new messageText: 'Timed out'.
   446         format 
   446         format 
   447             writeTestCase: aTestCase outcome: outcome 
   447             writeTestCase: aTestCase outcome: outcome 
   448                      time: etime - stime
   448                      time: etime - stime
   449                 exception: error
   449                 exception: error
   450                stacktrace: stack.
   450                stacktrace: stack.
   451          Transcript show:'ERROR'
   451          Transcript show:'...ERROR'
   452     ].
   452     ].
   453 
   453 
   454     outcome := nil.
   454     outcome := nil.
   455     Transcript cr.
   455     Transcript cr.
   456 
   456 
   457     "Created: / 12-01-2012 / 17:42:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   457     "Created: / 12-01-2012 / 17:42:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   458     "Modified: / 06-06-2014 / 09:19:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   458     "Modified: / 06-06-2014 / 09:33:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   459 !
   459 !
   460 
   460 
   461 unixForkCase:aTestCase debugged: debugged timeout: timeout
   461 unixForkCase:aTestCase debugged: debugged timeout: timeout
   462     | pid status sema stime etime error stack suiteFailuresBefore suiteErrorsBefore log logPos |
   462     | pid status sema stime etime error stack suiteFailuresBefore suiteErrorsBefore log logPos |
   463 
   463