Search code examples
automationcucumberbdd

How to pass random variable in runner class, for html report path?


I'm trying to pass the random variable in cucumber runner class, But as this code is out of the method (Top of the method) script is not allowed to concatenate the date or any random values for the output report path.

enter image description here


Solution

  • You can also configure the report location by using ExtentProperties enum as follows. Leave the plugin configuration empty, and configure the report location in your @BeforeClass method:

    plugin = {"com.cucumber.listener.ExtentCucumberFormatter:"}
    ……
    ……
    @BeforeClass
    public static void setup() {
    ExtentProperties extentProperties = ExtentProperties.INSTANCE;
    extentProperties.setReportPath("output/myreport.html");
    }
    

    See documentation here - http://www.vimalselvam.com/cucumber-extent-reporter/