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

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

Merged
merged 3 commits into from Apr 5, 2017

Conversation

Projects
None yet
2 participants
@email2vimalraj
Collaborator

email2vimalraj commented Apr 5, 2017

  • 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 email2vimalraj self-assigned this Apr 5, 2017

@email2vimalraj email2vimalraj requested a review from anshooarora Apr 5, 2017

@email2vimalraj

This comment has been minimized.

Show comment
Hide comment
@email2vimalraj

email2vimalraj Apr 5, 2017

Collaborator

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

email2vimalraj commented Apr 5, 2017

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

This comment has been minimized.

@anshooarora

anshooarora Apr 5, 2017

Owner

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 Apr 5, 2017

Owner

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

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment