Motivation
The verification functions provided by Squish have built-in logging that can be augmented or customized, one of this customizations allows to silence the logging of test.vp() calls.
In Squish the synchronization between the test script and the application is mostly done via the use of the waitForObject() functions. This means that your test script waits for a specific condition, such as an object (a popup for example) to exist, before executing further actions. In some cases a synchronization needs to be made based on the result of e.g. an image verification. We would achieve it by polling the results of a test.vp() call, for example:
# -*- coding: utf-8 -*- def main(): startApplication("MyApplication") while test.vp("MyTest"): continue #following actions
But this has the side-effect of reducing the readability of the test report due to the default logging of each call to test.vp(). Squish provides a setting to silence the logging of any test.vp() call via the testSettings.silentVerifications property.
A simple example
Consider the Qt addressbook application that is shipped with Squish for Qt. It has a status bar that is updated depending on the actions done in the application. When starting, the statusbar shows the “Ready” status for a few seconds before going blank. Let’s suppose we want to start acting on the addressbook only when the “Ready” status disappears. So let’s create a “Screenshot verification point” which passes if “Ready” is displayed:
Now we can create the following script which waits for the “Ready” status to disappear:
# -*- coding: utf-8 -*- def main(): startApplication("addressbook") testSettings.silentVerifications = True keepWaiting = True while keepWaiting: if test.vp("Show 'Ready' status") is False: test.passes("Status 'Ready' no more displayed") keepWaiting = False testSettings.silentVerifications = False clickButton(waitForObject(":Address Book.New_QToolButton"))
By setting silentVerifications to True, this give us a nice test report without the default logging from the test.vp() calls which are done as part of the synchronization:
As contrast, if we’d not switch silentVerifications to True, it would look like this which makes the report hard to read and the whole test to fail.
The post Squish Tip: Silent verifications appeared first on froglogic.