With the Ranorex Applitools Eyes integration, you can create and run visual validation tests directly in Ranorex Studio. This article explains how to prepare your test suite, add visual checks, and run tests with Applitools Eyes.
Run your test
You can run tests with Applitools Eyes visual checks the same way as any other Ranorex test. To run your test, click Run in the test suite view. During test execution, Ranorex uploads the required image data for each visual check to Applitools Eyes. Applitools Eyes then analyzes the visual check and returns the result to Ranorex.
Run your test from the command line
You can also run your test from the command line. All global parameters defined for the Applitools Eyes integration can be passed as command-line parameters, e.g.:
ApplitoolsIntegration.exe -param:viewPortHeight=1080 -param:viewPortWidth=1920Prepare the test suite
Before you add visual checks, prepare your test suite for Applitools Eyes.
- In the Test Suite view, right-click the test suite and click Add setup.
- Right-click the test suite again and click Add teardown.
- In the Module Browser, drag InitializeEyes to the setup region.
- Drag FinalizeEyes 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 use an on-premises Applitools installation, enter the server URL in ServerURL.
Optionally configure any additional parameters you want to use.
Parameter Description 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.
Add visual checks to your test
After the test suite is prepared, you can build your test as usual and add visual checks in recording modules by using Applitools Eyes user code methods.
To add a visual check:
- 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
In addition to VisualCheckpoint, the Applitools Eyes integration provides other user code methods that let you set Applitools parameters at runtime. These runtime values override the global parameters configured in the test suite.
To add another Applitools user code method:
Open the recording where you want to add the method.
- In the action table, click Add new action > User code > Select from library.
Double-click the user code method you want to use.
- In the action table, enter the required argument value.
PDF and image file checks
The Applitools Eyes integration can also be used to perform visual regression checks on PDF files and image files.
For this scenario, use the dedicated user code method:
VisualCheckpoint(String fileORFolderPath)
To add a PDF or image file check:
- Open the recording where you want to add the file check.
- In the action table, click Add new action > User code > Select from library.
- Double-click VisualCheckpoint(String fileORFolderPath).
- In the action table, enter the path to the file or folder you want to check.
The following path formats are supported:
- Absolute path
Example for a file:C:\Users\User\Documents\MyPDF.pdf
Example for a folder:C:\Users\User\Documents - Relative path
Example for a file:MyPDF.pdf
Example for a folder:Documents
Relative paths only work for files and folders located in the same directory as the test executable.