Class ComparizenClient


  • public class ComparizenClient
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String createComparison​(java.lang.String testRunId, java.lang.String name, java.awt.image.BufferedImage bufferedImage, ImageType imageType)
      Adds a new comparison (screenshot) to a test run
      java.lang.String createComparison​(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 run
      java.lang.String createComparison​(java.lang.String testRunId, java.lang.String name, java.nio.file.Path file)
      Adds a new comparison (screenshot) to a test run
      java.lang.String createComparison​(java.lang.String testRunId, java.lang.String name, java.nio.file.Path file, ComparisonProperties properties)
      Adds a new comparison (screenshot) to a test run
      java.lang.String createTestRun​(java.lang.String projectId)
      Creates a new Comparizen test run
      java.lang.String createTestRun​(java.lang.String projectId, java.lang.String name)
      Creates a new Comparizen test run
      java.lang.String createTestRun​(java.lang.String projectId, java.lang.String name, java.util.Map<java.lang.String,​java.lang.String> customEnvironmentProperties)
      Creates a new Comparizen test run
      void finalizeTestRun​(java.lang.String testRunId)
      Finalizes a Comparizen test run.
      TestRunStatusResponse getTestRunStatus​(java.lang.String testRunId)
      Retrieves a test run's status
      TestRunStatusResponse waitUntilTestRunResult​(java.lang.String testRunId, long timeoutMs)
      Waits until a test run is either finalized or the given timeout is passed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createTestRun

        public java.lang.String createTestRun​(java.lang.String projectId)
                                       throws ComparizenClientException
        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

        public java.lang.String createTestRun​(java.lang.String projectId,
                                              java.lang.String name)
                                       throws ComparizenClientException
        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 java.lang.String createTestRun​(java.lang.String projectId,
                                              java.lang.String name,
                                              java.util.Map<java.lang.String,​java.lang.String> customEnvironmentProperties)
                                       throws ComparizenClientException
        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)
        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

        public void finalizeTestRun​(java.lang.String testRunId)
                             throws ComparizenClientException
        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 java.lang.String createComparison​(java.lang.String testRunId,
                                                 java.lang.String name,
                                                 java.nio.file.Path file)
                                          throws ComparizenClientException
        Adds a new comparison (screenshot) to a test run
        Parameters:
        testRunId - the test run's ID
        name - 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 ComparizenClientException
        Adds a new comparison (screenshot) to a test run
        Parameters:
        testRunId - the test run's ID
        name - 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 data
        imageType - 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 ComparizenClientException
        Adds a new comparison (screenshot) to a test run
        Parameters:
        testRunId - the test run's ID
        name - 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
        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
      • createComparison

        public java.lang.String createComparison​(java.lang.String testRunId,
                                                 java.lang.String name,
                                                 java.awt.image.BufferedImage bufferedImage,
                                                 ImageType imageType,
                                                 ComparisonProperties properties)
                                          throws ComparizenClientException
        Adds a new comparison (screenshot) to a test run
        Parameters:
        testRunId - the test run's ID
        name - 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 data
        imageType - 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 ID
        timeoutMs - the maximum amount of milliseconds to wait.
        Returns:
        a TestRunStatusResponse
        Throws:
        ComparizenClientException - when timeout exceeded or something went wrong while retrieving the test run status
        java.lang.InterruptedException - when the current Thread is interrupted