我有两个 TEST-*.xml 文件是由并行运行的分叉测试生成的——这是两个 junit 测试类。出于某种奇怪的原因,surefire 将这两个文件合并为一份报告。此报告还缺少一些信息,例如包名称和类信息。
以下是 TEST-*.xml 的示例:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite failures="0" time="0.002" errors="0" skipped="0" tests="12" name="com.fidelity.mobile.core.RunCukesTest2">
<properties>
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment" />
<property name="sun.boot.library.path" value="C:\Program Files\Java\jdk1.7.0_03\jre\bin" />
<property name="java.vm.version" value="22.1-b02" />
<property name="java.vm.vendor" value="Oracle Corporation" />
<property name="java.vendor.url" value="http://java.oracle.com/" />
<property name="path.separator" value=";" />
<property name="guice.disable.misplaced.annotation.check" value="true" />
<property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM" />
<property name="file.encoding.pkg" value="sun.io" />
<property name="user.script" value="" />
<property name="user.country" value="US" />
<property name="sun.java.launcher" value="SUN_STANDARD" />
<property name="sun.os.patch.level" value="Service Pack 1" />
<property name="java.vm.specification.name" value="Java Virtual Machine Specification" />
<property name="user.dir" value="C:\Workspaces\Fidelity\mobileTests" />
<property name="java.runtime.version" value="1.7.0_03-b05" />
<property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment" />
<property name="java.endorsed.dirs" value="C:\Program Files\Java\jdk1.7.0_03\jre\lib\endorsed" />
<property name="os.arch" value="amd64" />
<property name="java.io.tmpdir" value="C:\Users\pguindon\AppData\Local\Temp\" />
<property name="line.separator" value=" " />
<property name="java.vm.specification.vendor" value="Oracle Corporation" />
<property name="user.variant" value="" />
<property name="os.name" value="Windows 7" />
<property name="classworlds.conf" value="C:\Workspaces\Fidelity\.metadata\.plugins\org.eclipse.m2e.core\launches\m2conf8811353436624661573.tmp" />
<property name="sun.jnu.encoding" value="Cp1252" />
<property name="java.library.path" value="C:\Program Files\Java\jdk1.7.0_03\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\;C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\Best Practices Analyzer\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;c:\Python32;c:\Python32\Scripts;c:\selenium-2.24.0\;C:\Program Files\Java\jdk1.7.0_03;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;C:\Users\pguindon\android-sdks;C:\Users\pguindon\android-sdks\platform-tools;C:\Users\pguindon\android-sdks\tools;C:\Program Files (x86)\Sikuli X\libs;C:\Program Files (x86)\Java\jre6\\bin;." />
<property name="java.specification.name" value="Java Platform API Specification" />
<property name="java.class.version" value="51.0" />
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers" />
<property name="os.version" value="6.1" />
<property name="user.home" value="C:\Users\pguindon" />
<property name="user.timezone" value="America/New_York" />
<property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob" />
<property name="java.specification.version" value="1.7" />
<property name="file.encoding" value="Cp1252" />
<property name="user.name" value="pguindon" />
<property name="java.class.path" value="/C:/Eclipse_Juno/plugins/org.eclipse.m2e.maven.runtime_1.1.0.20120529-1956/jars/plexus-classworlds-2.4.jar" />
<property name="java.vm.specification.version" value="1.7" />
<property name="sun.arch.data.model" value="64" />
<property name="java.home" value="C:\Program Files\Java\jdk1.7.0_03\jre" />
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher -B clean test -Pparallel site" />
<property name="java.specification.vendor" value="Oracle Corporation" />
<property name="user.language" value="en" />
<property name="awt.toolkit" value="sun.awt.windows.WToolkit" />
<property name="java.vm.info" value="mixed mode" />
<property name="java.version" value="1.7.0_03" />
<property name="java.ext.dirs" value="C:\Program Files\Java\jdk1.7.0_03\jre\lib\ext;C:\Windows\Sun\Java\lib\ext" />
<property name="sun.boot.class.path" value="C:\Program Files\Java\jdk1.7.0_03\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0_03\jre\lib\rt.jar;C:\Program Files\Java\jdk1.7.0_03\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.7.0_03\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.7.0_03\jre\lib\jce.jar;C:\Program Files\Java\jdk1.7.0_03\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.7.0_03\jre\classes" />
<property name="java.vendor" value="Oracle Corporation" />
<property name="maven.home" value="C:\Workspaces\Fidelity\mobileTests\EMBEDDED" />
<property name="file.separator" value="\" />
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/" />
<property name="sun.cpu.endian" value="little" />
<property name="sun.io.unicode.encoding" value="UnicodeLittle" />
<property name="sun.desktop" value="windows" />
<property name="sun.cpu.isalist" value="amd64" />
</properties>
<testcase time="0.002" classname="Given I am on Google " name="Given I am on Google " />
<testcase time="0" classname="When I search for "Orange" " name="When I search for "Orange" " />
<testcase time="0" classname="Then I should see "Wikipedia, the free encyclopedia" in the search results " name="Then I should see "Wikipedia, the free encyclopedia" in the search results " />
<testcase time="0" classname="| "Orange" | "Wikipedia, the free encyclopedia" | " name="| "Orange" | "Wikipedia, the free encyclopedia" | " />
<testcase time="0" classname="Given I am on Google " name="Given I am on Google " />
<testcase time="0" classname="When I search for "Banana" " name="When I search for "Banana" " />
<testcase time="0" classname="Then I should see "Wikipedia, the free encyclopedia" in the search results " name="Then I should see "Wikipedia, the free encyclopedia" in the search results " />
<testcase time="0" classname="| "Banana" | "Wikipedia, the free encyclopedia" | " name="| "Banana" | "Wikipedia, the free encyclopedia" | " />
<testcase time="0" classname="Given I am on Google Maps " name="Given I am on Google Maps " />
<testcase time="0" classname="When I search for "North Pole" " name="When I search for "North Pole" " />
<testcase time="0" classname="Then I should see "North Pole" in the search results " name="Then I should see "North Pole" in the search results " />
<testcase time="0" classname="| "North Pole" | "North Pole" | " name="| "North Pole" | "North Pole" | " />
这是我的pom配置:
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<includes>
<include>**/Run*.java</include>
</includes>
<threadCount>${junit.threadCount}</threadCount>
<forkMode>perthread</forkMode>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.12.4</version>
</plugin>
</plugins>
</reporting>