BDD FrameWork Design Structure

Below is the framework structure which we normally follow in the TestAutomation framework for BDD.

There are totally 5 packages and 2 folders along with feature files under the project folder in the framework structure of TestAutomation.

Let us discuss one by one now.

BDD FrameWork Design Structure

Base Package

In this package we need to create two classes.

  • Driver.py class
  • BasePage.py class

Driver.py class : In this class we will create a mobile driver method.

BasePage.py class : In this class we will create all the customized methods which are required for automation like click , send_text , find_element() , find_elements() methods etc along with all the logs configuration as well.

Utilities Package

In this package will create a class for log4j configuration and report methods etc.

Pages Package

In this package we will create multiple classes based on App screens. Each .py class consists of MobileElement locator values of each screen.

In this way it's very easy to modify whenever they update or change the locatore value.

Configuration Package

In this package we will create configuration files which have values that pass in Driver.py class etc.

Report Folder

In this folder we will store all the report files after executing our scripts.

Screenshots Folder

In this folder we will store all the screenshots for failed cases or any other screenshots which require verification.

Feature Files

Now, We need to create feature files and environment.py file under the project folder. For more information on behave python concepts please look into the behave tutorials.

environment.py

In this file we can configure the methods such as before and after tests during our test execution.

In behave this is achieved by using the “environment.py” file. We need to define all the prerequisites in this file.So that while execution behave will process according to it.

Here “environment.py” filename is a constant name. We shouldn't change the name of a file. If we do it throws an error while execution.

Steps Packages:

In this package we will create all the step definitions based on feature files according to test cases.



Steps to follow to build Appium FrameWork

  • Create the folder structure of the framework with all the packages and folders.
  • Configure the Behave python libraries
  • Configure the allure reporting tool libraries
  • Create log4j custom class in utilities package
  • Create all the classes in the respective package folder as required.
  • Create the Pages classes and test file according to requirement.

Let us discuss one by one of all the classes in those packages.

1. base package
        Driver.py
        BasePage.py
2. utilities package
        Custom_logger.py
3. configurationFiles package
4. pages package
5. steps package
6. environment.py
7. Feature files