A framework is defined as a broad overview, guideline, or skeleton of the interlinked components, which supports a particular approach to a specific objective, and serves as a guide that can be enhanced as required by adding or deleting components. A framework is a working or conceptual model that supports or provides guidelines for creating or expanding the test scripts to achieve the test automation, ensuring lower maintenance and easy expandability.
A test automation framework is a layered structure and provides the mechanism to interrelate and interact with each other to achieve the common goals. Frameworks also include actual programs and interfaces or offer utility tools for using the frameworks. A framework facilitates a standard way for modifying, adding, and deleting the scripts and functions. It's a comprehensive structure that provides scalability and reliability with less efforts.
Automation goals can be achieved by selecting the right framework that is suitable for test automation. The cost of test automation includes both development and maintenance efforts. Selecting the suitable framework and techniques helps in maintaining the lower cost and high impact solution.
In general, various structures and techniques are used to design the framework. Broadly based on these techniques and structures, we can classify the framework as follows:
Recording is the process of capturing an object and its properties, creating the test objects, and storing them in the Object Repository with hierarchy. Assign a logical name to the test object and create the scripts by capturing the operation performed on the GUI.
The preceding screenshot shows the AUT, recorded script, and OR. The AUT contains the test objects. OR stores the test objects in an hierarchy and with their identification properties:
The recorded scripts take us through the following three test steps:
ashish
in the Agent Name textbox.A test step contains test objects with hierarchy, operation, and data value (if applicable) for the test object. While recording the user action on AUT, OR creation and scripts generation almost happen simultaneously. This approach is also called the QTP linear framework approach. In the linear framework approach, scripts are recorded in a step-by-step fashion without focusing on reusability. Consider an example where you have a test case to log in to an application, search for some data and then log out. In the linear framework, the code would look like something shown in the following example:
Steps for creating the QTP linear framework:
'Login Dialog("DialogLogin").Activate Dialog("DialogLogin").WinEdit("EditAgentName:").Set "ashish" 'Enter the agent name Dialog("DialogLogin").WinEdit("EditPassword:").SetSecure "51e6911da82a99155f73b209eaeac51a66ef0883" ' Enter password 'Create Order Window("WinFlight").Activate Window("WinFlight").ActiveX("MaskEdBox").Type "111114" 'Enter Flight Date Window("WinFlight").WinComboBox("FlyFrom").Select "London" ' Select Source Window("WinFlight").WinComboBox("Fly To:").Select "Frankfurt" 'Select destination Window("WinFlight").WinButton("btnFLIGHT").Click 'Click on flight button Window("WinFlight").Dialog("FlightTable").WinButton("btnOK").Click 'Click on the OK button Window("WinFlight").WinEdit("EditName:").Set "Mr. James Anderson" 'Enter the passenger name Window("WinFlight").WinButton("btnInsertOrder").Click'Click on the Insert Order button Window("WinFlight").Activate Window("WinFlight").Close'Click on the close button
This is the simplest way to create scripts and use and implement them if the AUT is small, but do not expect frequent changes in AUT. The normal record and playback falls under this framework.
The advantages of linear framework are stated as follows:
The disadvantages of linear framework are stated as follows:
3.147.76.89