reports/Builder__TestReport.st
changeset 234 b48196ea5f68
parent 215 b6e13772ac08
child 236 475480551293
equal deleted inserted replaced
233:8ea8b3692704 234:b48196ea5f68
     1 "{ Package: 'stx:goodies/builder/reports' }"
     1 "{ Package: 'stx:goodies/builder/reports' }"
     2 
     2 
     3 "{ NameSpace: Builder }"
     3 "{ NameSpace: Builder }"
     4 
     4 
     5 Report subclass:#TestReport
     5 Report subclass:#TestReport
     6 	instanceVariableNames:'suite coverage'
     6 	instanceVariableNames:'suite coverage instrument'
     7 	classVariableNames:''
     7 	classVariableNames:''
     8 	poolDictionaries:''
     8 	poolDictionaries:''
     9 	category:'Builder-Reports'
     9 	category:'Builder-Reports'
    10 !
    10 !
    11 
    11 
    60 cmdlineOptionCoverage
    60 cmdlineOptionCoverage
    61 
    61 
    62     ^CmdLineOption new
    62     ^CmdLineOption new
    63         short: $c;
    63         short: $c;
    64         long: 'coverage';
    64         long: 'coverage';
    65         description: 'Collect code coverage when running tests';
    65         description: 'collect code coverage when running tests';
    66         action:[
    66         action:[
    67             coverage := CoverageReport new.
    67             coverage := CoverageReport new.
    68         ]
    68         ]
    69 
    69 
    70     "Created: / 25-06-2013 / 15:36:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    70     "Created: / 25-06-2013 / 15:36:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    71     "Modified: / 27-05-2014 / 16:54:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    72 !
       
    73 
       
    74 cmdlineOptionInstrument
       
    75 
       
    76     ^CmdLineOption new
       
    77         short: $I;
       
    78         long: 'instrument';
       
    79         description: 'extra package to instrument for coverage (implies --coverage)';
       
    80         action:[:package |
       
    81             instrument isNil ifTrue:[ 
       
    82                 instrument := Set new.
       
    83             ].
       
    84             instrument add: package.
       
    85             coverage isNil ifTrue:[ 
       
    86                 coverage := CoverageReport new.
       
    87             ].
       
    88 
       
    89         ]
       
    90 
       
    91     "Created: / 27-05-2014 / 16:34:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    71 ! !
    92 ! !
    72 
    93 
    73 !TestReport methodsFor:'initialization'!
    94 !TestReport methodsFor:'initialization'!
    74 
    95 
    75 initialize
    96 initialize
   130             suite addTest: psuite.
   151             suite addTest: psuite.
   131         ]
   152         ]
   132     ].
   153     ].
   133     coverage notNil ifTrue:[
   154     coverage notNil ifTrue:[
   134         coverage setupForPackages: packages.
   155         coverage setupForPackages: packages.
       
   156         instrument notNil ifTrue:[ 
       
   157             coverage setupForPackages: instrument.
       
   158         ].
   135     ]
   159     ]
   136 
   160 
   137     "Modified: / 25-06-2013 / 16:12:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   161     "Modified: / 27-05-2014 / 16:35:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   138 !
   162 !
   139 
   163 
   140 setupForSuite: suiteToAdd
   164 setupForSuite: suiteToAdd
   141 
   165 
   142     suite addTest: suiteToAdd.
   166     suite addTest: suiteToAdd.
   338     ].
   362     ].
   339     sel := aTestCase selectorForHDTestReport.
   363     sel := aTestCase selectorForHDTestReport.
   340     sel size > 20 ifTrue:[
   364     sel size > 20 ifTrue:[
   341         sel := '...' , (sel copyFrom: sel size - 16 to: sel size)
   365         sel := '...' , (sel copyFrom: sel size - 16 to: sel size)
   342     ].
   366     ].
       
   367     Transcript showCR:('%1 >> #%2' bindWith: aTestCase nameForHDTestReport with: aTestCase selectorForHDTestReport).
   343     Transcript show:('%-20s >> %-20s : ' printfWith: nm with: sel). 
   368     Transcript show:('%-20s >> %-20s : ' printfWith: nm with: sel). 
       
   369 
   344 
   370 
   345     outcome := self createOutcome.
   371     outcome := self createOutcome.
   346     outcome testCase: aTestCase.
   372     outcome testCase: aTestCase.
   347 
   373 
   348     doFork ifFalse:[ 
   374     doFork ifFalse:[