Last updated: Jan 18, 2021 18:24
Prerequisites
Before you get started, make sure you have installed the following:
In addition, you need access to the Perfecto Gradle plugin. You can download it either automatically, after adding the required lines of code to the build.gradle
file, as described in step 2 below, or, if your organization does not permit direct download, by pre-downloading it to a local libs folder (see also Install the Perfecto Gradle plugin manually).
1 | Get started
The starting point is a local Xcode project without Perfecto configuration: https://github.com/PerfectoMobileSA/PerfectoXCUITestProject/tree/master/LocalXCUITest.
To get started:
- Clone the project: https://github.com/PerfectoMobileSA/PerfectoXCUITestProject/tree/master/LocalXCUITest
- Open Xcode.
- Choose the LocalXCUITest workspace.
- Perform Product > Clean and Build.
- Fix any signing-related issues.
2 | Configure the project for Perfecto
In this step, we prepare the application files and add the following new files to the project:
- A build.gradle file that will specify the required Perfecto dependencies
- A JSON configuration file that holds all Perfecto configurations, including security information, the Perfecto cloud name, Smart Reporting information, and test data.
The updated project is located here: https://github.com/PerfectoMobileSA/PerfectoXCUITestProject/tree/master/PerfectoXCUITest. The following procedure walks you through the configuration.
Expand a step to view its content.
3 | Run the plugin and view the report
This step walks you through running the Perfecto Gradle plugin and viewing the test report in Perfecto.
Expand a step to view its content.
Proxy connection
If you run the Gradle plugin over a proxy connection, you can supply the proxy information as follows:
As Java parameters when activating the plugin. You can use the same Java Proxy parameters also for proxies supporting SSL encryption.
http.proxyHost: The IP address of the proxy
http.proxyPort: The IP port used for the connection
http.proxyUser: The username for connecting to the proxy server
http.proxyPassword: The password for connecting to the proxy server
For example:gradlew perfecto-android-inst -DconfigFileLocation=configFile.json -Dhttp.proxyHost=10.0.0.100 -Dhttp.proxyPort=8800 -Dhttp.proxyUser=someUserName -Dhttp.proxyPassword=somePassword
As parameters defined explicitly in the
gradle.properties
file. For example:systemProp.http.proxyHost=<http-proxy-host> systemProp.http.proxyPort=<http-proxy-port> systemProp.https.proxyHost=<https-proxy-host> systemProp.https.proxyPort=<https-proxy-port>
Samples of plugin use
The Perfecto GitHub repository https://github.com/PerfectoCode/XcTest/tree/master/samples includes different samples that demonstrate how you can use the Perfecto Gradle plugin for the following different modes/configurations:
- defaultSample: An Xcode project containing the needed files for running the Perfecto XCTest task
- localJarSample: An Xcode project configured to run the Perfecto .jar file locally
- buildGradleConfiguration: An Xcode project with the configuration included in the
build.gradle
file - configFilesSamples: Different examples of configuring the plugin using a
.json
file. Except for devices, all parameters can be overridden by the command line.
In addition, this repository includes sample projects for running test methods from EarlGrey and KIF. For more information, see KIF/EarlGrey tests.