亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Java/黃瓜報告不使用 masterthought 生成報告

Java/黃瓜報告不使用 masterthought 生成報告

米脂 2022-06-30 10:46:30
我一直在嘗試整合 masterthought maven--cucumber-reporting,這樣我就可以像宣傳的那樣制作關于 Jenkins 的漂亮報告。我遵循了各個站點中的配置說明,包括 damienfremont.com 帖子,但我的實施沒有產生任何報告。StackOverflow 上的類似帖子沒有提供答案。CucumberTestRunner.java@RunWith(Cucumber.class)@CucumberOptions(  glue = "xxx.yyy.zzz.cucumber",  features = "src/test/resources/features",  snippets = SnippetType.CAMELCASE,  tags = {"@aaa", "@bbb"},  plugin = {"json:target/cucumber.json", "html:target/site/cucumber-pretty"}  )public class CucumberTestRunner {}pom.xml  <dependency>    <groupId>io.cucumber</groupId>    <artifactId>cucumber-java</artifactId>    <version>4.2.0</version>  </dependency>  <dependency>    <groupId>io.cucumber</groupId>    <artifactId>cucumber-junit</artifactId>    <version>4.2.0</version>  </dependency>  <dependency>    <groupId>net.masterthought</groupId>    <artifactId>cucumber-reporting</artifactId>    <version>4.4.0</version>  </dependency>  Other dependencies - Spring, database, logging, etc<dependencies><build>  <plugins>    <plugin>      <groupId>org.apache.maven.plugins</groupId>      <artifactId>maven-compiler-plugin</artifactId>      <version>3.7.0</version>      <configuration>        <source>1.8</source>        <target>1.8</target>      </configuration>    </plugin>    <plugin>      <groupId>org.codehaus.mojo</groupId>      <artifactId>exec-maven-plugin</artifactId>      <version>1.5.0</version>            <executions>        <execution>          <phase>integration-test</phase>          <goals>結果:從 intelliJ 運行 CucumberTestRunner.java 會創建 target/cucumber.json 和 target/site/cucumber-pretty/index.html 等運行mvn verify -Dcucumber.options="--tags @aaa --tags @bbb"創建target/cucumber.html/index.html等(在 pom 中指定)因此,正在生成本機的萬無一失的報告,但我沒有得到 masterthought 的輸出。當我mvn build通過 Jenkins運行并cucumber-reports.hfi安裝插件時,我得到"net.masterthought.cucumber.ValidationException: Nonereport了文件已添加!”這是有道理的,因為 mvn 作業沒有生成報告。密碼我查看了其他 StackOverflow 問題,但看不出我的代碼有什么問題。非常感謝任何幫助。
查看完整描述

2 回答

?
楊魅力

TA貢獻1811條經驗 獲得超6個贊

我也遇到了同樣的錯誤。然后我使用下面的代碼而不是使用pom.xml net.masterthought插件。它工作并生成了報告。但是,我使用的是 TestNG。因此,您必須檢查它是否適用于使用@After Annotation.


    @AfterSuite

    public void generateReport() {

    File reportOutputDirectory = new File("target"); //

    List<String> jsonFiles = new ArrayList<String>();

    jsonFiles.add("target/cucumber.json");

    String projectName = "Your Sample Project Name";

    String buildNumber = "1.0";


    Configuration configuration = new Configuration(reportOutputDirectory, 

    projectName);


    configuration.setRunWithJenkins(true);

    configuration.setBuildNumber(buildNumber);


    ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);

    reportBuilder.generateReports();

}


查看完整回答
反對 回復 2022-06-30
?
慕虎7371278

TA貢獻1802條經驗 獲得超4個贊

問題排序:在pom.xml, 中exec-maven-plugin,我需要插件參數json:${project.build.directory}/somewhere/for/reports

蓬松的 Jenkins 報告需要 json 文件。還需要確保 Jenkins Cucumber 報告配置中指定的目錄與 pom.xml 文件中指定的目錄一致。

不需要net.masterthought plugin.


查看完整回答
反對 回復 2022-06-30
  • 2 回答
  • 0 關注
  • 177 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號