HP QuickTest Professional Tips ‘n’ Tricks – July ’08 Part II
Posted by: Sentinel627
Args(“maties”)! More tricky bits for ye!
Sorry, I just HAD to say that! But it does make a point: not everything works quite as you might expect in QuickTest Pro.
Using Parameters with QTP Scripts
Parameters can be predefined for a QTP Action script, under File –> Settings –> Test Settings, Parameters tab.

These parameters can then be populated manually, or from Quality Center Test Lab at runtime.
An important note: using the QTP ‘Parameter()’ property described in the user guide does not always work (this is an HP Mercury bug)! As a workaround, use ‘TestArgs()’.
For example:
If Trim(TestArgs(“Workbook”))”" Then
DriverWorkbook = TestArgs(“Workbook”)
End If
If you are not executing a script from Quality Center, the values of any parameters can be changed manually before execution:

In this example, fill in a Value for ‘Workbook’:

As described above, you can now use TestArgs(“Workbook”) to refer to this value at any point during script execution.
All right, me hearties! Shiver your timbers! Get out there, ye auto-”maties”!
I can be such a dork.





