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

Bug view not displayed #840

Closed email2vimalraj closed 7 years ago

email2vimalraj commented 7 years ago

Summary

From v3.0.4, the Bug View is not displayed even though there is a failure with throwable.

Expected Behavior

If there are any tests failed with throwable, the Bug view should be displayed in the report.

Current Behavior

Currently the Bug view is not displayed from v3.0.4.

Sample

ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("extent.html");
ExtentReports reporter =  new ExtentReports();
reporter.attachReporter(htmlReporter);
ExtentTest parentSuite = reporter.createTest("Parent Suite");
ExtentTest childTest = parentSuite.createNode("Child Test");
childTest.createNode("Grand Child Test").fail(new RuntimeException("Some exception message"));
reporter.flush();

Environment Details

anshooarora commented 7 years ago

@email2vimalraj - does the latest commit work? I will quickly release this version if your tests also pass, this one is very high priority.

email2vimalraj commented 7 years ago

@anshooarora: I'm on it

email2vimalraj commented 7 years ago

@anshooarora : The bug tag is displayed now. However, there are few things which are not correct.

  1. The exception are being displayed even for the parent node
issue_1
  1. If you notice the above screenshot, the message for everything is the same even my test doesn't throw the same message. For example:
// start reporters
        ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("extent.html");

        // create ExtentReports and attach reporter(s)
        ExtentReports extent = new ExtentReports();
        extent.attachReporter(htmlReporter);

        ExtentTest feature1 = extent.createTest("Feature 1");
        ExtentTest scenario1 = feature1.createNode(Scenario.class, "Scenario 1");
        scenario1.createNode(Given.class, "Step 1").pass("Passed");
        scenario1.createNode(When.class, "Step 2").fail(new IllegalStateException("Second test failed"));

        ExtentTest feature2 = extent.createTest("Feature 2");
        ExtentTest scenario2 = feature2.createNode(Scenario.class, "Scenario 2");
        scenario2.createNode(Given.class, "Step 1").pass("Passed");
        scenario2.createNode(When.class, "Step 2").pass("Passed");

        ExtentTest scenario3 = feature2.createNode(Scenario.class, "Scenario 3");
        scenario3.createNode(Given.class, "Step 1").pass("Passed");
        scenario3.createNode(When.class, "Step 2").fail(new IllegalStateException("Fail message"));

        extent.flush();

The exception type is same, however the message of the exception are different. In this case Second Test Failed and Fail message are two different messages.

anshooarora commented 7 years ago

With the latest commit, parentTest will not copy exception info from children..

email2vimalraj commented 7 years ago

Yeah saw your commit, I've simplified your previous commit by refactoring few things. Kindly review my PR #841

email2vimalraj commented 7 years ago

Fixed in v3.0.5