Skip to content

ExtentReports Support

Wojtek edited this page Oct 13, 2021 · 4 revisions

Ocaramba.Tests.NUnitExtentReports project in Ocaramba framework implements ExtentReports framework (https://www.extentreports.com/) to generate HTML reports.

Reporting concept

ExtentReports framework is implemented in a way resulting with a single index.html report file containing logs related to all executed tests. Each ExtentReports Test visible on the left side of the report represents a class containing NUnit tests. Right side of the report contains ExtentReports TestNodes representing particular test methods from selected test class. Each of the test nodes can be expanded to get detailed logs related to particular test methos

Logging information to the HTML report

  • Test execution time-related information is logged in the report by default
  • Test execution status (pass/failure) is logged in the report by default (implemented in ProjectTestBase.cs class)
  • Logging additional information is enabled by methods available in ExtentLogger\ExtentTestLogger.cs class
  • Framework enables logging in the HTML report following statuses: Info, Debug, Warning, Pass and Fail

Default failure logging

Each test failure will be logged in the HTML report together with corresponding error message and embedded screenshot taken at the time of test failure

Example usage

Test method

test.Info("Verifying action links displayed in the table, expected: " + ExpectedActionLinks);

test.Info("Verifying surname displayed in the table, expected: " + ExpectedSurname);

Page object method

ExtentTestLogger.Debug("NestedFramesPage: Switching to frame: " + frame);

ExtentTestLogger.Debug("DropdownPage: Selecting element on dropdown by visible text: " + text);

HTML report file location

Local test execution

Latest HTML test report (index.html) can be found in .\Ocaramba.Tests.NUnitExtentReports\bin\Debug\netcoreapp3.1\TestOutput directory

CI test execution

After execution of tests on CI (Azure DevOps pipeline https://dev.azure.com/ocaramba/Ocaramba/_build?definitionId=2&_a=summary), HTML report can be found in build's published artifacts

Clone this wiki locally