Screenshot Verification Command Line Tools

Screenshot Verification Command Line Tools

We are all aware of how to view differences between the screenshot and the failed image when using the IDE to execute your tests. But do you know how to view the differences when using the command prompt to execute the tests or how to extract an image from a Verification Point?
Squish’s vpdiff and the convertvp tools can come in handy in such situations either to debug or to extract information which can be sent to the Squish support team for further investigation when the need arises.

Here is how vpdiff can be invoked from the command prompt to view the differences:

<SQUISH_DIR>/bin/vpdiff vpfile objectName [imagefile] [output [--highlights]]

Where the first parameter is the VP file, the second is the object in the VP file (you will find this inside the VP file against the „object“ parameter) and the third is the path to the failed image.

For example:

C:\Squish\bin>vpdiff "C:\Users\TestSuites\suite_Py_Qt\tst_case11\verificationPoints\VP3" ":Address Book_MainWindow" "C:\Users\TestSuites\suite_Py_Qt\tst_case11\verificationPoints\failedImages\failed_1.png"

When the above command is executed, the Screenshot Verification Point dialog will appear, and the differences of the screenshots will be marked by red borders as shown below:

In case the --highlights option is provided, then an image will be created highlighting the differences.

For example:

C:\Squish\bin>vpdiff "C:\Users\TestSuites\suite_Py_Qt\tst_case11\verificationPoints\VP3" ":Address Book_MainWindow" "C:\Users\TestSuites\suite_Py_Qt\tst_case11\verificationPoints\failedImages\failed_1.png" "diff_img.png" --highlights

The --fromvp option of the convertvp tool can be used to extract an image from the VP file.

<SQUISH_DIR>/bin/convertvp --fromvp vpfile outdir [--export-masks]

For example:

C:\Squish\bin>convertvp --fromvp "C:\Users\TestSuites\suite_Py_Qt\tst_case11\verificationPoints\VP3" "C:\Users\TestSuites\suite_Py_Qt\tst_case11\verificationPoints"

The above command extracts the image in the VP3 file and saves it at the specified path with the name img_1.png.

Similarly, the --tovp option converts screenshots to VPs

<SQUISH_DIR>/bin/convertvp --tovp vpfile image objectname

For example:

C:\Squish\bin>convertvp --tovp "C:\Users\TestSuites\suite_Py_Qt\tst_case11\verificationPoints\VP4" "C:\Users\TestSuites\suite_Py_Qt\tst_case11\verificationPoints\image_1.png" ":Address Book_MainWindow"

The above command will convert the screenshot (image_1.png) to a Verification Point file called VP4.

Neha was born in Kashmir, India and grew up in Kashmir and New Delhi. She did her diploma in computer science at C-DAC (Center of Diploma in Advance Computing), New Delhi, and worked for IBM India as a software developer until she moved to Germany in 2006.

1 Kommentar

Eine Antwort hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.