How can I create screenshots of my client application with QF-Test?

QF-Test only provides on-board means to write screenshots of a client application to the test-run log. This can be done via the “Message” node or the procedure qfs.run-log.screenshots.logScreenshot from the qfs.qft standard library.

Save screenshots to a file

Sometimes you don’t want to store a screenshot in the test-run log but use it for other things and store it in a directory first. This is of course also possible with QF-Test, but it requires a script – but just a very small one:

from imagewrapper import ImageWrapper
from java.io import File
screenshot = ImageWrapper(rc).grabImage(rc.getComponent("#Window:"))
screenshot.writeToFile(File(str(rc.groups.qftest.suite.dir) + "/screenshot.png"))

This Jython SUT script uses the exact same mechanism to create screenshots that is used for the test run log.

rc.groups.qftest.suite.dir is a useful shortcut to get the directory of the current test suite. You can of course also call writeToFile() with any other path. "#Window:" is a SmartID and stands for the first window of your application. You can also specify a more specific component here to take a screenshot of a specific part of the application UI.

You can read more about the ImageWrapper class in the QF-Test manual: The ImageWrapper class.

We use "Matomo" cookies to anonymously evaluate your visit to our website. For this we need your consent, which is valid for twelve months.

Cookie Configuration

Functional cookies

We use functional cookies to ensure the basic functionality of the website.

Performance and statistics cookies

We use Matomo for analyzing and optimizing our website. Cookies permit an anonymous collection of information that help us offering you a clear and user-friendly visit of our web pages.

Cookie details
Description Vendor Lifetime Type Purpose
_pk_id Matomo 13 Months HTTP Contains a unique, pseudonymized visitor ID internal to Matomo for recognizing returning visitors.
_pk_ref Matomo 6 Months HTTP Used to track from which website the anonymized user proceeded to our website.
_pk_ses Matomo 1 Day HTTP The Matomo session cookie is used to track the visitor's page requests during the session.
_pk_testcookie Matomo Session HTTP Used to check whether the visitor's browser supports cookies.
_pk_cvar Matomo 30 Minutes HTTP Temporarily store data about the visit.
_pk_hsr Matomo 30 Minutes HTTP Temporarily store data about the visit.