CSharp Page Object with Allure reporting

TestODev has written Page Object model implementation with Java and Python in the previous posts. Today we will discuss POM with C# and Allure reporting implementation. 


The Page Object Model (POM) is a design pattern in test automation that promotes the creation of an object repository for web UI elements. This pattern reduces code duplication, improves test maintenance, and enhances readability by separating the test logic from the page structure. Each web page is represented by a class, encapsulating the elements and actions related to that page.


Prerequisites

  • .NET SDK
  • Visual Studio or any other compatible IDE
  • JDK for Allure Report generation
  • Allure Commandline installed and added to your PATH

Dependencies
  • NUnit: Test framework for writing and executing tests.
  • NUnit3TestAdapter: Test adapter for running NUnit tests in Visual Studio.
  • Selenium.WebDriver: WebDriver bindings for interacting with web browsers.
  • Selenium.Support: Support libraries for Selenium WebDriver.
  • WebDriverManager: Library for managing browser drivers.
  • DotNetSeleniumExtras.WaitHelpers: Additional Selenium wait helper methods.
As discussed above, separate class files are created for both Page and Test classes in the page object model.  

Automation suite structure 

Allure Integration:

The below code snippet explains the integration with Allure. Allure supports various annotations to arrange the test report in a more effective way 


   

Once the test execution is completed, you can generate the result using allure serve

 

Allure report


 You can find its source code here - https://github.com/vishnuar/csharp-pom-allure

أحدث أقدم