Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Fixed the exception view which was not displaying the results properly #841

Merged
merged 3 commits into from
Apr 5, 2017

Conversation

email2vimalraj
Copy link
Collaborator

  • Fixed the exception view which was not displaying the results properly
  • Removed the duplicated exception for the parent node if the exception was raised by the child node
  • Minor enhancement in the style and the nav template
  • Updated the version number in the report template

@email2vimalraj
Copy link
Collaborator Author

The report now looks like as follows:

screen shot 2017-04-05 at 8 57 35 pm

The code used to test is as follows:

// 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();

copyNodeAttributeInfoToAttributeContext(x);
copyNodeExceptionInfoToExceptionContext(x);
});
test.getNodeContext().getAll().forEach(this::copyNodeAttributeInfoToAttributeContext);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2 methods:

copyNodeAttributeInfoToAttributeContext
copyNodeExceptionInfoToExceptionContext

were not sharing the code because one points to the test's attributes and the other for exception. Attributes of the test are author, category etc. Exception isn't a test's attribute because it is not something that you can assign, but it occurs due to an event, so its more of a runtime binding.

We can change the method name so its more clear to the user that here the test is computing all attributes and runtime events..

@anshooarora anshooarora merged commit 727a8f9 into master Apr 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants