Package com.comparizen.client
Class ComparizenClient
- java.lang.Object
-
- com.comparizen.client.ComparizenClient
-
public class ComparizenClient extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcreateComparison(java.lang.String testRunId, java.lang.String name, java.awt.image.BufferedImage bufferedImage, ImageType imageType)Adds a new comparison (screenshot) to a test runjava.lang.StringcreateComparison(java.lang.String testRunId, java.lang.String name, java.awt.image.BufferedImage bufferedImage, ImageType imageType, ComparisonProperties properties)Adds a new comparison (screenshot) to a test runjava.lang.StringcreateComparison(java.lang.String testRunId, java.lang.String name, java.nio.file.Path file)Adds a new comparison (screenshot) to a test runjava.lang.StringcreateComparison(java.lang.String testRunId, java.lang.String name, java.nio.file.Path file, ComparisonProperties properties)Adds a new comparison (screenshot) to a test runjava.lang.StringcreateTestRun(java.lang.String projectId)Creates a new Comparizen test runjava.lang.StringcreateTestRun(java.lang.String projectId, java.lang.String name)Creates a new Comparizen test runvoidfinalizeTestRun(java.lang.String testRunId)Finalizes a Comparizen test run.TestRunStatusResponsegetTestRunStatus(java.lang.String testRunId)Retrieves a test run's statusTestRunStatusResponsewaitUntilTestRunResult(java.lang.String testRunId, long timeoutMs)Waits until a test run is either finalized or the given timeout is passed.
-
-
-
Method Detail
-
createTestRun
public java.lang.String createTestRun(java.lang.String projectId) throws ComparizenClientExceptionCreates 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
public java.lang.String createTestRun(java.lang.String projectId, java.lang.String name) 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)- Returns:
- the new test run's ID
- Throws:
ComparizenClientException- when the test run could not be created
-
finalizeTestRun
public void finalizeTestRun(java.lang.String testRunId) throws ComparizenClientExceptionFinalizes 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 java.lang.String createComparison(java.lang.String testRunId, java.lang.String name, java.nio.file.Path file) throws ComparizenClientExceptionAdds 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 java.lang.String createComparison(java.lang.String testRunId, java.lang.String name, java.awt.image.BufferedImage bufferedImage, ImageType imageType) throws ComparizenClientExceptionAdds 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 java.lang.String createComparison(java.lang.String testRunId, java.lang.String name, java.nio.file.Path file, ComparisonProperties properties) throws ComparizenClientExceptionAdds 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 java.lang.String createComparison(java.lang.String testRunId, java.lang.String name, java.awt.image.BufferedImage bufferedImage, ImageType imageType, ComparisonProperties properties) throws ComparizenClientExceptionAdds 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
public TestRunStatusResponse getTestRunStatus(java.lang.String testRunId) throws ComparizenClientException
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(java.lang.String testRunId, long timeoutMs) throws ComparizenClientException, java.lang.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 statusjava.lang.InterruptedException- when the current Thread is interrupted
-
-