Creating a Keyword Driven Test Automation Framework

Test Automation Framework.

Automation:
With increased effort being directed to automation; it is equally important to know that to be successful and efficient necessiates for some basic infrastructure in place. The importance of an automation framework gets prime focus if you are planning to embark on a full-fledged automation effort. However creating an automation framework does not come on a platter. A huge effort does goes in to identify the scenarios and the reusability nature of the various components within the framework model.

It is equally important to know the specific operations that could synergically combine and work together to generate the final result.

Reasons for automating.
1) The elaborate process and the huge effort required for manual testing
2) With lot of workflows, it is very difficult to really test all these workflows
3) Field level validation for all the forms/ pages is a herculean task.
4) Identifying and testing all the negative scenarios may prove cumbersome
5) With multiple browser scenarios, it will be difficult to test the similar functionality on different browsers.

Benefits of automation
1) Most of the manual testing effort can be automated. Surely also will depend upon the ability of the engineering team to provide an application that is built for automation.
2) Identify all the workflows within the application, prioritize them and automate the high priority workflows
3) With refractored, generic functions, the basic field level validations can be adequately addressed.
4) All the negative testing scenarios to be identified and then automated to provide the much needed edge to your testing needs.
5) Multiple browser scenarios can well be replicated into the automated script which will save a lot of time and effort.

A word of note
Before going ahead and automating your application; it is best done with proper planning and identification of the immediate test priorities. A comparison of Data Driven and Keyword Driven tests will drive home the point. The Keyword driven test has been found to be more favorable than the data driven test. The keyword driven test automation ensures better reusability.

How the automation test industry has evolved.

In the initial days, the focus was more on getting the functionality automated as soon as possible. Little attention was paid to refractor and generate generic scripts for re-usability. A typical scenario would go like this.

– Identify the areas to automate
– Record and generate the related script
– Since the scripts that are recorded have the data bound to it; a bit of parameterization was done to separate the data from the code.
– Test specialists were trained to execute the scripts.

Automation Framework.
A typical automation framework would comprise a set of assumptions, tools and libraries to aid automated software testing.

Advantages of using an automation framework.
1) Ensuring a great deal of flexibility in creating the scripts.
2) Ensuring re-usability to a great extent possible.
3) Enables refractoring for specific functionality.

Tips to create a framework
1) Discuss and identify scenarios with the test specialists. This will ensure that their testing needs are addressed.
2) Identify the right approach based on time constraints (Decide to go for task driven, data driven or object driven test cases).
3) Co-ordinate with the end-user/ customer  to analyze and create user-scenario test cases.

Example of an object driven test case

Say, we have a login page with the following fields
– User ID textbox
– Password textbox
– Login button

If we are gonna write an object drive test case, it will follow the structure as indicated below

a) Open/ Invoke the application
b) Click the User ID textbox
c) Enter the User ID
d) Click the Password textbox
e) Enter the password
f) Click Login button

The same task written using the Task Driven approach would look like this

a) Invoke the application
b) Login using the following credentials
– User ID
– Password

The most apt and efficient way to ensure a robust automation framework is the Keyword driven Automation framework model.

– In the keyword driven framework model, it is important to identify the flow that would ensure appropriate testing.

Example. Let’s continue with the basic functionality of Login authentication.

In order to implement the keyword framework model, we will obtain the solution in a structured manner.

1) Identify the high level test (This is referred to in the Cycle Table).

We shall identify a keyword that will best exemplify the test required at this level. Let us identify the test as “Verify_Authentication”.

The cycle table “Verify_Authentication” will contain the keywords as given below.

– Verify_Invalid_Login : test with Invalid User ID and password
– Verify_Blank_Login : test with missing/ blank User ID and password
– Verify_Valid_Login : test with valid User ID and password

It very clearly indicates that the purpose of each of the test. The advantage lies in the fact that more tests can be added as required and will be identified by the new keyword. We can also delete a particular test if we find it obsolete.

2) Identify the Intermediate level test (Referred to as Suite Tables).

The keywords “Verify_Invalid_Login”, “Verify_Blank_Login”, and “Verify_Valid_Login” will be treated as Suite tables.

“Verify_Invalid_Login” will be identified by the keywords
– Invoke_Application
– Login (to test with invalid User ID and valid password)
– VerifyLoginError
– Login (to test with valid User ID and invalid password)
– Verify Login Error
– Login (to test with invalid User ID and invalid password)
– VerifyLoginError
– ExitLogin

“Verify_Blank_Login” will be identified by the keywords
– Invoke_Application
– Login (to test with blank User ID and blank Password)
– VerifyLoginError
– ExitLogin

“Verify_Valid_Login” will be identified by the keywords
– Invoke_Application
– Login (to test with valid User ID and valid password)
– VerifyLoginSuccess
– Exit_Application

3) The next step is to identify the Site application map, which will indicate the object name and its identification method.

Example

Object Name : Browser
Identification method : Browser(micClass:=Browser)

Object Name : LoginPage
Identification method : Title:=Login

Object Name : User ID textbox
Identification method : Index :=1 or name :=txtUserID

4) Next identify the Low Level test (referred to as Step Tables)

Example of Step tables are given below

– Invoke_Application (Launch the web application for testing).
– Login (Login with User ID and password)
– VerifyLoginError (Verify the error dialog/ popup with invalid login credentials)
– ExitLogin (exit the login using Cancel)
– VerifyLoginSuccess (verify Home page after successful login)
– Exit_Application (Logoff and close the application browser)

Individual Step tables will need to be explained as indicated below.

The step table “Invoke_Application” will have the following

Step Table: LaunchSite

COMMAND/DOCUMENT

ARG/COMPONENT

ACTION

EXPECTED

RESULTS

LaunchBrowser

Default.htm

Browser

VerifyCaption

“Login”

Step Table: Login &user &password

DOCUMENT

COMPONENT

ACTION

INPUT DATA

LoginPage

UserID

InputText

&user

LoginPage

Password

InputText

&password

LoginPage

SubmitButton

Click

Step Table: VerifyLoginError

DOCUMENT

COMPONENT

ACTION

EXPECTED

RESULT

ErrorWin

VerifyCaption

“Error”

ErrorWin

ErrorMessage

VerifyText

“The User ID or Password was invalid.”

ErrorWin

OKButton

Click

The final sequencing of the automation test flow will be seen as such.

Execution Flow of VerifyAuthenticationFunction Test

Cycle Table

Suite Table

Step Table

DOCUMENT

Or

COMMAND

COMPONENT

Or

COMMAND ARG

ACTION

INPUT DATA

Or

EXPECTED RESULTS

VerifyAuthenticationFunction

VerifyInvalidLogin

LaunchSite

LaunchBrowser

Default.htm

Browser

VerifyCaption

“Login”

Login

&user=BadUser

&password=GoodPassword

LoginPage

UserID

InputText

&user

LoginPage

Password

InputText

&password

LoginPage

SubmitButton

Click

VerifyLoginError

ErrorWin

VerifyCaption

“Error”

ErrorWin

ErrorMessage

VerifyText

“The User ID or Password was Invalid.”

ErrorWin

OKButton

Click

Login

&user=GoodUser

&password=BadPassword

LoginPage

UserID

InputText

&user

LoginPage

Password

InputText

&password

LoginPage

SubmitButton

Click

VerifyLoginError

ErrorWin

VerifyCaption

“Error”

ErrorWin

ErrorMessage

VerifyText

“The User ID or Password was Invalid.”

ErrorWin

OKButton

Click

Login

&user=BadUser

&password=BadPassword

LoginPage

UserID

InputText

&user

LoginPage

Password

InputText

&password

LoginPage

SubmitButton

Click

VerifyLoginError

ErrorWin

VerifyCaption

“Error”

ErrorWin

ErrorMessage

VerifyText

“The User ID or Password was Invalid.”

ErrorWin

OKButton

Click

ExitLogin

LoginPage

CancelButton

Click

VerifyBlankLogin

LaunchSite

LaunchBrowser

Default.htm

Browser

VerifyCaption

“Login”

Login

&user=””

&password=””

LoginPage

UserID

InputText

&user

LoginPage

Password

InputText

&password

LoginPage

SubmitButton

Click

VerifyLoginError

ErrorWin

VerifyCaption

“Error”

ErrorWin

ErrorMessage

VerifyText

“The User ID or Password was Invalid.”

ErrorWin

OKButton

Click

ExitLogin

LoginPage

CancelButton

Click

VerifyValidLogin

LaunchSite

LaunchBrowser

Default.htm

Browser

VerifyCaption

“Login”

Login

&user=GoodUser

&password=GoodPassword

LoginPage

UserID

InputText

&user

LoginPage

Password

InputText

&password

LoginPage

SubmitButton

Click

VerifyLoginSuccess

HomePage

VerifyTitle

“Home”

Browser

VerifyCaption

“Welcome”

ShutdownSite

Browser

SelectMenuItem

File>Exit

For detailed knowhow on how to go about creating a AUTOMATION TESTING FRAMEWORK, do visit http://www.open2test.org/techdocs.html

Step Table: LaunchSite

COMMAND/DOCUMENT

ARG/COMPONENT

ACTION

EXPECTED

RESULTS

LaunchBrowser

Default.htm

Browser

VerifyCaption

“Login”

Advertisements

One thought on “Creating a Keyword Driven Test Automation Framework

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