QTP 11 checkpoint testing (spreadsheet values) on Windows 7

Once again, our test application :


Again, the test application will be tested for its ability to multiply two numbers.

IMPORTANT : before proceeding with this test, you as assumed to have populated the repository with objects for the buttons ("9", "x", "3", "=") and numeric input field ("result"). For the sake of intuitive understanding, the objects have been renamed here, and are used in the VB script with their associated names.

Testing the Calculator application is done with the following VB script :

SystemUtil.Run "Calc","", "c:\Documents and settings\ejer",""
Window("Calculator").static("result").Type "9"
Window("Calculator").WinButton("x").Click
Window("Calculator").static("result").Type "3"
Window("Calculator").WinButton("=").Click
Window("Calculator").Static("result").Check CheckPoint("check9x3")


A checkpoint is introduced as explained in the previous text. In order not to check a fixed value of "27" but rather one specified in a spreadsheet, the checkpoint is edited using the registry editor, to use a "Parameter" from the spreadsheet. The column could have many other names than "A" but this is selected in this scaled-down example here.




Proceeeding to run the test, it will be noticed that the value from the spreadsheet is used during the actual test as outlined in with the red lines in the following illustration. Test completes successfully.







in the negated example (with incorrect expected value), proceeeding to run the test, it will be noticed that the value from the spreadsheet is used during the actual test as outlined in with the red lines in the following illustration. Test fails as expected.







Eter formula in spread sheet :

C1 = A1 * B1

And put values into A1, B1. Then apply piece of VB code :


SystemUtil.Run "Calc","", "c:\Documents and settings\ejer",""
Window("Calculator").static("result").Type DataTable("A", dtGlobalSheet)
Window("Calculator").WinButton("x").Click
Window("Calculator").static("result").Type DataTable("B", dtGlobalSheet)
Window("Calculator").WinButton("=").Click
Window("Calculator").Static("result").Check CheckPoint("check9x3")



It will be noticed how the test completes using only values from the spreadsheet. In this way, a number of calculations may be tested in a loop, ensuring a greater degree of tested accuracy for the tested application.




This completes testing QTP with checkpoints, using spreadsheet values.

Using ODBC drivers, it is possible to test using values stored in a database. This may also be configured in the registry editor at the checkpoint setup.