At the end of each test, TestResultHandler 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.
Please visit the TestResultHandler Github page
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);
testResultHandler= ApplitoolsTestResultHandler.New(results,viewKey)
Python
testResults = eyes.close(False)
test_result_handler = ApplitoolsTestResultsHandler.ApplitoolsTestResultsHandler(testResults, "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 TestResuletHandler 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
testResultHandler.download_iffs(Path_to_directory);
Python
test_result_handler.download_diffs(Path_to_directory)
Java Script
handler.downloadImages(downloadDir, 'baseline')
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);
Java Script
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
testResultHandler.download_images(Path_to_directory);
Python
test_result_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 for 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 = testResultHandler.calculate_step_results()
Python
steps_results_array = test_result_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.