我正在使用maven来运行TestNG套件中的集成测试。 在eclipse下运行套件时,我的测试套件运行成功。 在运行" mvn verify"为了运行我的集成测试,我看到failafe插件配置调试打印包括suite.xml文件和我编译的类的正确路径,但它没有执行我的测试(构建过程成功完成)。
我尝试运行相同的pom配置,但使用surefire插件而不是故障安全插件,我的测试成功执行。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12.3</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/MyTestNgSuiteFile.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>-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]除外: org.codehaus.plexus:丛容器默认:罐:1.0-α-9-稳定-1 [DEBUG]除外:junit:junit:jar:3.8.1 [DEBUG]不包括: org.apache.maven:maven-core:jar:2.0.9 [DEBUG]不包括: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9 [DEBUG]
排除:org.apache.maven:maven-repository-metadata:jar:2.0.9 [DEBUG] 排除:org.apache.maven:maven-error-diagnostics:jar:2.0.9 [DEBUG]
排除:org.apache.maven:maven-plugin-descriptor:jar:2.0.9 [DEBUG]
排除:org.apache.maven:maven-monitor:jar:2.0.9 [DEBUG]排除: classworlds:classworlds:jar:1.1 [DEBUG]不包括: org.apache.maven:Maven的工具链中:jar:2.0.9 [DEBUG]配置mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test 来自插件领域 ClassRealm [插件&GT; org.apache.maven.plugins:行家故障安全-插件:2.12.3, parent:sun.misc.Launcher$AppClassLoader@121ab80] [DEBUG]配置 魔力 &#39; org.apache.maven.plugins:行家故障安全-插件:2.12.3:集成测试&#39; 使用基本配置程序 - &gt; [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 = 一次[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:行家故障安全-插件= org.apache.maven.plugins:行家故障安全-插件:行家-插件:2.12.3 :, org.apache.maven.surefire:万无一失-足球运动员= org.apache.maven.surefire:万无一失-足球运动员:罐:2.12.3:编译, org.apache.maven.surefire:万无一失-API = org.apache.maven.surefire:万无一失-API:罐:2.12.3:编译, org.apache.maven.surefire:行家-万无一失共用= org.apache.maven.surefire:行家-万无一失-共同:罐:2.12.3:编译, org.apache.commons:公地lang3 = org.apache.commons:公地lang3:罐:3.1:编译, org.apache.maven.shared:行家共用伪影滤波器= org.apache.maven.shared:行家共用伪影滤波器:罐:1.3:编译, org.codehaus.plexus:丛-utils的= org.codehaus.plexus:丛-utils的:罐:3.0.5:编译, 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-注释= org.apache.maven.plugin-工具:行家-插件的注解:罐:3.1:编译} [DEBUG](f)pluginDescriptor =组件描述符:角色: &#39; org.apache.maven.plugin.Mojo&#39;,实施: &#39; org.apache.maven.plugin.failsafe.HelpMojo&#39;,角色提示: &#39; org.apache.maven.plugins:Maven的故障保护,插件:2.12.3:帮助&#39;角色: &#39; org.apache.maven.plugin.Mojo&#39;,实施: &#39; org.apache.maven.plugin.failsafe.IntegrationTestMojo&#39;,角色提示: &#39; org.apache.maven.plugins:行家故障安全-插件:2.12.3:集成测试&#39; 角色:&#39; org.apache.maven.plugin.Mojo&#39;,实施: &#39; org.apache.maven.plugin.failsafe.VerifyMojo&#39;,角色提示: &#39; org.apache.maven.plugins:行家故障安全-插件:2.12.3:验证&#39; --- [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布局:默认快照:[enabled =&gt; false,update =&gt;每日]发布:[enabled =&gt;真正, update =&gt; 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 \测试\资源\ MyTestNgSuiteFile.xml] [DEBUG](s)summaryFile = PathToMyDir \ MyProject的\目标\故障安全的报告\故障保护,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] - 结束 配置 - [警告]尚未设置文件编码,使用 平台编码Cp1255,即构建依赖于平台! [信息] [INFO] --- maven-failsafe-plugin:2.12.3:验证(验证)@ MyProject --- [DEBUG]配置mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:验证来自 插件领域 ClassRealm [插件&GT; org.apache.maven.plugins:行家故障安全-插件:2.12.3, parent:sun.misc.Launcher$AppClassLoader@121ab80] [DEBUG]配置 mojo&#39; org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:verify&#39; 使用基本配置程序 - &gt; [DEBUG](s)basedir = PathToMyDir \ MyProject [DEBUG](s)reportsDirectory = PathToMyDir \ MyProject \ target \ failsafe-reports [DEBUG](s)skip = false [DEBUG](f)summaryFile = PathToMyDir \ MyProject的\目标\故障安全的报告\故障保护,summary.xml [DEBUG](s)testClassesDirectory = PathToMyDir \ MyProject \ target \ test-classes [DEBUG](s) testFailureIgnore = false [DEBUG] - 结束配置 - [INFO] 故障安全报告目录: PathToMyDir \ MyProject \ target \ failsafe-reports [警告]文件编码 尚未设置,使用平台编码Cp1255,即构建是 平台依赖!
它看起来像&#34;分叉命令行:cmd.exe / X / C&#34; C:\ Program Files(x86)\ Java \ jdk1.7.0_04 ......&#34 ; 命令缺失且未执行。 我将不胜感激任何帮助。
答案 0 :(得分:2)
我遇到了类似的问题,并将故障安全插件降级为2.11
为我工作。