Tuesday, November 6, 2012

Parameterization in QTP

When I need to test multiple set of data for the same functionality how will I do this?

QTP has a concept called Parameterization which will handle these situations. In general parameterization means replacing the hard coded value by a variable or parameter which holds data or multiple data. In simple words giving multiple inputs to the test (i.e. Test script). The main use of parameterization is re usability of the test script. Parameterization can also be done through looping statement (which I will discuss later). In other words QTP enables to expand the scope of a basic test by replacing fixed values with parameters. This process, known as parameterization, greatly increases the power and flexibility of test.

Why and When to use Parameterization in QTP?

- As discussed earlier, when I need to test same functionality for different set of inputs I will go for parameter. For example: In any on-line shopping site buyer, seller, dealer and other users will have their own access and responsibility to the site. I can verify how the functionality works for all the different users.
- Working with Common parameters across Scripts like URL, Result Folder, etc...
- When I have N numbers of inputs for a particular functionality or action I can go for parameterization, Once I was working for performance testing for one of my client, where I need to change the password (as the password expires every 90 days in my case) I had around 500+ user who needs to be updated, do you think for this I should go for 500+ times scripting or I can create one Test (script) and parameterize that?
These are very few real time examples where parameterization can be used. 

Types of Parameterization in QTP:

QTP has its own four ways to do parameterization

1. Datatable
2. Environment Variable
3. Test/Action Parameters
4. Random Numbers

We will see how these types will be used in which situation/scenarios in details.