The overall idea behind the Keyword Driven Framework is to utilize manual testers to write automation scripts. Given the fact that keywords are so closely resembled a manual test procedure, it becomes simpler to trace actions in automated tests to actions in manual tests. Working with keywords data tables for everyday application automation is a lot less technical than working with code statements. Therefore individuals that are not as technical can be brought onto the team to help in creating automated tests.
But in order to effectively implement a Keyword framework, reliance on intuition must be reduced, while reliance on standards must be increased. While some standards are automatically imposed, with this type of framework, many standards are not, so there’s an ongoing effort to ensure resources are aware of standards, understand them, and are able to effectively implement them.
So the best practice in Keyword Driven framework is to impose the standards automatically, so that the gap of discrepancy can be reduced. Let me take an example and explain it to you. There is a page object called 'txtbx_UserName' which represent the Username text box in the application. To effectively use it in the keyword driven framework, we write the same name in the data engine sheet. When execution engine reads 'txtbx_UserName', it knows which object to point from the Object Repository property file. But this 'txtbx_UserName' is case sensitive, any spelling error in this like 'txtbox_UserName' would result in an exception.
One of the drawback of the Keyword framework is that it is developed by different set of people who are more technical and it is used by different set of people who are not very technical, so there is always a gap. To finish the gap, it is better to impose standards. Means if we can force data engine sheet in a way, so that the user would not be able to enter any invalid object, which result in to exceptions.
One more example will explain the situation logically. As we know that there are many 'continue' buttons on any e-commerce application. Actually almost on every page of an e-commerce application you would find a 'continue' button. Now as a user of keyword framework, it is difficult to identify the right 'continue' button he/she would require to click. And it is not the best practice to name 'continue' button like 'continue_1' & 'continue_2', even in this case it would be confusing because the user has not developed the framework.
This chapter will allow you to avoid any such situations where a user can make mistakes unknowingly.
Step 1: Set up Page Object Model for Keyword Framework
-
Create an extra sheet in the same data engine excel sheet and name is as 'Settings'.
-
Name the first column as 'Page Name' and mention all the pages of the application under it.
- Now create new columns for the objects of each Page in the application.
- Mention all the page objects under the respective page name columns.
- Create a new column and name it as 'Action Keywords' and mention all the action keywords under it.
- Select the range of Page Name column and name the range as 'Page_Name'.
- Select the range of Home Page objects and name the range as 'Home_Page'.
- Do the above steps for LogIn Page objects & Action Keywords also.
Step 2: Set up Excel Trick for Application Pages
- Create a new column in 'Test Steps' sheet before the 'Page Object' column and name it as 'Page Name'.
- Select the range of the column 'Page Name', go to 'Data' tab and then click on 'Data Validation' drop down and select 'DataValidation'.
- Select 'List' from the Allow drop down and enter '=Page_Name' in the Source text box.
Now if you see that when you click on any row of column 'Page Name', you would get a drop down list populating all the page name available in the application. This will ensure that the user would not be able to make any choice which can not be handled with the framework.
- Do the same for Action Keywords as well and it will display all the actions available to use.
Step 3: Set up Excel trick for Page Objects
1) Select the range of the column 'Page Object', go to 'Data' tab and then click on 'Data Validation' drop down and select 'Data Validation'.
2) Select 'List' from the Allow drop down and enter '=INDIRECT(D2)' in the Source text box.
Click 'Yes' and move forward.
Now if you see that when you click on any row of column 'Page Objects', you would get a drop down list populating all the page objects available in the particular page. This will ensure that the user would not be able to make any choice which can not be handled with the framework.User is now bound to choose the right object.
Note: If in case you face any issue in setting up this data trick, you follow this link: http://www.contextures.com/xlDataVal02.html