1

I am using these two Maven Dependencies to generate Extent Report with Cucumber (I am also using TestNG in the framework for parallel testing): 1. Extentreports-cucumber4-adapter- version 1.07 and 2.Extent Reports- version 4.09

I am using the TestRunner class to execute the scenarios in the Feature file.

I do not have any classes apart from the above two dependencies to generate the Extent report.

My question is- How do I generate the Logs in the Extent report? What changes do I need to do in the TestRunner class? I do not want to add code in each and every step definition file.

Done research on the stack overflow

This is my test runner class:

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();
        }




}
Mitali S
  • 92
  • 2
  • 11
  • did you see the documentation for extent adapter - https://extentreports.com/docs/versions/4/java/testng.html – Sureshmani Kalirajan Oct 29 '19 at 21:56
  • Yes https://stackoverflow.com/users/8099744/sureshmani, i do not see any direct reference on how to get Logs (the console logs which i am getting in Eclipse) in the Extent report at the test level. – Mitali S Oct 29 '19 at 22:26

0 Answers0