extent-framework / extentreports-java

Extent Reporting Library, Java
http://extentreports.com
Apache License 2.0
226 stars 127 forks source link

Unable to Attach Text With Json? #245

Open awang101 opened 4 years ago

awang101 commented 4 years ago
        String reportPath = ("./reports/result.html");
        sparkReporter = new ExtentSparkReporter(reportPath);
        sparkReporter.config().setDocumentTitle("NBC_DesktopWeb_Automation");
        sparkReporter.config().setTimeStampFormat("EEEE, MMMM dd, yyyy, hh:mm a '('zzz')'");
    extent = new ExtentReports();

        JsonFormatter json = new JsonFormatter("target/test.json");

        try {
            extent.createDomainFromJsonArchive("target/test.json");
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        extent.attachReporter(json);

image (Original Attachment)

Additional Attachments

image

As you can see the text is not being attached correctly. For our tests we also call this specific method before ever method in our POM file, should we not be doing this practice?

JeromeOrtwein commented 4 years ago

The RawEntityConverter is causing this problem in the "addMedia" Method. It calls extentTest.log(Status, Exception, Media) without giving a details parameter if there is one defined in the json. So you loose the information that is shown in the first run. The JsonDeserializer works and includes this information. A current workaround i use is getting the old Tests with the JsonDeserializer(jsonFile).deserialize() and "faking" the old tests to be new ones for each run. But i think this is an essential feature that should be added (maybe even a bug).