=> Proceed Here For The QTP Instructional Tutorials Series
What does Test Automation Framework and QTP Framework mean?
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
In the context of a successful deployment of QTP for a software testing venture, we frequently encounter the notion of frameworks. The architecture is essentially a strategy that we uniformly adhere to during the automation process – a set of rules.
What You Will Acquire:
Test Automation Frameworks
Personally, I’m not inclined to assign labels and claim that one outperforms the other. The selection of a given structure does not mark the inception of a project. The contrary happens to be the case. While formulating a testing strategy, you establish the principles which are relevant to the tester’s present state of affairs, and that would be your structure.
Having mentioned that, these key points are important to bear in mind:
- Reusability
- Ease of script upkeep
- Clarity of scripts
- Efficient organization of test assets in folders.
- Avoidance of hardcoded values
- Avoidance of cascading failures (meaning, if one test fails, it should not trigger the failure or stopping of others).
This is a rudimentary list, and can be expanded upon based on the requirement.
Any testing approach that incorporates some or all of the above points is part of your Test Automation Framework.
There are a multitude of frameworks, each designated with a unique name. Below is a compilation of these frameworks to the best of my knowledge.
Varieties of Automation Architectures (Pertains to QTP Structure)
- Linear: The most uncomplicated form of devising a test. A single program design involving step-by-step sequences without the presence of modularity.
- Keyword-driven: A method involving the assignment of various keywords for different operations. These keywords are then referred to in the main script.
- Data-driven: A method that executes the same operations on different datasets. These data are usually stored separately, predominantly in excel files.
- Hybrid: A framework that incorporates elements of both data-driven and keyword-driven methodologies.
- BPT: This design involves breaking down the packages into business components which can be used in conjunction with other types of frameworks
Linear Framework
As implied earlier, the linear approach simply entails continuously writing code as it’s recorded.
For instance, if the operation that one needs to verify is the creation of a new account in Gmail, the following would be the procedure:
- Access gmail.com
- Select “Create Account”
- Input the necessary details
- Ensure the accuracy of these details
- Establish an account
'Launch GMail SystemUtil.Run “iexplore.exe”, “http://www.gmail.com” 'Coordinate webpage Browser(“Gmail”).Page(“Gmail”).Sync ‘Click on create account Browser(“Gmail”).Page(“Gmail”).WebLink(“Create Account”).Click ‘Provide relevant details Browser(“Gmail”).Page(“Google Accounts”).WebEdit(“First Name”).Set “Swati” Browser(“Gmail”).Page(“Google Accounts”).WebEdit(“Last Name”).Set “test” ‘Fill in additional details ‘Submit Browser(“Gmail”).Page(“Google Accounts”).WebButton(“Next Step”).click
The above serves as an example of what a linear-based program looks like. It is evident to discern the advantage and disadvantages of this method at this stage.
Advantages:
- Simplicity: For those new to programming, this methodology is suitable.
- Time Efficiency: The test can be created in a short amount of time.
- Minimal planning is necessary
Disadvantages:
- The code cannot be reused.
- If one needs to verify a specific aspect of the ‘Google Accounts’ Page, they would have to rewrite the code to launch the gmail.com page, thereby resulting in unnecessary repetition.
- All the information is directly embedded in the code. Hardcoding prevents the code from being utilized for other datasets.
- Code is susceptible to errors and is difficult to maintain
Despite the drawbacks outweighing the benefits, this method can be useful when your aim is to carry out a task without validations.
The components of test assets in this type of architecture encompass:
- Test script
- Object repositories (This can be avoided by using descriptive programming if required)
Keyword-Driven Framework
How do we enhance the linear framework test we previously discussed? How can we circumvent these drawbacks?
Obviously, we require reusability, modularity, and clarity. Making an effort to integrate these elements and arriving at a well-rounded solution is tantamount to devising a new, upgraded framework.
What components can be reused?
- Launching Gmail and accessing the ‘Google Accounts’ page. This action must be executed before validating this page. ‘GoTo Google Account” can be transformed into a separate function that can be invoked repeatedly.
- Input and validation of details. You can further segment this into positive and negative blocks for more modularity.
- Creation of an account. This is the final validation step and the task at hand.
Once this point has been reached, not only have the reusable components been identified, but the linear program has also been diversified into modules.
Functions:
We haven’t addressed functions in our series up to this point. A function is a segment of the code that executes certain operations. It accepts input parameters from the program that is calling it and returns a value in response.
As a conventional practice, all the reusable segments of the code are consolidated into a file that compiles all the reusable functions. This file functions as a resource for your QTP test. An operation library typically bears the file extension: .vbs, .txt or .qfl
Returning to our example, an operation library file might look something like this:
Function gotoGoogleAccount() 'Launch Gmail SystemUtil.Run “iexplore.exe”, “http://www.gmail.com” 'Coordinate webpage Browser(“Gmail”).Page(“Gmail”).Sync ‘Select create account Browser(“Gmail”).Page(“Gmail”).WebLink(“Create Account”).Click ‘Provide relevant details End Function Function EnterDetails() Browser(“Gmail”).Page(“Google Accounts”).WebEdit(“First Name”).Set “Swati” Browser(“Gmail”).Page(“Google Accounts”).WebEdit(“Last Name”).Set “test” ‘Fill in additional details End Function Function SubmitToCreate() ‘Submit Browser(“Gmail”.Page(“Google Accounts”).WebButton(“Next Step”).click End Function
Your Actual script will probably be:
'Launch GMail gotoGoogleAccount() ‘Provide relevant details EnterDetails() ‘Submit SubmitToCreate()
From the above, it is clear that we have achieved clarity, modularity and given another program the capability to utilize the login function, it can perfectly be reused. All that’s required is associating the function library with the new test.
You can also observe that in your script, the function names serve as VBScript’s keywords, hence the name of this framework.
The components of test assets in this type of architecture encompass:
- Test scripts
- Shared OR
- Shared function library
What else could enhance this program? If we could allow the EnterDetails() function to accept different datasets and create different accounts, without being constrained by the data hardcoded into the program. This is exactly the subsequent step: Data driving your test and the approach to this is known as a data-driven framework.
We will discuss Data-Driven and Hybrid architectures in detail in the upcoming guide.
=> Proceed Here For The QTP Training Tutorials Series
If there are any QTP framework-related issues that haven’t been addressed in these articles, please inform us and we will definitely attempt to provide solutions to your queries.