Avatar of Yann Spöri
Author: Yann Spöri
29. July 2021

Creating screenshots with QF-Test

After the execution you can find the screenshot in the corresponding runlog.

It is also possible to save the screenshot on the hard drive. A Jython Server / SUT script with the following content helps here:

from imagewrapper import ImageWrapper
iw = ImageWrapper(rc)
screenshot = iw.grabScreenshot()
iw.savePng(r"C:/temp/foo.png", screenshot)

It is relatively easy to take a screenshot of the complete picture with the help of QF-Test. For example, to create a screenshot of the current desktop, only the procedure logScreenshot must be called. (The following blog article explains how to insert a procedure call.)

It should be noted that screenshots can consume a lot of storage space. In this respect, a screenshot should not necessarily be created after each step - even if this is relatively easy to do. (With the help of a Testrunlistener)

In practice the whole thing looks like this:

New comment
( Will be displayed on the page )
( Will not be displayed on the page )