QTP
How to use Functions in QTP/UFT in 3 easy steps
If you have segments of code that you need to use several times in your tests, you may want to...
QTP provides us to pick different test inputs at a run time. This process of providing different input values through external parameters is called as parameterization.
Parameter types can be:
This Micro Focus UFT tutorial demonstrates how to do parameterization to log in successfully to flight reservation application. You may be wondering why take the Herculean effort to automate this simple scenario. We will check that user successfully logs in to the application on inputting valid Agent Name & Password. The need for parameterization becomes obvious if we extend the scope of the scenario to include a Combination of valid ALPHANUMERIC Agent Name & Password. In this case, the Test Steps Will Remain the Same. But we will have more combinations of Data to TEST. In this example, we will restrict to just 3 of possible 8 combinations.
| Test Scenario | Test Steps | Test Data |
|---|---|---|
| Check that user successfully logs in to the application on inputting a COMBINATION OF valid ALPHANUMERIC Agent Name & Password | Step 1) Open Flight Reservation Application Step 2) Enter Valid Agent Name Step 3) Enter Valid Password Step 4) Press Ok Step 5) Close Application After Successful Login. | Agent Name = Guru Password = Mercury Agent Name = gtupapers Password = MERCURY Agent Name = 9999 Password = mercury |
To achieve this, you can either copy the six steps or give different data values that are in fact something you would do manually, or you can use Parametrization.
The easiest way to parameterize an argument, in our case Guru is
Value Configuration Dialog Box Opens. Currently, the value is set to a Constant. Click on Parameter Radio Button. QTP assigns a default name to this parameter. You can give a name of your choice and then click "OK."
In the Global Sheet, a column with Header "Agent Name" and value Guru is created. You can enter more values for this parameter.
When you click on "expert view" you will see that "Agent Name" is replaced by "Guru", and the type of sheet used.
Likewise, you can also parameterize the argument Password and enter different test data sets.
What this Datasheet means is QTP will iterate the same six steps that we have recorded three times. During the first iteration, it will use the data in the first row. During the second it will use the data in the second row and so on. Now let's run the script. This is the first iteration. This is the second iteration. In the status bar, QTP gives information of the row, it is currently using as test data and highlights the corresponding row in the datasheet. The results will show a summary of the 3 iterations.
If you have segments of code that you need to use several times in your tests, you may want to...
What is Action in QTP? Actions help divide your test into "logical units" or "Business Processes". Actions help...
This tutorial demonstrates OBJECT SPY. Object Spy can help determine the useful properties and...
Installing the trial version of HP UFT or QTP from the Micro Focus site is a 2-step process. Part 1)...
What is QTP/UFT? QTP is an automated functional Testing tool that helps testers to execute...
What is Environment Variable? Environment variables are dynamic "object" on a computer that can...