Thursday, June 2, 2011

How to initiate with Keydriven Framework

 Hello Friend as I have already discussed about framework & types in my last post. Then my one of blog follower asked me how to initiate with any framework, especially Keyword driver.

So I have tried to share my thoughts on the same with example of sample application “Flight” which we usually get with QTP. I know it’s very simple application compare to our practical work but as this command available to person who use QTP, hence I decide to go with it.

Here I will not get deep in coding but will go in concept ually way.
Let’s consider the basic 3 test for flight application as follow.
1.       Login into application and logout
2.       Login, book the order,  confirm it and log out
3.       Login, open the order, delete it and confirm the deletion and logout.

Of course these test will not be single line, there will be specific steps with verification point. This step will be our first target to identify the keyword. Definitely there will be 4-5 steps which we have to perform in single window so we take the as single activity as a keyword. It also depends on how the test cases are written.

For example:
Test 1 – Type 1:
·         Login into application with correct credential
·         Confirm the Home page of application
·         Log out from the application
·         Confirm the logout that it returns to “Login page”
Test1 –Type2:
·         Open the application by from start or writing “Test Application” in run
·         Confirm the login page
·         Enter User name
·         Enter Password and click “Login” Button
·         Wait and confirm the Home page.
·         Select logout option from the menu item
·         Confirm the logout that it returns to “Logint page”

This is very simple and small test but you can see in both type we are doing same thing  process of writing is different. These similar things we have to take care while deciding the key word.
Because Login step can be perform by single keyword
·         Login(“UserName”,”Password”)

It can also be perform using following 4 keyword
·         OpenApplication(“Argument”)
·         EnterValueinEditbox(“LoginPage”“UserEdit”, “Username”)
·         EnterValueinEditbox(“LoginPage”,“PasswordEdit”, “Hello123”)
·         ClickonButton(“LoginPage”,”Login”)
·         IspageExit(“Pageopen”)

Well you think no one will split the login step this way, But looking to broader picture to any huge n complex application where single test contain many steps you have decide step with proper scope and  which don’t have any dependency.

Many people avoid identifying keyword for the entire test or at least the core area which is our first target as automation ROI. But as I have experience predefining of keyword help you lot and save you most of time.
For above three tests will required following keywords.
  • ·         Login
  • ·         Bookorder
  • ·         Isorderexist
  • ·         Deleteorder
  • ·         Logout
Similarly for remaining functionality we can identify the keyword which will be max to max 15. And using those 15 keywords we can automate at least 100 or more test.  Which is quality or you can say best quality of Keyword driven

While identifications of  keyword we should take care it should not perform much operation or more then window, because what we ever operation the keyword do for that it might required input data which we have to provide and manage for expected output.
While identify keyword we should make sure following things
  1. What stage of application/Window will be required?
  2. What input will be provided?
  3. Each key word will provide either true or false and base on that Driver script will execute the next step otherwise it will move to next test marking the current test as Failed.
  For Input:

1.       From where we are going to provide input. While deciding this we should take case the person who write test case for execution has manage n provide this input data which should not be any lengthy or complex process.
2.       Expected output day which always depend on our input data so that we have to maintain also. This specially comes in picture when we are dealing with financial or online web application where small input is going to affect many places & we have to verify at the end of test.

Once you identify the keyword we can start development of function/Keyword.  And development of keyword is not dependent on any other keyword which will help to speed up the development. This independency comes only when we identify the keyword properly.

Keyword to Input & Expected Output:

Most of time we maintain keywords/Tests in excel only. So for the test in which we have to provide 2 or 3 value as input data we can put them in column of the excel beside to the keyword only.

But there will be time when you have provide more data around 10 -20 and even every data is not required to that keyword in each test, so for such keyword we can maintain the excel where we can have the unique ID of each test cases. For example

TestCaseID
First Name
Last Name
Class
Contact no
Email
TestCase_001
Sachin
Tendulkar
8
9988998899

TestCase_002
Shewag

6

..

..
.
.
TestCase_025
Zaheer
Khan

9879879899


As you see in this example we can provide input to test as per our requirement and also we can use this same table for expected output. In Blank cell will reflect to keyword that we don’t want to provide this value to test.

Please correct me if I am wrong at any place and feel free ask any query related to QTP or automation framework

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | JCpenney Printable Coupons