Article - Creating screenshot verification points for volatile objects (QMenu, QAction, Qt)

Skip to end of metadata
Go to start of metadata

Table of Contents

Overview

Because picking volatile objects is not yet possible with Squish for Qt, creating verification points requires additional steps.

Creating a screenshot verification point for such an object can still be achieved if the respective QMenu and QAction appear in the Application Objects view once your application is in the desired state.

(If these objects are not visible in the Application Objects view, consider Article - Picking and inspecting objects#Article-Pickingandinspectingobjects-Howtopickmenusandothervolatileobjects instead.)

To check this please do the following:

  • Set a breakpoint where you want create this screenshot verification.
  • Execute to the breakpoint.
  • Look in the "Application Objects" view for objects of type "QMenu" on the first level.
  • If you can find the desired QMenu, expand its node and check if you can find the respective sub- and sub-sub (etc.) menus As QActions or QWidgets (or other types).

If you manage to find the respective entry, do the following to create a screenshot verification point:

  • Check the check box of the respective menu node. (Don't worry, the screenshot is expected to be wrong at this point, because the menu is not shown.)
  • Enter the desired screenshot VP name and click the "Insert" button.
  • Start recording a snippet (Run > Record Snippet).
  • Perform the activation of the respective menu entry, and some entry below it, so that you end up doing a full, finished menu selection.
  • End recording.

The code may now look similar to this:

test.py

In this example, let us assume that "Format" is the menu entry for which we want to check the icon.

  • Change the code so that it opens the parent menu ("Edit") of the desired menu item ("Format") before executing the verification point:
test.py
  • Execute the test script. (We assume the screenshot VP to fail, because the initial screenshot that we took is still bogus.)
  • In the "Test Results" find the "Fail" for the screenshot VP, right click on it and choose "Use As Expected Result".

Using masks or different comparison modes

If you want to apply a mask or different mode to screenshot verification points you can do so like this:

  • In the IDE view "Test Suites" under "Test Case Resources" click on the tab "VPs" and doubleclick the screenshot verification point ("SVP1").
  • Click on the right most tool bar icon (tooltip "Edit Verification Point") in the VP editor.
  • In the upcoming dialog click on the second icon from the top on the right (under "Mask Tools", tooltip "Add Positive Mask"), then click and drag the mouse over the area of the screenshot that you want to have verified (basically the icon, leaving out the text).
  • Click on "Save".
Labels:
menu menu Delete
volatile volatile Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.