Skip to main content

Advanced configuration

Organize tests in batches

You can aggregate tests that are run in different processes, or in different Eyes instances, under the same batch. This is done by providing the same batch ID to these tests. For more information, see How to organize your tests with batches.

BatchInfo

Configures the batch for one or more tests. For details see How Eyes compares checkpoints and baseline images

Syntax

let batch = BatchInfo(name: "the batch name")
batch.batchId = UUID().uuidString
eyes.batch = batch

For a description of common actions with this class, see BatchInfo class

Configuration class

Creates a configuration object that is used to configure an Eyes object by assigning it to the Eyes configuration property.

You can use this configuration object instead of using the various Eyes methods and properties that set the same attributes. Typically you set up a Configuration object by calling its setXXXX methods chained with a '.' in a Fluent coding style.

For a description of methods and parameters in this class, see Configuration class

Test results

The results of the test can be consumed as the return value from eyes.close. following is an example for creating a formatted output string out of the TestResults object:

func format(testResults: TestResults) -> String {
return """
Test name : \(testResults.name)
Test status : \(testResults.status)
URL to results : \(testResults.url)
Total number of steps : \(testResults.steps)
Number of matching steps : \(testResults.matches)
Number of visual diffs : \(testResults.mismatches)
Number of missing steps : \(testResults.missing)
Display size : \(testResults.hostDisplaySize)
Steps :
\(testResults
.stepsInfo
.map { step in
return "\(step.name) - \(getStepStatus(step))"
}
.joined(separator: "\n"))
"""
}

func getStepStatus(step: StepInfo) -> String {
if step.isDifferent {
return "Diff"
} else if !step.hasBaselineImage {
return "New"
} else if !step.hasCurrentImage {
return "Missing"
} else {
return "Passed"
}
}

For the full list of methods, see TestResults class.

Configure proxy

If your company's network requires requests to go through the corporate proxy, you can configure it as follows:

eyes.proxy = AbstractProxySettings(uri: "'http://yourproxy.com", port: 8000)

// provide username and password:
eyes.proxy = AbstractProxySettings(uri: "'http://yourproxy.com", username: "user", password: "pass")