589 nextPutAll:(' classname="%1"' bindWith:(javaPackagePrefix,testClassName)); |
589 nextPutAll:(' classname="%1"' bindWith:(javaPackagePrefix,testClassName)); |
590 nextPutAll:(' name="%1"' bindWith:test selector); |
590 nextPutAll:(' name="%1"' bindWith:test selector); |
591 nextPutAll:(' status="%1"' bindWith:testResult); |
591 nextPutAll:(' status="%1"' bindWith:testResult); |
592 nextPutAll:(' time="%1"' bindWith:executionTimeString). |
592 nextPutAll:(' time="%1"' bindWith:executionTimeString). |
593 |
593 |
594 ((testResult = TestResult statePass) |
594 ((testResult = TestResult statePass or:[testResult = TestResult stateSkip]) |
595 and:[ testOutcome collectedOutput isEmptyOrNil ]) ifTrue:[ |
595 and:[ testOutcome collectedOutput isEmptyOrNil ]) ifTrue:[ |
596 stream nextPutAll:'/>'; cr. |
596 stream nextPutAll:'/>'; cr. |
597 ] ifFalse:[ |
597 ] ifFalse:[ |
598 stream nextPutAll:'>'; cr. |
598 stream nextPutAll:'>'; cr. |
599 |
599 |
600 testResult = TestResult statePass ifFalse:[ |
600 (testResult ~= TestResult statePass |
|
601 and:[testResult ~= TestResult stateSkip]) ifTrue:[ |
601 self reportXml_jUnitResultAndTraceback:testOutcome state:testResult. |
602 self reportXml_jUnitResultAndTraceback:testOutcome state:testResult. |
602 |
603 |
603 "/ generate a link to the source file |
604 "/ generate a link to the source file |
604 testClass := Smalltalk classNamed:testClassName. |
605 testClass := Smalltalk classNamed:testClassName. |
605 testClass notNil ifTrue:[ |
606 testClass notNil ifTrue:[ |
718 "/ cpuSpeed := (sysInfo at:#cpuSpeed ifAbsent:'?'). |
720 "/ cpuSpeed := (sysInfo at:#cpuSpeed ifAbsent:'?'). |
719 |
721 |
720 timeUnit := 'ms'. |
722 timeUnit := 'ms'. |
721 timeMeasure := executionTime. |
723 timeMeasure := executionTime. |
722 |
724 |
723 stream |
725 testResult == #skipped ifTrue:[ |
724 nextPutLine:('<test name="%1" executed="yes">' bindWith: testName); |
|
725 nextPutLine:(' <description><!![CDATA[%1]]></description>' bindWith: testDescription); |
|
726 nextPutLine:' <platform>'; |
|
727 nextPutLine:' <os>'; |
|
728 nextPutLine:(' <type><!![CDATA[%1]]></type>' bindWith:osType); |
|
729 nextPutLine:(' <version><!![CDATA[%1]]></version>' bindWith:osVersion); |
|
730 nextPutLine:' </os>'; |
|
731 nextPutLine:(' <processor arch="%1" wordLength="%2">' bindWith:cpuType with:(ExternalBytes sizeofPointer * 8)); |
|
732 "/ nextPutLine:(' <frequency> unit="Mhz" cpufreq="%1" />' bindWith:cpuSpeed); |
|
733 nextPutLine:' </processor>'; |
|
734 nextPutLine:(' <compiler name="%1" version="%2" versiondate="%3" configuration="%4" />' |
|
735 bindWith:compilerName with:compilerVersion |
|
736 with:compilerVersionDate with:compilerConfiguration); |
|
737 "/ nextPutLine:' <environment />'; |
|
738 nextPutLine:' </platform>'; |
|
739 nextPutLine:' <result>'; |
|
740 nextPutLine:(' <success passed="%1" state="100" />' |
|
741 bindWith:successPassed with:successState); |
|
742 "/ cg: in the perfPublisher documentation, I found "mesure". |
|
743 "/ I am not sure, if that was a typo, or is actually what is expected... |
|
744 "/ to be on the save side, I generate both a mesure and a measure attribute, |
|
745 "/ so it will work, even if they ever fix perfPublisher's xml parser. |
|
746 nextPutLine:(' <executiontime unit="%1" mesure="%2" measure="%2" isRelevant="yes" />' |
|
747 bindWith:timeUnit with:timeMeasure). |
|
748 |
|
749 exceptionInfo notNil ifTrue:[ |
|
750 stream |
726 stream |
751 nextPutLine:' <errorlog><!![CDATA['; |
727 nextPutLine:('<test name="%1" executed="no">' bindWith: testName); |
752 nextPutAll:exceptionInfo; |
728 nextPutLine:(' <description><!![CDATA[%1]]></description>' bindWith: testDescription) |
753 nextPutLine:']]></errorlog>'. |
729 ] ifFalse:[ |
754 ]. |
730 stream |
755 stream |
731 nextPutLine:('<test name="%1" executed="yes">' bindWith: testName); |
756 nextPutLine:' </result>'. |
732 nextPutLine:(' <description><!![CDATA[%1]]></description>' bindWith: testDescription); |
757 |
733 nextPutLine:' <platform>'; |
|
734 nextPutLine:' <os>'; |
|
735 nextPutLine:(' <type><!![CDATA[%1]]></type>' bindWith:osType); |
|
736 nextPutLine:(' <version><!![CDATA[%1]]></version>' bindWith:osVersion); |
|
737 nextPutLine:' </os>'; |
|
738 nextPutLine:(' <processor arch="%1" wordLength="%2">' bindWith:cpuType with:(ExternalBytes sizeofPointer * 8)); |
|
739 "/ nextPutLine:(' <frequency> unit="Mhz" cpufreq="%1" />' bindWith:cpuSpeed); |
|
740 nextPutLine:' </processor>'; |
|
741 nextPutLine:(' <compiler name="%1" version="%2" versiondate="%3" configuration="%4" />' |
|
742 bindWith:compilerName with:compilerVersion |
|
743 with:compilerVersionDate with:compilerConfiguration); |
|
744 "/ nextPutLine:' <environment />'; |
|
745 nextPutLine:' </platform>'; |
|
746 nextPutLine:' <result>'; |
|
747 nextPutLine:(' <success passed="%1" state="100" />' |
|
748 bindWith:successPassed with:successState); |
|
749 "/ cg: in the perfPublisher documentation, I found "mesure". |
|
750 "/ I am not sure, if that was a typo, or is actually what is expected... |
|
751 "/ to be on the save side, I generate both a mesure and a measure attribute, |
|
752 "/ so it will work, even if they ever fix perfPublisher's xml parser. |
|
753 nextPutLine:(' <executiontime unit="%1" mesure="%2" measure="%2" isRelevant="yes" />' |
|
754 bindWith:timeUnit with:timeMeasure). |
|
755 |
|
756 exceptionInfo notNil ifTrue:[ |
|
757 stream |
|
758 nextPutLine:' <errorlog><!![CDATA['; |
|
759 nextPutAll:exceptionInfo; |
|
760 nextPutLine:']]></errorlog>'. |
|
761 ]. |
|
762 stream |
|
763 nextPutLine:' </result>'. |
|
764 ]. |
758 stream nextPutLine:'</test>'. |
765 stream nextPutLine:'</test>'. |
759 |
766 |
760 "Created: / 30-07-2011 / 12:19:03 / cg" |
767 "Created: / 30-07-2011 / 12:19:03 / cg" |
|
768 "Modified: / 26-03-2019 / 18:37:30 / Claus Gittinger" |
761 ! ! |
769 ! ! |
762 |
770 |
763 !TestResultReporter methodsFor:'reporting - xml-python-unit'! |
771 !TestResultReporter methodsFor:'reporting - xml-python-unit'! |
764 |
772 |
765 reportXml |
773 reportXml |
776 stream |
784 stream |
777 nextPutLine: '<?xml version="1.0"?>'; |
785 nextPutLine: '<?xml version="1.0"?>'; |
778 nextPutLine: '<unittest-results>'. |
786 nextPutLine: '<unittest-results>'. |
779 |
787 |
780 result passedOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #success]. |
788 result passedOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #success]. |
781 result skippedOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #error]. |
789 result skippedOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #skipped]. |
782 result failureOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #failure]. |
790 result failureOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #failure]. |
783 result errorOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #error]. |
791 result errorOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #error]. |
784 |
792 |
785 stream |
793 stream |
786 nextPutLine: '</unittest-results>' |
794 nextPutLine: '</unittest-results>' |
787 |
795 |
788 "Created: / 03-08-2011 / 12:56:04 / cg" |
796 "Created: / 03-08-2011 / 12:56:04 / cg" |
|
797 "Modified: / 26-03-2019 / 18:35:17 / Claus Gittinger" |
789 ! |
798 ! |
790 |
799 |
791 reportXml_pythonUnitTest:testOutcome result: testResult |
800 reportXml_pythonUnitTest:testOutcome result: testResult |
792 |
801 |
793 " |
802 " |
814 tab; nextPutAll:'ficture="'; nextPutAll: testClassName; nextPutLine:'"'; |
823 tab; nextPutAll:'ficture="'; nextPutAll: testClassName; nextPutLine:'"'; |
815 tab; nextPutAll:'name="'; nextPutAll: test selector; nextPutLine:'"'; |
824 tab; nextPutAll:'name="'; nextPutAll: test selector; nextPutLine:'"'; |
816 "It seems that some tools requires the file attributes. So we supply one :-)" |
825 "It seems that some tools requires the file attributes. So we supply one :-)" |
817 tab; nextPutAll:'file="'; nextPutAll: testClassName , '.st'; nextPutLine:'">'. |
826 tab; nextPutAll:'file="'; nextPutAll: testClassName , '.st'; nextPutLine:'">'. |
818 |
827 |
819 testResult ~= #success ifTrue:[self reportXml_pythonUnitTraceback: test]. |
828 (testResult ~= #success |
|
829 and:[testResult ~= #skipped]) ifTrue:[self reportXml_pythonUnitTraceback: test]. |
820 |
830 |
821 stream nextPutLine:'</test>'. |
831 stream nextPutLine:'</test>'. |
822 |
832 |
823 "Created: / 03-08-2011 / 12:56:37 / cg" |
833 "Created: / 03-08-2011 / 12:56:37 / cg" |
|
834 "Modified: / 26-03-2019 / 18:35:02 / Claus Gittinger" |
824 ! |
835 ! |
825 |
836 |
826 reportXml_pythonUnitTraceback: test |
837 reportXml_pythonUnitTraceback: test |
827 |
838 |
828 " |
839 " |