Perfecto supports XCTest instrumentation tests integrating the whole process from your CI to Reporting.
Use the Perfecto Gradle plugin to configure your tests to run on devices in Perfecto.
You can either integrate the plugin with your Android project or execute the tests separately.
Finally, the task will generate Smart Reporting Single Test Reports (STR) that allow you to analyze the full test suite.
In this section:
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).
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.