Feature structure

Feature folders in Automation Testing (AT) project correspond to features within the application. Each feature deals with a specific set of responsibilities.

We will use the Users feature as an example to showcase the process of setting up a feature folder in AT project.

Inspecting the User section of the application, we can conclude it consists of three page objects:

  1. Create New User modal window

  2. User Management Page

  3. User Page (or User Edit page)

We can create the Users feature folder inside the AT project, and add the following basic elements which every feature must contain:

Basic sections of each feature

1. Components

Components folder will contain page objects for pages within this feature. It can contain Controls subfolder containing custom controls used by the page objects.

Constants contains all the selectors for page objects in this feature.

2. Tests

Tests folder contains all tests related to this feature.

Tests are separated into two subfolders: Parallelizable and NonParallelizable depending on how we structured tests to execute.

Rule of thumb is that every main page object should probably have a separate test class containing tests for that page. (i.e. UserManagementPage should have UserManagementPageTests, but CreateNewUserWindow is a supporting page object for a modal window, and tests for CreateNewUserWindow are part of UserManagementPageTests)

3. Pages

Pages is a partial static class in which we define the pages related to that feature. We define this partial class in every feature folder so that feature pages are separated. In this example we can define the User Management page with:

public static UserManagementPage UserManagementPage()
{
    return Go.To<UserManagementPage>();
}

and then load it when writing tests: Pages.UserManagementPage()

4. Setup Fixture

Many features will have a SetupFixture class defined, which is used to setup test data for that feature.

In this example, UsersSetupFixture is used to create a test user before any tests are run, and to cleanup and delete that user when all tests in this feature finish executing.

Last updated

Was this helpful?