Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing step name after merge reports #431

Open
happy1610 opened this issue Mar 12, 2024 · 0 comments
Open

Missing step name after merge reports #431

happy1610 opened this issue Mar 12, 2024 · 0 comments

Comments

@happy1610
Copy link

In json file, if test doesn't have media base64
Report1.json

the merged report looks good
Screenshot 2024-03-12 211355

but if any step contains media base64, the merged report will be missing step name in html file
Report1.json

Screenshot 2024-03-12 210643

This is my code for merging report
` File file = new File("ExtentJson");
if (!file.exists()) {
file.mkdir();
}
String opFolder = file.getPath();

    String path =  "\\src\\test\\java\\com\\";
    String jsonPath =  path + "JsonPath\\";
    //Creating individual Report Number 1
    ExtentSparkReporter spark = new ExtentSparkReporter(path + "Report1.html");
    JsonFormatter json = new JsonFormatter(jsonPath + "Report1.json");
    ExtentReports extent = new ExtentReports();
    extent.createTest("test1").assignCategory("cat").pass("Step 1 from test 1")
            .pass("step 2 from test 1");
    extent.attachReporter(json, spark);
    extent.flush();

    //Creating individual Report Number 2
    ExtentSparkReporter spark2 = new ExtentSparkReporter(path + "Report2.html");
    JsonFormatter json2 = new JsonFormatter(jsonPath + "Report2.json");
    ExtentReports extent2 = new ExtentReports();
    extent2.createTest("test2").assignCategory("cat").pass("Step 1 from test 2")
            .fail("step 2 from test 2");
    extent2.attachReporter(json2, spark2);
    extent2.flush();

    ExtentSparkReporter mergedSpark = new ExtentSparkReporter(path + "spark.html");
    ExtentReports extentMerged = new ExtentReports();

    //Replace below logic to get all the .json files generated by extent in opFolder
    File jsonOPDirectory = new File(jsonPath);
    if (jsonOPDirectory.exists()) {
        Arrays.stream(jsonOPDirectory.listFiles()).forEach(jsonFile -> {

            try {
                extentMerged.createDomainFromJsonArchive(jsonFile.getPath());
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
    }

    extentMerged.attachReporter(mergedSpark);
    extentMerged.flush();`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant