Open happy1610 opened 5 months ago
In json file, if test doesn't have media base64 Report1.json
the merged report looks good
but if any step contains media base64, the merged report will be missing step name in html file Report1.json
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();`
In json file, if test doesn't have media base64 Report1.json
the merged report looks good
but if any step contains media base64, the merged report will be missing step name in html file Report1.json
This is my code for merging report ` File file = new File("ExtentJson"); if (!file.exists()) { file.mkdir(); } String opFolder = file.getPath();