3

我正在使用 maven 运行我在 TestNG 套件中的集成测试。在eclipse下运行套件时-我的测试套件运行成功。当运行“mvn verify”来运行我的集成测试时,我看到故障安全插件配置调试打印,包括 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:plexus-container-default:jar:1.0-alpha-9-stable-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 [调试]
排除:org.apache.maven:maven-monitor:jar:2.0.9 [DEBUG] 排除:classworlds:classworlds:jar:1.1 [DEBUG] 排除:org.apache.maven:maven-toolchain:jar:2.0.9 [调试] 配置 mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test 从插件领域 ClassRealm[plugin>org.apache.maven.plugins:maven-failsafe-plugin:2.12.3,父:sun.misc.Launcher$AppClassLoader@121ab80] [DEBUG] 使用基本配置器配置 mojo 'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test' -->[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/ 布局:无

[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:编译,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' ,实现:'org.apache.maven.plugin.failsafe.HelpMojo',角色提示:'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:help' 角色:'org.apache.maven. plugin.Mojo',实现:'org.apache.maven.plugin.failsafe.IntegrationTestMojo',角色提示:'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test' 角色:' org.apache.maven.plugin.Mojo',实现:'org.apache.maven.plugin.failsafe.VerifyMojo',角色提示:'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 布局:默认快照:[启用 => 假,更新 => 每日] 发布:[启用 => 真,更新 => 从不]] [调试] (s) 报告格式 = 简短[DEBUG] (s) reportsDirectory = PathToMyDir\MyProject\target\failsafe-reports [DEBUG] (s) runOrder = 文件系统 [DEBUG] (s) skip = false [DEBUG] (s) skipTests = false [DEBUG] (s) suiteXmlFiles = [PathToMyDir\MyProject\src\test\resources\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] -- 结束配置 -- [WARNING] 文件编码尚未设置,使用平台编码Cp1255,即构建依赖于平台![INFO] [INFO] --- maven-failsafe-plugin:2.12.3:verify (verify) @MyProject --- [DEBUG] 配置 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] 配置 mojo 'org.apache.maven .plugins:maven-failsafe-plugin:2.12.3:verify' 带有基本配置器 -->

看起来“分叉命令行:cmd.exe /X /C”C:\

4

1 回答 1

2

我遇到了类似的问题并降级了故障安全插件以2.11对我有用。

于 2012-09-28T02:03:24.827 回答