关于集成测试:Maven failsafe插件不运行testNG XML套件

Maven failsafe plugin does not run testNG XML suite

我正在使用maven来运行TestNG套件中的集成测试。
在eclipse下运行套件时,我的测试套件运行成功。
运行"mvn verify"运行我的集成测试时,我看到failafe插件配置调试打印包括suite.xml文件和我编译的类的正确路径,但它不执行我的测试(构建过程成功完成)。

我试图运行相同的pom配置,但使用surefire插件而不是故障安全插件,我的测试成功执行。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
        <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                maven-failsafe-plugin</artifactId>
                <version>2.12.3</version>
                <configuration>
                    <suiteXmlFiles>
                    <suiteXmlFile>src/test/resources/MyTestNgSuiteFile.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    -Xmx1024m</argLine>
                </configuration>
                    <executions>
          <execution>
            <id>integration-test</id>
            <phase>integration-test</phase>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
          <execution>
            <id>verify</id>
            <phase>verify</phase>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>

            </plugin>

这是相关的控制台输出:

[DEBUG] Excluded:
org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[DEBUG] Excluded: junit:junit:jar:3.8.1 [DEBUG] Excluded:
org.apache.maven:maven-core:jar:2.0.9 [DEBUG] Excluded:
org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9 [DEBUG]
Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.9 [DEBUG]
Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.9 [DEBUG]
Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.9 [DEBUG]
Excluded: org.apache.maven:maven-monitor:jar:2.0.9 [DEBUG] Excluded:
classworlds:classworlds:jar:1.1 [DEBUG] Excluded:
org.apache.maven:maven-toolchain:jar:2.0.9
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test
from plugin realm
ClassRealm[plugin>org.apache.maven.plugins:maven-failsafe-plugin:2.12.3,
parent: sun.misc.Launcher$AppClassLoader@121ab80] [DEBUG] Configuring
mojo
'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test'
with basic configurator -->
[DEBUG] (s) argLine = -Xmx1024m [DEBUG]
(s) basedir = PathToMyDir\MyProject [DEBUG] (s) childDelegation =
false [DEBUG] (s) classesDirectory =
PathToMyDir\MyProject\target\classes [DEBUG] (s) disableXmlReport =
false [DEBUG] (s) enableAssertions = true [DEBUG] (s) forkMode =
once [DEBUG] (s) junitArtifactName = junit:junit [DEBUG] (s)
localRepository = id: local
url: file:///..../.m2/repository/ layout: none

[DEBUG] (f) parallelMavenExecution = false [DEBUG] (s)
perCoreThreadCount = true [DEBUG] (s) pluginArtifactMap =
{org.apache.maven.plugins:maven-failsafe-plugin=org.apache.maven.plugins:maven-failsafe-plugin:maven-plugin:2.12.3:,
org.apache.maven.surefire:surefire-booter=org.apache.maven.surefire:surefire-booter:jar:2.12.3:compile,
org.apache.maven.surefire:surefire-api=org.apache.maven.surefire:surefire-api:jar:2.12.3:compile,
org.apache.maven.surefire:maven-surefire-common=org.apache.maven.surefire:maven-surefire-common:jar:2.12.3:compile,
org.apache.commons:commons-lang3=org.apache.commons:commons-lang3:jar:3.1:compile,
org.apache.maven.shared:maven-common-artifact-filters=org.apache.maven.shared:maven-common-artifact-filters:jar:1.3:compile,
org.codehaus.plexus:plexus-utils=org.codehaus.plexus:plexus-utils:jar:3.0.5:compile,
org.apache.maven.reporting:maven-reporting-api=org.apache.maven.reporting:maven-reporting-api:jar:2.0.9:compile, org.apache.maven.plugin-tools:maven-plugin-annotations=org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.1:compile}
[DEBUG] (f) pluginDescriptor = Component Descriptor: role:
'org.apache.maven.plugin.Mojo', implementation:
'org.apache.maven.plugin.failsafe.HelpMojo', role hint:
'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:help' role:
'org.apache.maven.plugin.Mojo', implementation:
'org.apache.maven.plugin.failsafe.IntegrationTestMojo', role hint:
'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test'
role: 'org.apache.maven.plugin.Mojo', implementation:
'org.apache.maven.plugin.failsafe.VerifyMojo', role hint:
'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:verify'
--- [DEBUG] (s) printSummary = true [DEBUG] (s) projectArtifactMap = {All Artifacts Here} [DEBUG] (s) redirectTestOutputToFile = false [DEBUG] (s) remoteRepositories = [ id: central
url: http://repo1.maven.org/maven2 layout: default snapshots: [enabled => false, update => daily] releases: [enabled => true,
update => never] ] [DEBUG] (s) reportFormat = brief [DEBUG] (s)
reportsDirectory = PathToMyDir\MyProject\target\failsafe-reports
[DEBUG] (s) runOrder = filesystem [DEBUG] (s) skip = false [DEBUG]
(s) skipTests = false [DEBUG] (s) suiteXmlFiles =
[PathToMyDir\MyProject\src\test
esources\MyTestNgSuiteFile.xml]
[DEBUG] (s) summaryFile =
PathToMyDir\MyProject\target\failsafe-reports\failsafe-summary.xml
[DEBUG] (s) testClassesDirectory =
PathToMyDir\MyProject\target\test-classes [DEBUG] (s)
testNGArtifactName = org.testng:testng [DEBUG] (s)
testSourceDirectory = PathToMyDir\MyProject\src\test\java [DEBUG]
(s) trimStackTrace = true [DEBUG] (s) useFile = true [DEBUG] (s)
useManifestOnlyJar = true [DEBUG] (s) useSystemClassLoader = true
[DEBUG] (s) useUnlimitedThreads = false [DEBUG] (s)
workingDirectory = PathToMyDir\MyProject [DEBUG] (s) project =
MavenProject: MyParentProject:MyProject:0.0.1-SNAPSHOT @
PathToMyDir\MyProject\pom.xml [DEBUG] (s) session =
org.apache.maven.execution.MavenSession@bffe59 [DEBUG] -- end
configuration -- [WARNING] File encoding has not been set, using
platform encoding Cp1255, i.e. build is platform dependent! [INFO]
[INFO] --- maven-failsafe-plugin:2.12.3:verify (verify) @ MyProject
--- [DEBUG] Configuring mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:verify from
plugin realm
ClassRealm[plugin>org.apache.maven.plugins:maven-failsafe-plugin:2.12.3,
parent: sun.misc.Launcher$AppClassLoader@121ab80] [DEBUG] Configuring
mojo 'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:verify'
with basic configurator --> [DEBUG] (s) basedir =
PathToMyDir\MyProject [DEBUG] (s) reportsDirectory =
PathToMyDir\MyProject\target\failsafe-reports [DEBUG] (s) skip =
false [DEBUG] (f) summaryFile =
PathToMyDir\MyProject\target\failsafe-reports\failsafe-summary.xml
[DEBUG] (s) testClassesDirectory =
PathToMyDir\MyProject\target\test-classes [DEBUG] (s)
testFailureIgnore = false [DEBUG] -- end configuration -- [INFO]
Failsafe report directory:
PathToMyDir\MyProject\target\failsafe-reports [WARNING] File encoding
has not been set, using platform encoding Cp1255, i.e. build is
platform dependent!

看起来像"分叉命令行:cmd.exe / X / C"C: Program Files(x86) Java jdk1.7.0_04 ..."命令缺失且未执行。
我将不胜感激任何帮助。


我有一个类似的问题,并将故障安全插件降级为2.11为我工作。