Package com.comparizen.client
Class ComparizenClient
java.lang.Object
com.comparizen.client.ComparizenClient
-
Method Summary
Modifier and TypeMethodDescriptioncreateComparison(String testRunId, String name, BufferedImage bufferedImage, ImageType imageType) Adds a new comparison (screenshot) to a test runcreateComparison(String testRunId, String name, BufferedImage bufferedImage, ImageType imageType, ComparisonProperties properties) Adds a new comparison (screenshot) to a test runcreateComparison(String testRunId, String name, Path file) Adds a new comparison (screenshot) to a test runcreateComparison(String testRunId, String name, Path file, ComparisonProperties properties) Adds a new comparison (screenshot) to a test runcreateTestRun(String projectId) Creates a new Comparizen test runcreateTestRun(String projectId, String name) Creates a new Comparizen test runCreates a new Comparizen test runvoidfinalizeTestRun(String testRunId) Finalizes a Comparizen test run.getTestRunStatus(String testRunId) Retrieves a test run's statuswaitUntilTestRunResult(String testRunId, long timeoutMs) Waits until a test run is either finalized or the given timeout is passed.
-
Method Details
-
createTestRun
Creates a new Comparizen test run- Parameters:
projectId- the project's ID where the test run should be created.- Returns:
- the new test run's ID
- Throws:
ComparizenClientException- when the test run could not be created
-
createTestRun
Creates a new Comparizen test run- Parameters:
projectId- the project's ID where the test run should be created.name- a name describing this test run (optional)- Returns:
- the new test run's ID
- Throws:
ComparizenClientException- when the test run could not be created
-
createTestRun
public String createTestRun(String projectId, String name, Map<String, String> customEnvironmentProperties) throws ComparizenClientExceptionCreates a new Comparizen test run- Parameters:
projectId- the project's ID where the test run should be created.name- a name describing this test run (optional)customEnvironmentProperties- custom environment properties, used for integrating Comparizen test results with other systems, like CI-builds.- Returns:
- the new test run's ID
- Throws:
ComparizenClientException- when the test run could not be created
-
finalizeTestRun
Finalizes a Comparizen test run. Finalizing a test run marks the test run as 'completed' and will prevent the test run from accepting new screenshots.- Parameters:
testRunId- the test run's ID- Throws:
ComparizenClientException- when the test run could not be finalized
-
createComparison
public String createComparison(String testRunId, String name, Path file) throws ComparizenClientException Adds a new comparison (screenshot) to a test run- Parameters:
testRunId- the test run's IDname- the name of the screenshot. This screenshot will be compared to a screenshot from the testrun project's baseline with the same name.file- path to the screenshot file- Returns:
- the ID of the newly created comparison
- Throws:
ComparizenClientException- when something went wrong while uploading the screenshot or creating the comparison
-
createComparison
public String createComparison(String testRunId, String name, BufferedImage bufferedImage, ImageType imageType) throws ComparizenClientException Adds a new comparison (screenshot) to a test run- Parameters:
testRunId- the test run's IDname- the name of the screenshot. This screenshot will be compared to a screenshot from the testrun project's baseline with the same name.bufferedImage- A BufferedImage containing image dataimageType- an ImageType.- Returns:
- the ID of the newly created comparison
- Throws:
ComparizenClientException- when something went wrong while uploading the screenshot or creating the comparison
-
createComparison
public String createComparison(String testRunId, String name, Path file, ComparisonProperties properties) throws ComparizenClientException Adds a new comparison (screenshot) to a test run- Parameters:
testRunId- the test run's IDname- the name of the screenshot. This screenshot will be compared to a screenshot from the testrun project's baseline with the same name.file- path to the screenshot fileproperties- additional properties for this comparison, such as tag names.- Returns:
- the ID of the newly created comparison
- Throws:
ComparizenClientException- when something went wrong while uploading the screenshot or creating the comparison
-
createComparison
public String createComparison(String testRunId, String name, BufferedImage bufferedImage, ImageType imageType, ComparisonProperties properties) throws ComparizenClientException Adds a new comparison (screenshot) to a test run- Parameters:
testRunId- the test run's IDname- the name of the screenshot. This screenshot will be compared to a screenshot from the testrun project's baseline with the same name.bufferedImage- A BufferedImage containing image dataimageType- an ImageType.properties- additional properties for this comparison, such as tag names.- Returns:
- the ID of the newly created comparison
- Throws:
ComparizenClientException- when something went wrong while uploading the screenshot or creating the comparison
-
getTestRunStatus
Retrieves a test run's status- Parameters:
testRunId- the test run's ID- Returns:
- a TestRunStatusResponse describing the test run's status
- Throws:
ComparizenClientException- when something went wrong while retrieving the test run's status
-
waitUntilTestRunResult
public TestRunStatusResponse waitUntilTestRunResult(String testRunId, long timeoutMs) throws ComparizenClientException, InterruptedException Waits until a test run is either finalized or the given timeout is passed. This method will poll the Comparizen service every 500 ms.- Parameters:
testRunId- a test run's IDtimeoutMs- the maximum amount of milliseconds to wait.- Returns:
- a TestRunStatusResponse
- Throws:
ComparizenClientException- when timeout exceeded or something went wrong while retrieving the test run statusInterruptedException- when the current Thread is interrupted
-