我正在使用maven運行我在TestNG套件中的集成測試。 在eclipse下運行套件時,我的測試套件成功運行。 運行「mvn verify」運行我的集成測試時,我看到故障安全插件配置調試打印,包括suite.xml文件和我編譯的類的正確路徑,但它不執行我的測試(成功完成構建過程) 。Maven failsafe插件不運行testNG 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 [調試]
排除:org .apache.maven:maven-monitor:jar:2.0.9 [DEBUG]排除: classworlds:classworlds:jar:1.1 [DEBUG] Excluded: org.apache.maven:maven-toolchain:jar:2.0.9 [ DEBUG]配置mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration-test from plugin realm ClassRealm [插件> org.apache.maven.plugins:maven-failsafe-plugin:2.12。 3, parent:sun.misc.Launcher$Ap[email protected]] [DEBUG]配置 mojo 'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:integration -t est' with basic configurator - > [DEBUG](s)argLine = -Xmx1024m [DEBUG] (s)basedir = PathToMyDir \ MyProject [DEBUG](s)childDelegation = false [DEBUG](s)classesDirectory = (DEBUG)(s)enableAssertions = true [DEBUG](s)forkMode = once [DEBUG](s)junitArtifactName = junit:junit [DEBUG](s)disableXmlReport = false [DEBUG] (S) localRepository = ID:本地 網址:文件:///..../.m2/repository/佈局:無[DEBUG](F)parallelMavenExecution =假[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:編譯, 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.ma ven.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 =組件描述符:role: 'org。 apache.maven.plugin.Mojo',執行: 'org.apache.maven.plugin.failsafe.HelpMojo',角色提示: '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-插件:2.12.3:integration-test' 角色:'org.apache.maven.plugin.Mojo',執行: 'org.apache.maven.plugin.failsafe.VerifyMojo',角色提示: 'org.apache .maven.plugins:Maven的故障安全(DEBUG)(s)projectArtifactMap = {這裏所有的工件} [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 = [調試](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 \ resources \ MyTestNgSuiteFile.xml] [DEBUG](s)summaryFile = PathTo MyDir \ 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 \測試\的java [DEBUG]
(S)trimStackTrace =真[DEBUG](S)useFile =真[DEBUG](S) useManifestOnlyJar =真[DEBUG](多個)useSystemClassLoader =真 [DEBUG](S)useUnlimitedThreads =假[DEBUG](S) workingDirectory = PathToMyDir \ MyProject的[DEBUG](S)項目= MavenProject:MyParentProject:MyProject的:0.0.1-SNAPSHOT @ PathToMyDir \ MyProject \ pom.xml [DEBUG](s)session = [email protected] [調試] - 結束 配置 - [警告]文件編碼尚未設置,使用 平臺編碼Cp1255,即構建依賴於平臺! [INFO] [INFO] --- maven-failsafe-plugin:2.12.3:verify(verify)@ MyProject --- [DEBUG]配置mojo org.apache.maven.plugins:maven-failsafe-plugin:2.12 0.3:從 插件境界 ClassRealm驗證[插件> org.apache.maven.plugins:行家故障安全-插件:2.12.3, 父:[email protected]] [DEBUG]配置 魔力'org.apache.maven.plugins:maven-failsafe-plugin:2.12.3:使用基本配置器驗證' - > [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] - 結束配置 - [INFO] 故障安全報告目錄: PathToMyDir \ MyProject \ target \ failsafe-reports [警告]文件編碼 尚未設置,使用平臺編碼Cp1255,即構建是依賴於平臺的 !
它看起來像「分叉的命令行:CMD.EXE/X/C 「C:\ Program Files文件(x86)的\的Java \ jdk1.7.0_04 ......」命令失蹤,沒有得到執行。 我希望得到任何幫助。
是什麼「但它不運行我的測試中」呢?錯誤信息?而且你有沒有正確地配置maven-failsafe-plugin? – khmarbaise
我看不到任何錯誤,並且我的測試沒有執行,我只是設置了failsafe-插件「驗證」目標到maven「驗證」週期。無論如何,當我明確執行「failsafe:verify」或「failsafe:integration-test」時,它也會發生 – Omri
您能否發佈完整的pom請求。 – khmarbaise