QTP – Accessing Test Parameters

Working with QTP often involves using Test and Action Parameters to pass changing variables to and from the whole test or it’s nested actions.

They simply differ in the scope to be used:

  • Test Parameters: GLOBAL, can be passed or retrieved from outside the test (e.g. setting parameters from QualityCenter TestLab depending on Test Configuration)
  • Action Parameters: LOCAL, can only be passed to or retrieved from the defining action.

Using global parameters is quite a nice feature, however by following instructions of the QTP help file you will need to pass these parameters on to every action where you want them to be used. That is not exactly my idea of „global parameter“. For instance, if you wanted to change a tiny bit, chances are that you will need to touch each and every calling action.

For that reason, I have always thought „There must be a more straightforward way“. Good news, everyone! There is a much easier way! Unfortunately, however, it is not documented in the QTP help file.

By just placing the following line of code in any of your actions, you will have direct access to the Test Parameter value:


Using this simple piece of script made my life much easier when dealing with global Test Parameter values in every action – even in nested ones. Hooray!