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.
Executing XCUITest and XCTest tests involves the following application files:
This step walks you through preparing these files.
To create the files and convert them to .ipa files:
In this step, we create a build configuration script called
In this step, you create the JSON text file that contains all configuration settings. This is the recommended practice. Configurations include the URL of the Perfecto lab, the security token to use, which devices to select, which tags to use, and so on.
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.
To access the execution report, copy the report URL from the summary report on your console and open the URL in your browser. Here, you can drill down to see the screenshots of the different test method executions and what went wrong, if anything. For more information on Smart Reporting, see Test analysis with Smart Reporting. For details on the STR, see Single test report (STR).
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
Code Block language groovy theme Midnight
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.propertiesfile. For example:
Code Block language groovy
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
- configFilesSamples: Different examples of configuring the plugin using a
.jsonfile. Except for devices, all parameters can be overridden by the command line.