I am developing an automated test suite for regression testing using Extent Reports, Selenium WebDriver and C#. The tests are confined to a single Visual Studio console app. What I have right now doesn't seem optimal in terms of scalability. I don't have a lot of experience with automated testing or QA in general, how can I keep this framework scalable? Here is the current structure:

  1. TestExtent.cs - This class contains all of the setup and breakdown methods for extent reports and creates the drivers. It has one method for each web page I'm testing. Each of the these test methods call test classes and helper classes (Helpers are shared between multiple pages with common components. i.e - testing global headers, footers, and link validation functions). The test methods also contain driver.Navigate().GoToUrl(url), and create a new ExtentTest object (extent.CreateTest("test name") which creates a new test in the report.
  2. Program.cs - This hosts the main method and decides which tests I'm running. It creates a TestExtent object that calls all of the tests I wish to run. If I don't need to run a test, I can comment the call to that test method out.
  3. Test classes - Test classes contain unique tests for unique components on web pages, which will eventually be called by the test methods in the TestExtent class. The WebDriver and the ExtentTest objects created in the TestExtent methods are passed to the test class constructors.
  4. Helper classes - A static class that contains common tests that are found on multiple pages. Like the test classes, the helper methods are called in the TestExtent class. The helper classes usually take the WebDriver and the ExtentTest object created by the test methods in TestExtent. The WebDriver and the ExtentTest object from the test methods in the TestExtent class are passed to the helper methods.

To create a new test with how the program is organized right now, I would need to create new test classes, create a new test method in TestExtent.cs to call the test classes and helper methods, then run the test in program.cs. Before I build this out more, I want to make sure it is as scalable as possible. I feel like the most important things to consider are:

  1. how am I going to add new tests
  2. how am I going to change/delete old tests
  3. (which is less important at the moment) How will I handle running tests. Ideally, if someone is unfamiliar with visual studio or code, they shouldn't have to dig into the code to comment out tests you need to exclude.

It would be great to hear from people who have experience with automated testing, regression testing, Extent Reports, or c# and selenium webdriver. I am most concerned with the scalability of the framework and would love to here what experienced QA have to say! Thanks in advance for any advice.

  • While you've given a lot of good background information, you haven't really asked a clear question. Could you please edit your question to clearly ask one question? (I would suggest that your one question be "How can I keep this framework scalable?" since that seems to be your main concern here.
    – Kate Paulk
    Jun 14, 2019 at 12:27
  • thanks for the feedback. I updated the question.
    – Raoul Duke
    Jun 14, 2019 at 18:49

1 Answer 1


First, I've never used Extent Reports, but a quick review indicates that this is a reporting tool that will be useful for sharing test result data. When reading your description, I was confused why this was the starting point. Your test automation shouldn't be dependent on or controlled by a reporting library, as you may change this to another library later. If you switch to another reporting library in year, you'd likely have to rewrite all or test automation. Reporting criteria should be the last consideration and a feature of your test automation.

Same goes with using a functional approach. Functional or method approach is not scalable and creates maintenance headaches.

Instead, I'd recommend using the Page Object Model (POM) to design your tests. This is a classic pattern that is recommended for Selenium as it helps to keep your tests DRY (don't repeat yourself) and it helps with separation of concerns, which helps to make is scalable and easier to maintain. The creators of Selenium even state "if you're not using Page Objects, you're using Selenium wrong." Page objects are standard OOP classes. Using OOP is inherently scalable over a functional approach.

The page objects are there to represent pages or parts of pages of the app being tested. For example, you'd create a login.cs class for the login page of your app; signup.cs class for the signup page of your app, etc. No test data belongs in the page objects, just information on your web elements and methods on using those elements.

You'd then want to create unit test files. Since you are using C#, xUnit, nUnit, MSTest, or others can be considered. This is where your test logic is for asserts, test setup, test tear down, etc. Here is where you'd instantiate your Page Object classes to use. These unit test libraries also allow you to decorate your tests with different attributes, which are useful when running tests. This way, you don't have to comment out test methods if you don't want specific tests to run. You can have as many test files here as you need. Look to the documentation of the unit test library for specifics.

An example directory structure could look like this:

  • PageObjects
    • BaseClass.cs
    • LoginPage.cs
    • SignupPage.cs
  • TestCases
    • LoginTests.cs
    • SignupTests.cs

As for running tests, yes, you can run them via Visual Studio or via command line. Or, you can add your tests to a CI/CD system (Jenkins, TravisCI, CircleCI, etc) which will allow anyone to run them. You can even create custom commands with switches to determine what tests are ran and when. Using a unit test library with CI/CD will give you lots of options and flexibility.

I've built several test automation frameworks using Selenium C#. I've used both MSTest and nUnit. I recommend nUnit. When creating test frameworks, I've always used Page Object Model. Lots have been written on POM and the benefits. Just Google "Selenium C# page objects example" for examples on how to get started.

This approach will give you the best scalability, flexibility, extendability, and maintenance long term.

  • This is extremely helpful and I appreciate your detailed response. I will look into POM. Unfortunately I don't have enough feedback to upvote this, but hoping others will. Thanks!
    – Raoul Duke
    Jul 2, 2019 at 13:31
  • in your example what would the "BaseClass.cs" be used for? Also, if two or more page objects share a common element/feature, where would the code be? Would there be another class that extends those pageobjects? If so, would that shared class be in the PageObject folder or another directory?
    – Raoul Duke
    Jul 2, 2019 at 15:11
  • @RaoulDuke The BaseClass can be used for functionality that is common across all pages, this is your parent class. For common features on multiple pages like header or footer, I'd create a separate page object for those. You can instantiate (include) those in any page object class as needed. As for directory location, yes, personally, I'd keep all those classes in the Page Object folder.
    – Lee Jensen
    Jul 2, 2019 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.