reports/Builder__TestReport.st
changeset 250 4392c84aaf1c
parent 249 50d2712af1a9
child 251 cb6ebbd8d1c0
equal deleted inserted replaced
249:50d2712af1a9 250:4392c84aaf1c
   304 
   304 
   305     outcome result: (TestResult stateError).
   305     outcome result: (TestResult stateError).
   306     outcome collectedOutput: collector contents. 
   306     outcome collectedOutput: collector contents. 
   307     format writeTestCase: testcase outcome: outcome time: time exception: exception.
   307     format writeTestCase: testcase outcome: outcome time: time exception: exception.
   308     Transcript show:'...ERROR'.
   308     Transcript show:'...ERROR'.
       
   309     Logger trace: 'Finised %1>>%2, result ERROR' with: testcase nameForHDTestReport with: testcase selectorForHDTestReport.
   309     self errorOutcomes add:outcome.      
   310     self errorOutcomes add:outcome.      
   310     nerror := nerror + 1.
   311     nerror := nerror + 1.
   311 
   312 
   312     "Created: / 03-08-2011 / 15:00:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   313     "Created: / 03-08-2011 / 15:00:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   313     "Modified: / 16-09-2014 / 18:55:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   314     "Modified: / 29-10-2014 / 14:02:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   314 !
   315 !
   315 
   316 
   316 addFailure: testcase detail: exception
   317 addFailure: testcase detail: exception
   317 
   318 
   318     outcome result: (TestResult stateFail).
   319     outcome result: (TestResult stateFail).
   319     outcome collectedOutput: collector contents. 
   320     outcome collectedOutput: collector contents. 
   320     format writeTestCase: testcase outcome: outcome time: time exception: exception.
   321     format writeTestCase: testcase outcome: outcome time: time exception: exception.
   321     Transcript show:'...FAILED'.
   322     Transcript show:'...FAILED'.
       
   323     Logger trace: 'Finised %1>>%2, result FAILED' with: testcase nameForHDTestReport with: testcase selectorForHDTestReport.
   322     self failureOutcomes add: outcome.
   324     self failureOutcomes add: outcome.
   323     nfailed := nfailed + 1.
   325     nfailed := nfailed + 1.
   324 
   326 
   325     "Created: / 03-08-2011 / 15:00:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   327     "Created: / 03-08-2011 / 15:00:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   326     "Modified: / 16-09-2014 / 15:23:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   328     "Modified: / 29-10-2014 / 14:01:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   327 !
   329 !
   328 
   330 
   329 addPass: testcase
   331 addPass: testcase
   330 
   332 
   331     outcome result: TestResult statePass.
   333     outcome result: TestResult statePass.
   332     format writeTestCase: testcase outcome: outcome time: time exception: nil.
   334     format writeTestCase: testcase outcome: outcome time: time exception: nil.
   333     Transcript show:'...OK'.
   335     Transcript show:'...OK'.
       
   336     Logger trace: 'Finised %1>>%2, result PASSED' with: testcase nameForHDTestReport with: testcase selectorForHDTestReport.
   334     npassed := npassed + 1.
   337     npassed := npassed + 1.
   335 
   338 
   336     "Created: / 03-08-2011 / 15:19:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   339     "Created: / 03-08-2011 / 15:19:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   337     "Modified: / 06-06-2014 / 09:34:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   340     "Modified: / 29-10-2014 / 14:01:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   338 !
   341 !
   339 
   342 
   340 addSkipped: testcase
   343 addSkipped: testcase
   341 
   344 
   342     outcome := self createOutcome.
   345     outcome := self createOutcome.
   343     outcome testCase: testcase.        
   346     outcome testCase: testcase.        
   344     outcome result: TestResult stateSkip.
   347     outcome result: TestResult stateSkip.
   345     format writeTestCase: testcase outcome: outcome time: time exception: nil.
   348     format writeTestCase: testcase outcome: outcome time: time exception: nil.
   346     Transcript show:'...SKIPPED'.
   349     Transcript show:'...SKIPPED'.
       
   350     Logger trace: 'Finised %1>>%2, result SKIPPED' with: testcase nameForHDTestReport with: testcase selectorForHDTestReport.
   347     nskipped := nskipped + 1.
   351     nskipped := nskipped + 1.
   348 
   352 
   349     "Created: / 21-11-2012 / 15:35:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   353     "Created: / 21-11-2012 / 15:35:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   350     "Modified: / 16-09-2014 / 19:47:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   354     "Modified: / 29-10-2014 / 14:01:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   351 ! !
   355 ! !
   352 
   356 
   353 !TestReport::Result methodsFor:'initialization'!
   357 !TestReport::Result methodsFor:'initialization'!
   354 
   358 
   355 initialize
   359 initialize
   421     sel := aTestCase selectorForHDTestReport.
   425     sel := aTestCase selectorForHDTestReport.
   422     sel size > 20 ifTrue:[
   426     sel size > 20 ifTrue:[
   423         sel := '...' , (sel copyFrom: sel size - 16 to: sel size)
   427         sel := '...' , (sel copyFrom: sel size - 16 to: sel size)
   424     ].
   428     ].
   425     Transcript showCR:('%1 >> #%2' bindWith: aTestCase nameForHDTestReport with: aTestCase selectorForHDTestReport).
   429     Transcript showCR:('%1 >> #%2' bindWith: aTestCase nameForHDTestReport with: aTestCase selectorForHDTestReport).
   426     Transcript show:('%-20s >> %-20s : ' printfWith: nm with: sel). 
   430     Transcript show:('%-20s >> %-20s : ' printfWith: nm with: sel).
   427 
       
   428 
   431 
   429     outcome := self createOutcome.
   432     outcome := self createOutcome.
   430     outcome testCase: aTestCase.
   433     outcome testCase: aTestCase.
   431 
   434 
   432     doFork ifFalse:[ 
   435     doFork ifFalse:[ 
   447     ].
   450     ].
   448 
   451 
   449     self error:'Unssuported platform'
   452     self error:'Unssuported platform'
   450 
   453 
   451     "Created: / 12-01-2012 / 17:52:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   454     "Created: / 12-01-2012 / 17:52:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   452     "Modified: / 28-11-2012 / 18:04:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   455     "Modified: / 29-10-2014 / 13:57:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   453 ! !
   456 ! !
   454 
   457 
   455 !TestReport::Result methodsFor:'running-private'!
   458 !TestReport::Result methodsFor:'running-private'!
   456 
   459 
   457 lightForkCase:aTestCase debugged: debugged timeout: timeout
   460 lightForkCase:aTestCase debugged: debugged timeout: timeout
   458     | thread sema stime etime timeouted error stack log logPos |
   461     | thread sema stime etime timeouted error stack log logPos |
   459 
   462 
       
   463     Logger trace: 'Running %1>>%2' with: aTestCase nameForHDTestReport with: aTestCase selectorForHDTestReport.
   460     Transcript show:'F'.
   464     Transcript show:'F'.
   461     sema := Semaphore new.
   465     sema := Semaphore new.
   462     stime := OperatingSystem getMillisecondTime.
   466     stime := OperatingSystem getMillisecondTime.
   463     log := false.
   467     log := false.
   464     logPos := format stream stream position.
   468     logPos := format stream stream position.
   484         format 
   488         format 
   485             writeTestCase: aTestCase outcome: outcome 
   489             writeTestCase: aTestCase outcome: outcome 
   486                      time: etime - stime
   490                      time: etime - stime
   487                 exception: error
   491                 exception: error
   488                stacktrace: stack.
   492                stacktrace: stack.
   489          Transcript show:'...ERROR'
   493          Transcript show:'...ERROR'.
       
   494          Logger trace: 'Finised %1>>%2, result ERROR (timeout)' with: aTestCase nameForHDTestReport with: aTestCase selectorForHDTestReport.
   490     ].
   495     ].
   491 
   496 
   492     outcome := nil.
   497     outcome := nil.
   493     Transcript cr.
   498     Transcript cr.
   494 
   499 
   495     "Created: / 12-01-2012 / 17:42:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   500     "Created: / 12-01-2012 / 17:42:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   496     "Modified: / 06-06-2014 / 09:33:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   501     "Modified: / 29-10-2014 / 13:59:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   497 !
   502 !
   498 
   503 
   499 unixForkCase:aTestCase debugged: debugged timeout: timeout
   504 unixForkCase:aTestCase debugged: debugged timeout: timeout
   500     | pid status sema stime etime error stack suiteFailuresBefore suiteErrorsBefore log logPos |
   505     | pid status sema stime etime error stack suiteFailuresBefore suiteErrorsBefore log logPos |
   501 
   506