我曾在以前的項目這方面的工作,但現在不能找到它...正確的Maven POM配置Maven的黃瓜報告
我使用Maven構建一個Java應用程序,我運行測試在構建過程中的應用程序。我正在使用maven-cucumber-reporting plugin v3.0.0來彙總結果報告。
我想:
- 運行黃瓜測試
- 生成報告(黃瓜測試是否不會失敗)
- 如果失敗生成報告後失敗構建
我怎樣才能設置我的POM的組合maven-surefire-plugin,maven-cucumber-reporting plu杜松子酒,和其他插件,使這項工作?
更新1:
這是我目前的POM的配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>${cucumber.reporting.version}</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>${project.artifactId}</projectName>
<outputDirectory>${project.basedir}/src/test/report/cucumber-reports</outputDirectory>
<cucumberOutput>${project.basedir}/src/test/report/cucumber.json</cucumberOutput>
<skippedFails>true</skippedFails>
<enableFlashCharts>false</enableFlashCharts>
<buildNumber>${project.version}</buildNumber>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<inherited>false</inherited>
<executions>
<execution>
<id>copy-file</id>
<phase>test</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.basedir}/src/test/report/cucumber.json</sourceFile>
<destinationFile>${project.parent.basedir}/src/test/report/cucumber-${project.artifactId}-${project.version}.json</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
我怎樣才能黃瓜測試期間maven-surefire-plugin
運行,不運行產生前maven-cucumber-reporting
和copy-rename-maven-plugin
插件失敗我的報告,並把它們放在正確的地方(多模塊pom我在父母彙總測試),然後失敗的構建?
當前條件1和2通過(我的Cucumber測試運行,失敗,然後生成報告,但構建不會失敗)。
也許更一般地說,如何將測試作爲maven構建的一部分運行,然後執行一些報告插件,然後在報告插件運行後失敗構建?
我創建黃瓜JSON報告,這是我想要的,然後使用Maven的黃瓜報告插件生成更廣泛HTML報告。我會更多地從我的pom更新這個問題,使其更清晰。 – wrslatz