VOOZH about

URL: https://deepwiki.com/Accenture/Ocaramba/6.1-extentreports-integration-(nunitextentreports)

⇱ ExtentReports Integration (NUnitExtentReports) | Accenture/Ocaramba | DeepWiki


Loading...
Last indexed: 6 June 2026 (fb3580)
Menu

ExtentReports Integration (NUnitExtentReports)

The Ocaramba.Tests.NUnitExtentReports project provides a reference implementation for integrating ExtentReports (v5.0.4) with the Ocaramba framework and NUnit Ocaramba.Tests.NUnitExtentReports/Ocaramba.Tests.NUnitExtentReports.csproj1-67 It generates interactive, searchable HTML dashboards that include test results, detailed logs, and embedded screenshots.

System Architecture and Data Flow

The integration utilizes NUnit lifecycle hooks to initialize the reporting engine, manage test nodes across parallel executions, and finalize the output.

Reporting Lifecycle Diagram

This diagram shows how ExtentReports entities are mapped to NUnit execution phases.

ExtentReports Entity Mapping


Sources: Ocaramba.Tests.NUnitExtentReports/TestExecutionManager.cs12-47 Ocaramba.Tests.NUnitExtentReports/ProjectTestBase.cs79-143

Core Implementation Classes

TestExecutionManager

The TestExecutionManager class is marked with the [SetUpFixture] attribute, ensuring it runs once for the entire assembly Ocaramba.Tests.NUnitExtentReports/TestExecutionManager.cs12-14

ProjectTestBase

This class inherits from TestBase and manages the DriverContext alongside ExtentReport test nodes Ocaramba.Tests.NUnitExtentReports/ProjectTestBase.cs40-42

ExtentTestLogger

A static helper class that provides a bridge between test logic and the reporting engine. It allows logging without directly referencing the ProjectTestBase instance by accessing the [ThreadStatic] test property.

MethodPurposeImplementation
Info(string text)Adds an info step to the reportProjectTestBase.test.Info(text)
Pass(string text)Marks the current node as passedProjectTestBase.test.Pass(text)
Fail(TestStatus status, string message)Logs failure detailsProjectTestBase.test.Fail(message)
Warning(string text)Adds a warning icon/messageProjectTestBase.test.Warning(text)

Sources: Ocaramba.Tests.NUnitExtentReports/ProjectTestBase.cs48 Ocaramba.Tests.NUnitExtentReports/ExtentLogger/ExtentTestLogger.cs25-85

Screenshot and Attachment Integration

When a test fails, Ocaramba automatically captures screenshots if configured. The ProjectTestBase class handles attaching these to the ExtentReport.

Attachment Data Flow


Sources: Ocaramba.Tests.NUnitExtentReports/ProjectTestBase.cs116-123 Ocaramba.Tests.NUnitExtentReports/ProjectTestBase.cs156-166

The EmbedAttachmentsToExtentReport method converts absolute file paths into relative paths (e.g., .\screenshot.png) using Path.GetFileName so the HTML report can load them correctly when distributed Ocaramba.Tests.NUnitExtentReports/ProjectTestBase.cs161-163

Configuration and Usage

Required Dependencies

The project relies on the following NuGet packages defined in the .csproj:

Logging in Page Objects

Page objects within this project utilize ExtentTestLogger to provide high-level business step visibility in the report. For example, in InternetPage:

Logging in Tests

In the test methods, developers can add custom info steps directly using the static test property from ProjectTestBase or via ExtentTestLogger. Example from HerokuappTestsNUnit:

Sources: