12.4. Inserting a Verification Point

Now we want to test that the currency converter application converted our input (10) correctly to US dollars and Yens. Squish allows you to insert verification points interactively. For this, you have to run the test until the state you want to test. Then you can choose the widgets and their properties you want to test.

In our case we want to run the test until line 12, that is until we accepted the input, but before we close the windows. So we place a breakpoint on the line

    sendEvent("QCloseEvent", ":Edit.screen..")

You do this by clicking in the editor on the area showing the line number. The result should look like:

If you play back the script, it is executed until it hits the line with the breakpoint and the Squish IDE shows up with all controls again. The current script line is highlighted in the editor and the lower half of the editor shows the variable watcher. The variable watcher allows you to inspect the variables of your script - this is useful if you have to debug a test script. But for our case of inserting a verfication point, we have to start the Spy instead. You can use the Spy to inspect the objects of your application (address the objects by point and click rather than using the object name and inspect all properties of the objects that are accessible to Squish).

Start the Spy by clicking on the corresponding button () in the toolbar. After a short moment Squish replaces the variable watcher with the spy window. Here you can either select an object by choosing it from the tree view or by using the object picker. If you want to access a visible object it is usually much easier to use the object picker.

Start the object picking by clicking the picker icon () from the toolbar. The Squish IDE goes into mini-mode again and you can select the object you want to access with simple point and click: Squish draws a red frame around the object it finds under the cursor. If you click, it selects the object, the Squish IDE leaves the mini-mode and shows the selectd object in the Spy:

In the above example we picked the line edit that displays the value in US dollars. Since we want to verify that the value displayed is 12.00 check the checkbox of the line edit object. The Squish IDE automatically checks the text property of the line edit as well. This is done for convenience: Squish checks the common properties by default (i.e. that one that a user is most likely intrested in testing for a certain object type).

You can check additonal properties and uncheck those you are not intrested in. In our small example however, we only want to check the text property. So we don't have to do anything else.

So we selected the object we want to verify and the properties of the object we want to verify. Now we just have to choose a name for the verification point and then we can add the verification point to the script: change the text VP1 in the Verification Point line edit to VP_usd and press the green check mark icon to add the verifcation point to the script.

For the line edit dislaying the value in Yens, we do the same procedure to add a second verification point:

Now we have all verification points we need and we can stop the test execution. So select Test Suite|Stop from the menu. If you now take a closer look at the script you see that Squish added two lines:

    test.vp("VP_usd")
    test.vp("VP_yen")

These are the two verification point tests we just added. So now we want to run our test with the verification points. First remove the breakpoint by clicking on it and press the play button (). Squish replays the test again, but this time when the test is finished you can see two additional messages in the Test Log view about the verification points that passed.

If you want to take a closer look at the verification point itself, you can open it in the tree: first you have to open the tst_eur_conversion entry in the tree and then open the verificationPoints entry below it. If you click on one of the two verification point, the editor shows what the verification point actually tests and you can change the values.

If you change the value of the VP_usd verification point to 13.00 and run the test again, you get one fail and one pass as the test result.

See How to Create and Use Verification Points (Section 14.20) for more details on this topic.