anshooarora / extentreports-java

Community version of Extent API for Java has moved to https://github.com/extent-framework/
http://extentreports.com
Other
528 stars 318 forks source link

Issue in create new customized report - #949

Closed priyaa02 closed 7 years ago

priyaa02 commented 7 years ago

Reports.zip

Issue in creating new customized reports.

In my project, I have settings sheet which defines which type of test suite is executed like Sanity, Regression, Functional. Based on each test type, I want to generate a new report each time I execute my build.

Sample


// Sample code goes here
Example
if(testType_V.equalsIgnoreCase("Sanity"))
        {
        htmlReporter = new ExtentHtmlReporter(System.getProperty("user.dir")+"\\Report\\"+ formatter.format(date)+"_"+env_V+"_Sanity.html");

        }
        else if(testType_V.equalsIgnoreCase("Regression"))
        {
            htmlReporter = new ExtentHtmlReporter(System.getProperty("user.dir")+"\\Report\\"+formatter.format(date)+"_"+env_V+"_Regression.html");

        }
Is it possible to create new reports    on each build. ? 

## Environment Details

<!-- If you're reporting a bug, include as many relevant details about the environment you experienced the bug in -->
* Extent report Version used: 3.0.7
* Operating System and version: Windows 7
* JDK Version: 1.8

## Screenshots

<!-- If you have got some screenshots, feel free to attach with this issue. -->

<!-- And finally, kindly log ExtentX related issues on https://github.com/anshooarora/extentx/issues -->
anshooarora commented 7 years ago

Why not just assign a unique category to the test and filter upon report creation?

If you really want 3 separate reports, you can create 3 separate instances of ExtentHtmlReporter for 3 different file locations and attach all to ExtentReports.

priyaa02 commented 7 years ago

Thanks, Anshoo. I will implement creating different instances of the report and attach it to report. Also, can you help me how to implement or create customized report name based on the build or date time htmlReporter = new ExtentHtmlReporter(System.getProperty("user.dir")+"\Report\"+ formatter.format(date)+"_"+env_V+"_Sanity.html");

Actually, I want to Name the report based on the build + env+date, whereas extent report looks for the file in the location. I wanna create a new file each time.