Saturday, November 24, 2007

Parameterize a Checkpoint

You can create a Checkpoint while recording or editing a test. For this tutorial I will take into account Text Checkpoint created through Standard Checkpoint while editing.

Open a new test.

Click on Record.

Go to Start-> All Programs->QuickTest Professional->Sample Applications->Flight.

Enter the Agent Name as "Sachin" and Password as "mercury". Make sure you use Tab key to move from one text box to another and hit Return (Enter) key after entering the Password.

When the Flight Reservation window is open Go to File (menu)->Exit.

Click on Stop in order to stop the recording.

In the Keyword view go to the row which has "Sachin" under Value column. Right-click anywhere on that row and choose "Insert Standard Checkpoint."

"Checkpoint Properties" window opens. Make sure only the Text property is checked which has a value of "Sachin" and rest all of the properties must be unchecked.

Just make a single click on Text Property, which you checked above, in order to highlight it and make "Configure Value" area enabled.

In this area click on Parameter Radio button. This is all we need to do.

[On the right hand side of Parameter Radio button you will see Parameter Options button (which has paper and pen image on it). you can click on it to see the default values QTP has set for us.]

In the "Checkpoint Properties" window just click on Ok to come out of it.

It will add a column in the Global Data Sheet with "Sachin" as its first value.

Add two more values in the subsequent rows. I added "aaaa" in the 2nd and "bbbb" in the 3rd.

Now when we run the test and it opens the window where we need to enter the Agent Name and Password, you have to enter Agent Name all of the 3 times (Just enter the Agent Name, that's it, no Tab key or Return key). Make sure you enter "Sachin" during first time, "aaaa" during second time and so on. We don't need to enter the Password. Remember this is a Text Checkpoint on the "Agent Name" Text field. Any value entered there first time will be compared by first row of the Global Data Sheet which has "Sachin" and any value entered there Second time will be compared by second row of the Global Data Sheet which has "aaaa" and so on. Just try to enter some other value during second time like "xxxx" it will run the test but show you "Failed" in the Results window in the second iteration.