Integrate Extent Report with Screenshots inNUnit Selenium Framework (.NET Core).

inNUnit Selenium Framework

Integrate Extent Report with Screenshots inNUnit Selenium Framework (.NET Core).

Setting up Visual Studio

1. Download the latest version of Visual Studio.
2. Select NUnit 3 Test project.

Integrate Extent Report
3. Give a project name and click next.

(.NET Core).
4. As we are creating a selenium framework, we need selenium packages and browsers driver. If you are familiar with the maven java selenium framework, in a maven project we have a pom.xml file to add the required .jar files to our project.

Similarly, we have NuGet Package Manager to add required packages to our project. We can access the NuGet Package by right click on the project.

NuGet Package Manager

5. Here are the packages we will need for the project.

Project Structure

Read Also:-Step by Step Guide On Behavior Driven Development (BDD) Testing

Setting up Project Structure

For the demo I have used an online calculator to perform basic mathematical operations and verified the result from the online calculator is correct or not.

  1. Create folders Pages, Steps, Tests, and Utils.
  2. The pages folder will contain a Page class that will have the locators and unit methods.
  3. Steps folder will contain a Step class and we will use the object of this class to access the unit methods of the Page Class.
  4. Tests folder will contain the test scripts.
  5. Utils folder will have a helper or utility class.

test scripts

Calculator Framework

Calculator Framework

 

 

 

 

 

 

 

 

 

 

Utility.cs – GetProjectRootDirectory() returns the project root directory path.

Utility.cs

DriverUtil.cs – Initialize the correct browser driver and return the driver instance.

Utility.cs

ExtentService.cs – Create an instance of ExtentReports if the instance is not present else it returns the instance.

Configure Image

ExtentTestManager.cs – Create parent test and child test which gives a hierarchy of test in extent report.

ExtentTestManager.cs

ReportLog.cs – Add logs to extent report.

ReportLog.cs

BasePage.cs – Contains custom methods with the explicit wait.

HomePage.cs – Contains the locators and custom method for entering digits in the online calculator.

HomePage.cs

HomePageStep.cs – Contains the methods and each method returns the result from the online calculator.

HomePageStep.cs

BaseTest.cs

BaseTest.cs

AddSubtractTest.cs

AddSubtractTest.cs

MultiplyDivideTest.cs

MultiplyDivideTest.cs

  1. The OneTimeSetUp attribute is inherited from any base class. Therefore, if a base class has defined an OneTimeSetUp method, that method will be called before any methods in the derived class.
  2. The OneTimeTearDown attribute is inherited from any base class. Therefore, if a base class has defined an OneTimeTearDown method, that method will be called after any test methods in the derived class.
  3. The SetUp attribute is inherited from any base class. Therefore, if a base class has defined a SetUp method, that method will be called before each test method in the derived class.
  4. The TearDown attribute is inherited from any base class. Therefore, if a base class has defined a TearDown method, that method will be called after each test method in the derived class.
  5. The Parallelizable Attribute is used to indicate that a test and/or its descendants may be run in parallel with other tests.

Read Also:- All About Accessibility Web Testing

Test Parallel Execution – Extent Report

Test Parallel Execution - Extent Report

 

Screenshot

Screenshot

 

Counted among the best software testing company in India by Clutch and Good firms. We have an independent testing team who keeps on testing the product in all the faces of the software development life cycle.

Share this post