In QTP Keyword Driven Testing versus Recording-Which one to choose
Tests can be created in QTP with the help of Recording or by using Keyword-driven methodology or by a combination of both of them.
Following are some of the situations wherein each one of these approaches are beneficial. Accordingly we can decide as to whether to go in for Keyword-driven testing or recording for our application.
Recording is beneficial especially in situations like:
1) Recording is quite helpful to the beginners. Due to its simplicity, even a novice user is able to understand the mechanism as to how QTP understands various set of operations performed by the user on the application and how it converts them to its objects and its own operations.
2) Not only the beginners, even the advanced users find recording quite beneficial while handling some new features added to an application or managing a new application altogether. With recording we can easily develop functions using built-in keywords of QTP.
3) We can exploit the recording feature of QTP when there is an urgent need for creating some tests aimed at testing some application or its feature especially when there is no necessity of its maintenance on a long-term.
Keyword-driven methodology is advantageous in situations like:
1) Using keyword-driven methodology instead of creating tests at the object level, we can create them at a business level.
For instance, in an application, QTP would recognize a single option selection, as many individual steps like – clicking an object like a button, operation of mouse over a list or input from the keyboard on a sub-item of the list. Here we can easily create a function, with easily identifiable name, which would cover all such operations of lower level clubbed in one keyword at the business-level.
2) With the help of keyword-driven methodology, we can use specialized operations like synchronization statement for higher level keywords, say in a case, where the system is made to wait till the communications of client-server finishes. Such tests become quite easy for execution & interpretation by even less skilled testers & even the maintenance becomes easy when changes take place in the application.
3) We can easily bifurcate test maintenance and resource maintenance with the help of keyword-driven testing. With such a separation, the application testers can lay their focus on the maintenance of design & test structure, while the automation engineers can concentrate on maintenance of functions and objects.
4) We keep on adding new objects in the local object repositories while recording the tests. This way there is great probability that different testers will create their own local object repositories having multiple copies of the same object. The advantage of keyword-driven methodology is that we pick up the desired objects from an already existing object repository for inclusion in our steps. In case of need, we can add any new object to the local object repository on a temporary basis & the same can be transferred to the shared object repository for use later on.
5) During recording a test, the desired objects, methods & arguments are automatically added by QTP. This way QTP helps us in test creation with great ease & with lesser planning & preparations. Though we are able to quickly create tests with this approach, but these tests are cumbersome to maintain in case changes take place in the application. In such case fresh recording of major portions of the test become necessary.
Whereas already existing operation keywords & objects are chosen while using keyword-driven testing. Hence the tester needs to be fully conversant with already available inventory of function libraries as well as object repositories. Moreover the tester is required to have good understanding of his requirements from the test prior to the process of adding steps.
This is the reason that well-planned, nicely structured & easily maintainable tests emerge out of keyword-driven testing.
6) While following keyword-driven methodology, based upon the detailed product specifications, the automation engineers are able to add objects and functions even before the inclusion of a particular feature in the product.
7) By using keyword-driven methodology we can start the development of tests for a new product or its features much earlier in its development cycle.
Conclusion: As compared to recording, the keyword-driven testing is generally more time consuming & resource consuming. However once all the tests for some particular application are created, they can be managed & maintained with more flexibility and efficiency as compared to the recorded tests.
Many More articles on Test Automation Frameworks
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.