[使用Cucumber-TestNG适配器时如何在Extent Report- Cucumber-TestNG框架中生成日志

问题描述 投票:1回答:1

我正在使用这两个Maven依赖项来生成Cucumber的范围报告(我也在框架中使用TestNG进行并行测试):1. Extentreports-cucumber4-adapter-版本1.07和2.Extent Reports-版本4.09

我正在使用TestRunner类来执行功能文件中的方案。

除了上述两个依赖项之外,我没有任何类来生成范围报告。

我的问题是-如何在“范围”报告中生成日志?我需要在TestRunner类中进行哪些更改?我不想在每个步骤定义文件中添加代码。

对堆栈溢出进行的研究

这是我的测试跑步者课程:

import org.junit.runner.RunWith;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.DataProvider;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;

//import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import cucumber.api.testng.TestNGCucumberRunner;
import io.cucumber.testng.AbstractTestNGCucumberTests;

@RunWith(Cucumber.class)
@CucumberOptions(

        features="src/test/resources/features/APIPortingGET.feature" ,
        glue= {"stepDefinition"}, //step definition file
        plugin = {"pretty", "html:test-output", "json:target/cucumber-json-report.json", "junit:junit_xml/cucumber.xml", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:test-output/HtmlReport/SOAReport.html"},
        monochrome = true,//displays the console output in a readable format
        dryRun = false//to check mapping is proper between feature and step def file
        //strict = true // will fail the test if there are undefined steps in the step def file or the mapping between the feature file and step def file is wrong
        //tags= {"@debug"}
        )


public class TestRunner extends AbstractTestNGCucumberTests {

    private static TestNGCucumberRunner testNGCucumberRunner;
    ExtentTest test;
    ExtentReports extent;   
        @Override
        @DataProvider(parallel=true)
        public Object[][] scenarios() {
          return super.scenarios();
        }




}
cucumber testng extent
1个回答
0
投票
将使用以下代码生成大量报告,但我不知道如何保存每个步骤的日志
© www.soinside.com 2019 - 2024. All rights reserved.