QTP Framework is a ‘set of guidelines’ which you can follow during scripting to achieve the ‘desired’ results. These set of guidelines can be anything such as -
- coding standards.
- Structure of your data sheets, how your workbooks and the individual sheets in them are grouped.
- what folder structure you will follow to store the test scripts, reusable libraries, object repositories, test run results
- how should test run results be stored and displayed, whether you want to overwrite the test results every time, or you want to save all the test runs separately.
- how different team members should access that shared repositories, libraries and how they should update these
If you follow these guidelines, your scripting work would be done in a consistent manner.
Features of a good automation framework
- To achieve maximum possible re-use.
- The code should be easy to understand and maintain.
- All different components such as test cases, function libraries, object repositories, data sheets, configuration files and test results are stored in separate folders.
- Data parametrization
- Test Results should make sense and should be easy to understand.
- Proper error handling mechanisms should be employed. The framework should have a provision wherein if one test script fails, QTP shouldn’t get stuck there.
Common Components and Workflow of a Keyword Driven Framework
The basic premise of a Keyword Driven Framework is that – you identify some keywords and write associated functions. Below are the components:
- Excel Sheet to Store the Keywords: This is the only extra component that you will find in a Keyword Driven Framework. Once you have identified the required keywords, you can store them in an excel sheet. You would need to write some code that will first open this excel sheet and copy the keywords. Based on the keyword, QTP will call the function associated with it.
- Function Library: In Keyword Driven Framework, function libraries usually play a very important role. You would have to built all the necessary intelligence in the function library so that it can read the excel sheets and call the different functions based on the Keywords.
- Data Sheets: As with the other frameworks, you can use the data sheets to store the test data that will be used in the application.
- Object Repository: Based on the design of your Keyword Driven Framework, you can either use an object repository or completely skip it (if you are using Descriptive Programming approach).
- Test Scripts: Again based on the design of your framework, you can have separate test scripts for each manual test case or a single driver script that will execute all the test cases.
Generic flow of a Keyword Driven Framework :
- Test Script or Driven Script calls the main function library. This function library contains the code that reads the keywords from the excel sheet.
- The function library opens the excel sheet and reads the first keyword associated with the test case. The function library calls the function associated with this keyword.
- The function then performs all the required actions on the application that is being tested.
- Control returns back to main function (in Step 2) which then reads the next keyword. Steps 2 to 4 are repeated till all the keywords associated with a particular test case are called.
No comments:
Post a Comment