reports/Builder__TestReportFormat.st
changeset 91 971a6aa7f424
parent 88 56c85ef68928
child 104 7b1b26108f1f
equal deleted inserted replaced
90:995880ed753c 91:971a6aa7f424
   106     context args keysAndValuesDo:[:idx :eachArg |
   106     context args keysAndValuesDo:[:idx :eachArg |
   107         s nextPutAll:'  '. idx printOn: s. s nextPutAll:': '. eachArg printOn: s.s cr.
   107         s nextPutAll:'  '. idx printOn: s. s nextPutAll:': '. eachArg printOn: s.s cr.
   108     ].
   108     ].
   109     s nextPutAll:'vars: '; cr.
   109     s nextPutAll:'vars: '; cr.
   110     context vars keysAndValuesDo:[:idx :eachVar |
   110     context vars keysAndValuesDo:[:idx :eachVar |
   111         s nextPutAll:'  '. idx printOn: s. s nextPutAll:': '. eachVar printOn: s.s cr.
   111         s nextPutAll:'  '. idx printOn: s. s nextPutAll:': '. 
       
   112         eachVar isString ifTrue:[
       
   113             eachVar storeOn: s.
       
   114         ] ifFalse:[
       
   115             eachVar printOn: s.
       
   116         ].
       
   117         s cr.
   112     ].
   118     ].
   113     s nextPutAll:'source: '; cr.    
   119     s nextPutAll:'source: '; cr.    
   114 
   120 
   115     [
   121     [
   116     home := context methodHome.
   122     home := context methodHome.
   151     "Created: / 03-08-2011 / 14:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   157     "Created: / 03-08-2011 / 14:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   152 !
   158 !
   153 
   159 
   154 writeStackTrace:err of:aTestCase on: str
   160 writeStackTrace:err of:aTestCase on: str
   155 
   161 
   156     |context|
   162     | context stop |
   157 
   163 
   158     context := err signalerContext.
   164     context := err signalerContext.
   159     
   165     stop := false.
   160     [ context isNil 
   166 
   161         or:[ (context receiver == aTestCase and:[ context selector == #runCase ])
   167     [ context notNil ] whileTrue:[
   162             or: [ context receiver == self and:[ context selector == #setUp ] ] ] ] whileFalse:
   168         self writeContext: context on: str.
   163                 [ self writeContext: context on: str.
   169         str cr; cr.
   164                 str cr; cr.
   170 
   165                 context := context sender ]
   171         context receiver == aTestCase ifTrue:[
       
   172             context selector == aTestCase selector ifTrue:[ ^ self ].
       
   173             context selector == #setUp ifTrue:[ ^ self ].
       
   174         ].
       
   175         context := context sender.
       
   176 
       
   177     ].
   166 
   178 
   167     "Created: / 03-08-2011 / 14:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   179     "Created: / 03-08-2011 / 14:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   168 ! !
   180 ! !
   169 
   181 
   170 !TestReportFormat::JUnit class methodsFor:'accessing'!
   182 !TestReportFormat::JUnit class methodsFor:'accessing'!
   267             nextPut:$<; nextPutAll: outcome;
   279             nextPut:$<; nextPutAll: outcome;
   268             nextPutAll:' type="';
   280             nextPutAll:' type="';
   269             nextPutAll:(self encode:type);
   281             nextPutAll:(self encode:type);
   270             nextPutAll:'" message="';
   282             nextPutAll:'" message="';
   271             nextPutAll:(self encode: message);
   283             nextPutAll:(self encode: message);
   272             nextPutAll:'"><!![CDATA['; cr;
   284             nextPutAll:'"><!![CDATA['; cr.
   273             nextPutAll:((stacktrace ? 'stacktrace not available') replaceAll: (Character codePoint:0) with: $?);
   285         stream
       
   286             nextPutAll:(stacktrace ? 'stacktrace not available').
       
   287         stream
   274             nextPutAll:']]></'; nextPutAll: outcome; nextPutAll:'>';
   288             nextPutAll:']]></'; nextPutAll: outcome; nextPutAll:'>';
   275             nextPut:Character lf
   289             nextPut:Character lf
   276     ].
   290     ].
   277     stream tab; 
   291     stream tab; 
   278             nextPutAll: '</testcase>'; cr.
   292             nextPutAll: '</testcase>'; cr.