Automation Framework Design – Page

1      Introduction

This documents aims to give a brief picture about the automation framework development. The design pattern that followed for this framework design is page object model. The main folders in this solution are

  1. Automation Framework: This solution folder contains the core contents of framework and it consist of a single project called as “Auto Frame”.
  2. Pages: Pages for each domain is created under different project.
    1. Each page contains only the web elements and the methods to interact with that particular page.
    2. Page initialization is taken care by the framework.
    3. In complex pages there is a clear logical separation between the “test data” logic and the “page” logic.
  3. Tests: Tests contains only the logic to interact with the pages. Under that project there are different test files like system tests (eg: SystemTest1.cs), Integration test(IntegrationTest1.cs) etc.
  4. Zet up : This solution folder consists of the Environment setup excel files such as IntialSetting.xlsx, excel1.xlsx etc… and dynamic test data.

Figure 1 Framework Overview

2      Automation Framework


Figure 2 Auto Frame Structure:



Base contains Base.cs, BasePage.cs, BaseTest.cs and DriverBase.cs.   Base.cs

Base.cs is the core of this framework. The most important rule is that Base.cs should be inherited by the BaseTest.cs, BasePage.cs and APIBasePage.cs which in turn should be inherited by the corresponding Tests and Pages folder. There is a middle level of inheritance for the BaseTest.cs. This middle level inheritance is done in order to handle different combinations of Environments and Browsers [aka combination of Test Fixture and Test. The core contents of base class are

  1. Report variables initialization
  2. Page Generics – to avoid page initialization for each page.
  3. Recording variables initialization >> can be controlled through InitialSettings.xlsx.
  4. N-unit
    1. One Time Setup: Initialize the report for each “test suite” [not “test case”]. Can create a new report or append on the existing report which can be controlled through InitialSettings.xlsx.
    2. One time tear down: This will be executed when all the tests are finished in that particular test suite [executed when the tests under similar test fixtures are done,]. Currently this opens up the report generated.
    3. Setup: Executed for each test case. Handles the recording functionality of the framework. Can be controlled through InitialSettings.xlsx.
    4. Tear down: Logging the report for each test case. Stops the recording and log it to report if applicable.
  5. Extent Manager: Extent manager handle the report path & report initialization and decide whether a new report or append on the existing report. This settings can be controlled through InitialSettings.xlsx.   BasePage.cs

Rule of thumb: All the classes that ends with “Page” should inherit from BasePage.cs. BasePage.cs handles the page initialization for pages.   BaseTest.cs

Rule of thumb: BaseTest.cs should be inherited by BaseTestproject1.cs, BaseTestProject2.cs, which in turn should be inherited by the ProjectTest1.cs, ProjectTest2.cs,


Base Test’s handles primarily 2 things

  1. Browser Setup: Calling “Setup” method will open the corresponding “browser” in the parameter.
    1. Can add / delete browsers here.
  2. Report Setup & start executing TC.
    1. It’s ideal to call this method from all the “Tests” as it will handle the report initialisation for all the Test types such as SESB, MEMB, iMEMB etc.   APIBasePage

API Base Page handles the logic to handle the authentication token.   DriverBase.cs

This class handles the IWebdriver driver. Designed in a separate class to handle all the browser related methods / extension (gotoURL etc…).

2.1.2    Configurations (Configs)

Contains mainly three files

  1. ReportConfig.cs: handles the directory creation for reports, screenshot, screencast etc.
  2. Settings.cs: Handles the global variables.
  3. TestEnvironmentSettings.resx: A resource file which handles the visibility of excel, screenshot settings like take screenshot in each step. excel location etc. [Rather than reading this setting from excel file, the following things are created in a resource file as some of them (eg: “Report Screenshot”) are frequently accessed with in the code.]


2.1.3    Extensions

Extension contain the custom extensions for Selenium WebDriver and Web Element.   Web Element Extensions

These are the custom extensions to handle Web Elements. As some clicks can only be triggered by Java scripts custom extensions are inevitable. The extensions developed are   Web Driver Extensions

Custom extensions for web driver developed are.

It’s better use a combination for “Wait for page load” and “Wait for element” if the system is too complicated.


2.1.4    Helpers

Helps for excel operations, Jquery Data Tables random test data etc.


3      Pages

The structure of pages are mentioned previously. Each page will only have the web elements and the corresponding methods to interact with them.

Note: In some page methods there is clear logical separation between test data logic and page logic to avoid the repetition of code.



4      Tests


Tests file contains only two things

  1. Call the “Start Test” method and pass the parameters to start report engine
  2. The logic to interact with the pages, for example


CurrentPage = GetInstance().LoginPageifAny()





5      Zetup


Stores the Test case and Test Data. A quick overview of the files

  1. InitialSettings.xlsx : Stores the Environments URL’s, Browser Names, Report Location, Report Path, New / Append Report, Record Test
  2.  The excel filenames starting with TC contains the test cases. These excel data are used to assess the test type, logging reports etc. [Note: Any change in Row 1 will stop the test execution.]
  3. TCData – Folders which starts with TCData contains only the test data.
  4. DynamicTestData.cs – contains test data that are generated while execution.


** This doc only discuss the bare minimum things about the framework. More details can be found at the code level.


Aadhith Bose 🙂