Purpose Generate and compare a series of SAP GUI screenshots
Generating screenshots automatically is useful both for
documentation purposes and for building test tools. Here we describe
how you can run InputScripts which generate a series of screenshots, saving the image files and comparing the newly generated
screenshots with older ones. We automatically produce "delta"
images that show which screen parts have changed.
Given a
stable set of test data such as customer master data, orders,
equipment and so on, you can use this approach to detect any
changes of the visible data or of the screen layout after installing a new
SAP GUI patch, GuiXT version, SAP kernel, SAP application release,
Windows version or after any changes you have made in SAP
customizing.
You may also include your GuiXT scripts in your tests so that you
automatically detect the screens that now look different, due, for
example, to a new SAP field on one of the screens after implementing
a new SAP package.
Remarks The
approach is easy to implement and to use, but
it has its limitations. Please observe:
You need to
carry out the tests with the same SAP theme and font settings. Or
you use separate sets of screenshots for different SAP themes
and font sizes.
When you include "change" transactions, do the reverse
operation in the same InputScript so that you can re-run the
script and obtain the same data.
In some cases the current date is shown on an SAP screen.
Use a GuiXT "del" command for this field so that it will not
appear on the screenshot. Or a "pos" command which moves
the field to a position outside of the visible SAP GUI screen.
When you run a transaction that creates a new object, for
example a new maintenance order, the final SAP message is
different each time you run the script, since the message
contains the new order number. You can simply omit this final
screen in the screenshot generation or you send your own message
without the new document number, using a "message" command in
the script.
When a test script starts, the SAP GUI window is
automatically resized to 1280x1024 so that the generated
screenshots can be compared easily. This window size is
configurable, but if you change it you invalidate previous
screenshots.
The scripts are run in a visible mode. You need to keep your
mouse outside of the SAP GUI window while the script is running,
otherwise small changes in the screenshots will occur, for
example a pushbutton will receive the focus. We could
shift the SAP GUI window to an invisible part of the screen
while the test script is running - in the same way as we change
the window size -, but we do not recommend this since it is
easier to keep the control when you run the scripts and see what
is going on.
User parameters and input in previous screens may lead to
different screen output. We suggest you logon with a special
user with well-defined and stable user parameters.
There is no limitation on the number of steps executed by
the script, but we suggest you keep it below around 20 steps
and cover your transactions and screens by several scripts
instead of a single large one.
Optionally you can implement your own test cockpit,
consisting of one pushbutton for each script and maybe an
overview on previous runs and their results.
There is much room for enhancements, but even a very simple and
easy to implement version with say 12 test scripts can save you a
lot of time.
Prerequisites
GuiXT version 2018 Q2 1 or above
For an easy start copy our framework scripts veriscripts.zip into
your script folder
The "delta" gif generation is performed via the "magick"
imaging tools (open source). You need to install the tools on
the PC where you run the test scripts. They are available free
of charge at
https://www.imagemagick.org/script/download.php
// SAP
Easy Access Screen SAPLSMTR_NAVIGATION.0100 delX[IMAGE_CONTAINER]
Image(9.2,5.4)
(15.7,87.2)"white.res"_ -plain-transparent_ textstring="Please move mouse out of SAP GUI window\nVerification starts" _ textHeight=34 textFont="Tahoma"textColor="RGB(255,128,64)"
Enter"/0"-visiblewait=3000
Screen SAPLSMTR_NAVIGATION.0100
//
resize SAP GUI so that screenshots become comparable
CallVBAsync verify.utilities.sapgui_set_windowsize 1280 1024