我正在使用下面的Ant目标:
<target name="test-report" depends="compile-ommittedmanage-unittest" description="Generate Test Results as HTML">
<delete dir="${deploy}\html" />
<delete dir="${deploy}\xml" />
<delete dir="${deploy}\html\release" />
<mkdir dir="${deploy}\html" />
<mkdir dir="${deploy}\html\release" />
<mkdir dir="${deploy}\xml" />
<taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator" />
<coverage>
<junit printsummary="on" haltonfailure="off" haltonerror="off" fork="yes" forkmode="once">
<batchtest fork="yes" todir="${deploy}\xml" filtertrace="on">
<fileset dir="${ommittedmanage-unittestbin}" includes="**/*Test*.class" />
</batchtest>
<formatter type="plain" usefile="false" />
<formatter type="xml" usefile="true" />
<classpath>
<path refid="ommittedManage.classpath" />
</classpath>
</junit>
</coverage>
<echo message="running JUnit Report" />
<junitreport todir="${deploy}\xml">
<fileset dir="${deploy}\xml">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${deploy}\html" />
</junitreport>
</target>
尝试生成XML和HTML报告。但即使我使用的Jenkins服务器也没有生成XML报告,但仍然运行所有测试:
test-report:
[delete] Deleting directory C:\Users\jenkins\omitted\workspace\omitted Ant\deploy\html
[delete] Deleting directory C:\Users\jenkins\omitted\workspace\omitted Ant\deploy\xml
[mkdir] Created dir: C:\Users\jenkins\omitted\workspace\omitted Ant\deploy\html
[mkdir] Created dir: C:\Users\jenkins\omitted\workspace\omitted Ant\deploy\html\release
[mkdir] Created dir: C:\Users\jenkins\omitted\workspace\omitted Ant\deploy\xml
[coverage] Enhancing junit with coverage
[junit] WARNING: multiple versions of ant detected in path for junit
[junit] jar:file:/C:/Users/jenkins/jenkins-dependencies/apache-ant-1.9.4-bin/apache-ant-1.9.4/lib/ant.jar!/org/apache/tools/ant/Project.class
[junit] and jar:file:/C:/Users/jenkins/omitted/workspace/omitted%20Ant/deploy/classpath/ant.jar!/org/apache/tools/ant/Project.class
[junit] Running JUnitplayground.ParameterizedTest
[junit] Testsuite: JUnitplayground.ParameterizedTest
[junit] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,64 sec
[junit] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,64 sec
[junit] ------------- Standard Output ---------------
[junit] Addition with parameters : 1 and 2
[junit] Addition with parameters : 2 and 3
[junit] Addition with parameters : 3 and 4
[junit] Addition with parameters : 4 and 5
[junit] ------------- ---------------- ---------------
[junit]
[junit] Testcase: sumTest[0] took 0,015 sec
[junit] Testcase: sumTest[1] took 0 sec
[junit] Testcase: sumTest[2] took 0 sec
[junit] Testcase: sumTest[3] took 0 sec
[junit] Running com.omitted.coruscant.util.DateUtilUnitTest
[junit] Testsuite: com.omitted.coruscant.util.DateUtilUnitTest
[junit] Tests run: 43, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,188 sec
[junit] Tests run: 43, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,188 sec
[junit]
[junit] Testcase: testGetNextDay took 0 sec
[junit] Testcase: testIsSameInstant took 0 sec
[junit] Testcase: testGetFirstDayOfWeek took 0 sec
[junit] Testcase: testFormatUserDateTime took 0 sec
[junit] Testcase: testEndOfDay took 0 sec
[junit] Testcase: testDateTime took 0 sec
[junit] Testcase: testDifferenceHours took 0 sec
[junit] Testcase: testDifferenceMonth took 0 sec
[junit] Testcase: testMaxDateIfNullDate1 took 0 sec
[junit] Testcase: testOverlap took 0,094 sec
[junit] Testcase: testDay took 0 sec
[junit] Testcase: testGetCalendarFromDate took 0 sec
[junit] Testcase: testToday took 0 sec
[junit] Testcase: testGetDatePart took 0 sec
[junit] Testcase: testGetNextDayOrMidnight took 0 sec
[junit] Testcase: testLatestDate took 0 sec
[junit] Testcase: testBuildDate took 0 sec
[junit] Testcase: testIsForever took 0 sec
[junit] Testcase: testAddMonth took 0 sec
[junit] Testcase: testGetDayOfWeekIndex took 0 sec
[junit] Testcase: testFormatDate took 0 sec
[junit] Testcase: testIsOlderThanDays took 0 sec
[junit] Testcase: testDifferenceDays took 0 sec
[junit] Testcase: testCreateMonthEndingDatesBetween took 0 sec
[junit] Testcase: testDayOfWeek took 0 sec
[junit] Testcase: testIsBeforeOrSameDay took 0 sec
[junit] Testcase: testParseISODate took 0 sec
[junit] Testcase: testParseISOTime took 0 sec
[junit] Testcase: testCreateDayDatesBetween took 0 sec
[junit] Testcase: testParseISODateTime took 0,016 sec
[junit] Testcase: testIsOlderThanHours took 0 sec
[junit] Testcase: testIsLastDayOfMonth took 0 sec
[junit] Testcase: testNullIfmaxDate took 0 sec
[junit] Testcase: testToSqlTimestamp took 0 sec
[junit] Testcase: testGetOverlappingHours took 0 sec
[junit] Testcase: testEarliestDate took 0 sec
[junit] Testcase: testToSqlDate took 0 sec
[junit] Testcase: testMaxDateIfNullDate took 0 sec
[junit] Testcase: testCreatePeriodBreak took 0 sec
[junit] Testcase: testIsFirstDayOfMonth took 0 sec
[junit] Testcase: testGetHolidayYear took 0 sec
[junit] Testcase: testStartOfDay took 0 sec
[junit] Testcase: testLastDayOfMonth took 0 sec
[junit] Running com.omitted.manage.bl.AdressUtilUnitTest
[junit] Testsuite: com.omitted.manage.bl.AdressUtilUnitTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,015 sec
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,015 sec
[junit]
[junit] Testcase: testSynchAddressWithNullArguments took 0 sec
[junit] Running com.omitted.util.calc.FITest
[junit] Testsuite: com.omitted.util.calc.FITest
[junit] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,031 sec
[junit] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,031 sec
[junit]
[junit] Testcase: testEAN took 0 sec
[junit] Testcase: test took 0,015 sec
[junit] Running com.omitted.util.calc.IntrestTest
[junit] Testsuite: com.omitted.util.calc.IntrestTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,015 sec
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,015 sec
[junit]
[junit] Testcase: calulateInterestFeeByMonthTest took 0,015 sec
[junit] Running com.omitted.util.calc.JUnitEANValidationTest
[junit] Testsuite: com.omitted.util.calc.JUnitEANValidationTest
[junit] Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,047 sec
[junit] Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,047 sec
[junit] ------------- Standard Output ---------------
[junit] Checking validity of EAN Checksum: 5798009932600
[junit] Checking validity of EAN Checksum: 5798000428614
[junit] Checking validity of EAN Checksum: 5798000428256
[junit] Checking validity of EAN Checksum: 5798000428620
[junit] Checking validity of EAN Checksum: 5798000428621
[junit] Checking validity of EAN Checksum: 5798000428622
[junit] Checking validity of EAN Checksum: 5798000428623
[junit] Checking validity of EAN Checksum: 5798000428624
[junit] Checking validity of EAN Checksum: 5798000428625
[junit] Checking validity of EAN Checksum: 5798000428626
[junit] Checking validity of EAN Checksum: 5798000428627
[junit] Checking validity of EAN Checksum: 5798000428628
[junit] Checking validity of EAN Checksum: 5798000428629
[junit] Checking validity of EAN Checksum: 5798000428601
[junit] Checking validity of EAN Checksum: 4012195172451
[junit] Checking validity of EAN Checksum: 57980004286
[junit] EAN number must be 13 digits
[junit] Checking validity of EAN Checksum: 5798000428629123
[junit] EAN number must be 13 digits
[junit] ------------- ---------------- ---------------
[junit]
[junit] Testcase: testValidationOfFICheckCipher[0] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[1] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[2] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[3] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[4] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[5] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[6] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[7] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[8] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[9] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[10] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[11] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[12] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[13] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[14] took 0 sec
[junit] Testcase: testValidationOfFICheckCipher[15] took 0,016 sec
[junit] Testcase: testValidationOfFICheckCipher[16] took 0 sec
[junit] Running com.omitted.util.calc.JUnitFICheckCipherTest
[junit] Testsuite: com.omitted.util.calc.JUnitFICheckCipherTest
[junit] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,016 sec
[junit] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,016 sec
[junit] ------------- Standard Output ---------------
[junit] Checking Cipher: 2684014996532
[junit] Checking Cipher: 660405152
[junit] Checking Cipher: 33259336900139
[junit] ------------- ---------------- ---------------
[junit]
[junit] Testcase: testCalculationOfFICheckCipher[0] took 0 sec
[junit] Testcase: testCalculationOfFICheckCipher[1] took 0 sec
[junit] Testcase: testCalculationOfFICheckCipher[2] took 0 sec
[echo] running JUnit Report
[junitreport] Processing C:\Users\jenkins\omitted\workspace\omitted Ant\deploy\xml\TESTS-TestSuites.xml to C:\Windows\TEMP\null28497120
[junitreport] Loading stylesheet jar:file:/C:/Users/jenkins/jenkins-dependencies/apache-ant-1.9.4-bin/apache-ant-1.9.4/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 1328ms
[junitreport] Deleting: C:\Windows\TEMP\null28497120
因此,由于没有生成XML,我打赌这就是为什么生成空HTML报告的原因。我得到{deploy}\html\finish
文件夹的原因是因为负责发布HTML报告的插件将文件复制到新位置。
如何正确生成XML报告?
我对蚂蚁和jenkins的使用都是新手,所以请原谅我的noob错误。