reports/Builder__TestReport.st
branchjv
changeset 570 9c47ccc9e9b5
parent 528 67d1c7df7f90
equal deleted inserted replaced
569:67563f72d36b 570:9c47ccc9e9b5
       
     1 "
       
     2 COPYRIGHT (c) 2021 LabWare
       
     3 "
     1 "{ Package: 'stx:goodies/builder/reports' }"
     4 "{ Package: 'stx:goodies/builder/reports' }"
     2 
     5 
     3 "{ NameSpace: Builder }"
     6 "{ NameSpace: Builder }"
     4 
     7 
     5 Report subclass:#TestReport
     8 Report subclass:#TestReport
     6 	instanceVariableNames:'suite coverage instrument keepStdout keepBytecode'
     9 	instanceVariableNames:'suite coverage instrument keepStdout keepBytecode failOnFailure
       
    10 		failOnError'
     7 	classVariableNames:''
    11 	classVariableNames:''
     8 	poolDictionaries:''
    12 	poolDictionaries:''
     9 	category:'Builder-Reports'
    13 	category:'Builder-Reports'
    10 !
    14 !
    11 
    15 
    15 	classVariableNames:''
    19 	classVariableNames:''
    16 	poolDictionaries:''
    20 	poolDictionaries:''
    17 	privateIn:TestReport
    21 	privateIn:TestReport
    18 !
    22 !
    19 
    23 
       
    24 !TestReport class methodsFor:'documentation'!
       
    25 
       
    26 copyright
       
    27 "
       
    28 COPYRIGHT (c) 2021 LabWare
       
    29 
       
    30 "
       
    31 ! !
    20 
    32 
    21 !TestReport methodsFor:'accessing'!
    33 !TestReport methodsFor:'accessing'!
    22 
    34 
    23 keepBytecode
    35 keepBytecode
    24     ^ keepBytecode
    36     ^ keepBytecode
    91 cmdlineOptionDropStdout
   103 cmdlineOptionDropStdout
    92 
   104 
    93     ^CmdLineOption new
   105     ^CmdLineOption new
    94         long: 'drop-stdout';
   106         long: 'drop-stdout';
    95         description: 'Do not include stdout in report';
   107         description: 'Do not include stdout in report';
    96         action:[
   108         action:[ keepStdout := false ];
    97             keepStdout := false
   109         yourself
    98         ]
       
    99 
   110 
   100     "Created: / 08-08-2014 / 11:48:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   111     "Created: / 08-08-2014 / 11:48:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   112     "Modified: / 03-12-2021 / 13:18:13 / Jan Vrany <jan.vrany@labware.com>"
       
   113 !
       
   114 
       
   115 cmdlineOptionFailOnError
       
   116 
       
   117     ^CmdLineOption new
       
   118         long: 'fail-on-error';
       
   119         description: 'Exit with error code 1 if there is a test error (test failures are ignored)';
       
   120         action:[ failOnError := true ];
       
   121         yourself
       
   122 
       
   123     "Created: / 03-12-2021 / 13:21:28 / Jan Vrany <jan.vrany@labware.com>"
       
   124 !
       
   125 
       
   126 cmdlineOptionFailOnFailure
       
   127 
       
   128     ^CmdLineOption new
       
   129         long: 'fail-on-failure';
       
   130         description: 'Exit with error code 1 if there is a test error or failure';
       
   131         action:[ failOnFailure := true ];
       
   132         yourself
       
   133 
       
   134     "Created: / 03-12-2021 / 13:20:38 / Jan Vrany <jan.vrany@labware.com>"
   101 !
   135 !
   102 
   136 
   103 cmdlineOptionInstrument
   137 cmdlineOptionInstrument
   104 
   138 
   105     ^CmdLineOption new
   139     ^CmdLineOption new
   149 initialize
   183 initialize
   150 
   184 
   151     suite := TestSuite new.
   185     suite := TestSuite new.
   152     coverage := nil.
   186     coverage := nil.
   153     keepStdout := true.
   187     keepStdout := true.
       
   188     failOnError := false.
       
   189     failOnFailure := false.
   154 
   190 
   155     "Modified: / 08-08-2014 / 11:45:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   191     "Modified: / 08-08-2014 / 11:45:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   192     "Modified: / 03-12-2021 / 13:21:50 / Jan Vrany <jan.vrany@labware.com>"
   156 !
   193 !
   157 
   194 
   158 setupForClasses:classes
   195 setupForClasses:classes
   159     "Setup the report to run given classes"
   196     "Setup the report to run given classes"
   160 
   197 
   274     result printOn: Transcript.
   311     result printOn: Transcript.
   275     Transcript show: ', test execution time '.
   312     Transcript show: ', test execution time '.
   276     (t1 - t0) printOn: Transcript.
   313     (t1 - t0) printOn: Transcript.
   277     Transcript cr.
   314     Transcript cr.
   278 
   315 
       
   316     (failOnFailure and: [ result hasFailuresOrErrors ]) ifTrue: [ ^ 1 ].
       
   317     (failOnError and: [ result hasErrors ]) ifTrue: [ ^ 1 ].
       
   318     ^ 0
       
   319 
   279     "Created: / 04-08-2011 / 12:39:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   320     "Created: / 04-08-2011 / 12:39:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   280     "Modified: / 23-02-2017 / 12:47:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   321     "Modified: / 23-02-2017 / 12:47:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   322     "Modified: / 03-12-2021 / 13:23:16 / Jan Vrany <jan.vrany@labware.com>"
   281 ! !
   323 ! !
   282 
   324 
   283 !TestReport::Result methodsFor:'accessing'!
   325 !TestReport::Result methodsFor:'accessing'!
   284 
   326 
   285 errorCount
   327 errorCount