Integrate Extent Report with in NUnit Selenium Framework Screenshots | Devstringx

Back to Blog
NUnit Selenium Framework

Integrate Extent Report with in NUnit Selenium Framework Screenshots | Devstringx

Setting up Visual Studio

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

3. Give a project name and click next.

4. As we are creating a selenium framework, we need selenium packages and a browser 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.

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

Setting up Project Structure

For the demo I 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. The 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.

root directory

Read Also:- Explore the Types of Interface Testing and Strategy

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

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

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

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

ReportLog

ReportLog.cs — Add logs to extent report.

BasePage

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

HomePage.cs

HomePage.cs

Contains the locators and a custom method for entering digits in the online calculator.
HomePageStep.cs

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

BaseTest.cs

BaseTest.cs

AddSubtractTest

AddSubtractTest.cs

MultiplyDivideTest.cs

MultiplyDivideTest.cs

OneTimeSetUp
  1. The OneTimeSetUp attribute inherits 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 inherits 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 inherits 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 inherits 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 uses to indicate that a test and/or its descendants may be run in parallel with other tests.

Read Also:- What is Clickjacking? Complete Tutorial & Examples

Test Parallel Execution – Extent Report

Selenium Framework

Screenshot

Devstringx Technologies

FAQs
  • How to use the extent report in the framework?

Extent HtmlReporter

This class generates an HTML file. The classes that are listed below can be utilized with the stated built-in functions. endTest: A test case’s postconditions are fulfilled. Logging technique: The generated HTML report uses the Log to record the status of each test step.

  • How to generate an extended report in selenium?

It is possible to utilize this method with JUnit and TestNG, making it one of the most feature-rich parallel execution in selenium c# nunit report-generation techniques. All you have to do to get Extent Report to produce an HTML report is create a testNg. XML file and then select Run As TestNG suite.

  • What is the extent reported in selenium?

An open-source reporting package called Extent Reports is helpful for test robotization. With popular testing fabrics like JUnit, NUnit, TestNG, etc., it may be seamlessly incorporated. These reports are HTML documents with pie maps for the results. Additionally, they enable the creation of personalized logs, photos, and other details.

  • Reason to use an extended report in selenium?

One of the best built-in selenium c# nunit framework web driver features for creating customizable HTML reports with a nice user interface is Extent Reports. The greatest option for automation testers is this open-source library because Selenium can be simply configured with it.


If you are interested in even more software testing-related articles and information from us here at Devstringx, then we have a lot to choose from for you.

Share this post

Back to Blog