Automation Framework for Beginner

Basic understanding of a framework:

Before developing a framework we should step back and understand whether we need a framework or not? A framework makes our life easy. However, on the other hand to create a mature framework, time and cost is involved.

Here we are discussing about automation testing and it’s related frameworks. So to understand WHAT a basic automation framework does, we should understand the basic of automation testing.

Basic understanding of automation:

To be honest, we can achieve many things using automation. I will try to highlight almost everything to start automation.

In simple words, we automate the manual test cases using some tool. These automated test cases are written in such a way that it can be executed anytime without manual intervention. As time goes on, the automation scripts become complex and unorganized because of update, delete and insert in AUT(Application Under Test). Hence the need of framework comes into play.

Prerequisite: Features of automation framework.

Creation of first automation framework:

Here we will develop a automation framework with all the basic feature discussed above.

Prerequisite: basic knowledge of Selenium WebDriver, Java, TestNG 
is required.

Let’s start developing:

 

Landscape diagram of the framework:basic-framework-diagram.png

2. Framework in one snip:Complete_Framework.png

The representation of basic framework is described above.

  1. Create the project structure as shown in the project explorer.
  2. Create the utility files first:
    1. Utility.java: define all the customized function required for interacting with the objects. You can even implement WebDriver interface.
    2. Read Properties java file: define reading the config.properties file.
    3. Read excel java file: define reading excel file.
  3. Create config.properties file:
    1. Analyze and create the environment variables based on the application under test. For example: browsers, environment variables, test data path etc.
  4. Create or import test data: try to read the excel (or any other file format) using read excel java file.
  5. Create Object repository: Divide the AUT into pages or module which ever is convenient, so that it is easy to locate each element in the framework.
  6. Create business logic module: Again business logic are to be structured in such a way that it can be easily understandable and located. As business logic keeps changing during, we should keep updating the logic. Remember it is suggested to keep the business logic method static so that it can be easily called in the test scripts.
  7. At last, create the test scripts: Mimic the manual test cases as shown in the snip above. Call the business logic along with the related test data.

Hope this will be helpful, in case of any further doubt please contact me. Please do like and follow my blog for further discussions on automation.

 

2 thoughts on “Automation Framework for Beginner

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s