At the end of each test, the TestResultsHandler allows you to download directly from the SDK the following :
(i) the test baseline images,
(ii) the actual images, and
(iii) images with the differences highlighted.
Download one of the following repositories and add TestResultsHander class to your project according to the SDK you are working with:
Java TestResultsHandler Github Repo
C# TestResultsHandler Github Repo
Javascript TestResultsHandler Github Repo
Python TestResultsHandler Github Repo
Ruby TestResultsHandler Github Repo
Java
TestResults testResult= eyes.close(false);
ApplitoolsTestResultsHandler testResultHandler= new ApplitoolsTestResultsHandler(testResult,viewKey);
Note: The following dependency needs to be added to your pom.xml file:
<dependency
>
<groupId
>org.json</groupId
>
<artifactId
>org.json</artifactId
>
<version>RELEASE</version>
</dependency
>
.NET
TestResults results = eyes.Close(false);
var testResultHandler = new ApplitoolsTestResultsHandler.ApplitoolsTestResultsHandler ("ViewKey" , results);
Ruby
results= eyes.close(false);
test_results_handler= ApplitoolsTestResultHandler.New(results,viewKey)
Python
test_results = eyes.close(False)
test_results_handler = ApplitoolsTestResultsHandler.ApplitoolsTestResultsHandler(test_results, "ViewKey")
Java Script
let results = await eyes.close(false);
const handler= new ApplitoolsTestResultHandler(results, applitoolsViewKey);
Note: For getting your account View Key please contact Applitools support.
The TestResultsHandler extends the capabilities of TestResult by adding the following methods:
1) downloadDiffs - Downloading the test images with the highlighted detected differences to a given directory. In case of New, Missing or passed step no image will be downloaded.
Java
testResultHandler.downloadDiffs(Path_to_directory);
.NET
testResultHandler.downloadDiffs(Path_to_directory);
Ruby
test_results_handler.download_diffs(Path_to_directory);
Python
test_results_handler.download_diffs(Path_to_directory)
Javascript
handler.downloadImages(downloadDir, 'diff')
Java
testResultHandler.downloadBaselineImages(Path_to_directory);
.NET
testResultHandler.downloadBaselineImages(Path_to_directory);
handler.downloadImages(downloadDir, 'baseline');
3) downloadCurrentImages- Downloading the test current image to a given directory.
Java
testResultHandler.downloadCurrentImages(Path_to_directory);
.NET
testResultHandler.downloadCurrentImages(Path_to_directory);
Javascript
handler.downloadImages(downloadDir, 'current');
4) downloadImages - Downloading the test baseline image and current image to a given directory.
Java
testResultHandler.downloadImages(String Path_to_directory);
.NET
testResultHandler.downloadImages(Path_to_directory);
Ruby
test_results_handler.download_images(Path_to_directory);
Python
test_results_handler.download_images(Path=Path_to_directory)
5) setPathPrefix- Setting this path prefix will determine the structure of the repository for the download images
Java
testResultHandler.setPathPrefixStructure("TestName/AppName/Viewport/hostingOS/hostingApp");
.NET
testResultHandler.setPathPrefixStructure("TestName/AppName/Viewport/hostingOS/hostingApp");
In addition to downloading the images of the test, TestResultHandler also gives access through code to the visually comparison result per step. It returns an array of elements called RESULT_STATUS which can be one of the following four options: PASS, UNRESOLVED, NEW or MISSING
Java
RESULT_STATUS[] stepsResultsArray = testResultHandler.calculateStepResults();
.NET
RESULT_STATUS[] = testResultHandler.calculateStepResults();
steps_results_array = test_results_handler.calculate_step_results()
Python
steps_results_array = test_results_handler.calculate_step_results()
handler.setDirStructure(['myImages', appName]);
* Notice that this method receive an array of strings.
The TestResuletHandler class is currently available in Java, Ruby, .NET and Python, and it will soon be available in other SDK as well.
Further regarding:
# Getting Diff Images Manually.
# Getting Current/Baseline Images Manually.
# Extend API features with EyesUtilities.