In this chapter, learn about running and creating Applitools Eyes tests in Ranorex Studio.
Run your test
You can run your tests with Applitools Eyes visual checks just like any other test.
Click RUN in the test suite view. During the test run, Ranorex uploads the required image for each visual check to Applitools Eyes. Eyes then passes the results of the check back to Ranorex.
Command line
You can also run your test from the command line. You can pass all global parameters that you’ve defined as explained in Create tests, e.g. ApplitoolsIntegration.exe -param:viewPortHeight=1080 -param:viewPortWidth=1920
Create tests
In this chapter learn how to create tests using the Applitools Eyes integration in Ranorex Studio.
Prepare the test suite
-
In the test suite view, right-click the test suite and click Add setup. Repeat for Add teardown.
-
From the module browser, drag and drop the InitializeEyes code module to the setup region and the FinalizeEyes module to the teardown region.
-
Right-click the test suite and click Global parameters…
-
In the dialog that appears, click Auto-create and Auto-bind.
-
Next to EyesApiKey, enter your Applitools Eyes API key. If you’re using an on-premise installation, enter the URL to the server in ServerURL. You can also define other parameters here, but they are optional. See below for an explanation of what they do.
- AppName: Enter the name you want the test to be saved under in the Apps & tests category in Eyes.
- EyesBatchId: Enter the ID of a test batch to always pass results to this batch.
- ViewPortWidth: Define a custom width in pixels for the Applitools Eyes viewport.
- ViewPortHeight: Define a custom height in pixels for the Applitools Eyes viewport.
- MatchLevel: Define the match level that will be used. Possible values: Exact, Strict, Layout, Content. The default is Strict.
Build your test
You can now build your test as usual and add visual checks by Applitools Eyes to it. This is done in recording modules through user code methods.
-
Open the recording you want to add a visual check to.
-
Drag and drop the repository item you want to check from the repository to the desired position in the action table.
-
In the context menu that appears, click User code > Select from library.
-
Double-click the VisualCheckpoint method.
Other Applitools user code methods
Aside from VisualCheckpoint, there are several more user code methods you can add to a recording module. Use them to pass custom Applitools Eyes parameters at runtime. These will overrule the global parameters you’ve set. Refer to the descriptions in Ranorex to see what they do. To add them:
-
Open the recording you want to add the method to.
-
In the action table, click Add new action > User code > Select from library.
-
Double-click the desired user code method.
-
In the action table, enter your value for the required argument.
PDF and image file checks
You can also use the Applitools Eyes integration to perform visual regression tests on PDF and image files. There is a special user code method for this purpose.
-
Open the recording you want to add a file check to.
-
In the action table, click Add new action > User code > Select from library.
-
Double-click VisualCheckpoint(String fileORFolderPath).
-
In the action table, enter the value that points to the file or folder you want to check. The following formats are possible:
- Absolute, e.g.
C:usersuserdocumentsMyPDF.pdf
for a single file orC:usersuserdocuments
for an entire folder. - Relative, e.g.
MyPDF.pdf
for a single file ordocuments
for an entire folder. Relative paths only work for files and folders in the same location as the test executable.