Last updated: Dec 26, 2018 17:58
Perfecto provides a plugin tool for Gradle to support application instrumentation tests integrating the whole process from Gradle to Reporting. Use the new plugin for Gradle to configure your tests to run on devices in the Perfecto Continuous Quality Lab. These run in either a standalone gradle run or (for AndroidStudio) as part of your build, and generate DigitalZoom Single Test Reports (STR) that allow you to analyze the full test suite.
The Gradle Plugin supports -
- Espresso/Robotium tests for Android
- XCTest/XCUITest tests for iOS
The tool includes the following components, that will be detailed in the following pages:
- Gradle plugin installation - preparing the build.gradle file
- Configuration parameters - may be entered through a configuration file, command-line, or encoded in the build.gradle file.
- Activating the plugin and understanding the output and connecting to DigitalZoom execution report.
The Gradle plugin supports Gradle tasks for Android and iOS environments:
- For Android use the task named "perfecto-android-inst"
- For iOS use the task named "perfecto-xctest"
Each of these tasks support the following actions -
- Reading Perfecto configuration parameters that select the devices to install and run the instrumentation tests.
- When working inside Android Studio - checks if there are tasks to build the application and test apk files, and if they are present, activates them.
- Installs the application and test apk files on Perfecto Lab devices, and runs the test methods.
- Generates output to both the Gradle console and to the DigitalZoom Reporting report.
For quick-start guides see the how-to articles for:
Preparing the Gradle files for Plugin
There are two modes for integrating the plugin for use with your Gradle projects:
- Prepare the build.gradle file to automatically download the plugin jar file
- Manually download the jar file and define its location to the build.gradle file.
After performing the setup tasks, described here, continue to work with the plugin:
- In a "Standalone" testing environment when developing Espresso, XCTest, or XCUITest tests.
- From within an Android Studio project when developing Espresso tests.
Automatic download by gradle
Gradle can be configured to automatically download and install the plugin jar file, by:
- Defining the plugin as a dependency.
- Indicating the location of the jar file in the network
Instructing Gradle to automatically download and install the plugin involves adding two items to the build.gradle file:
Add the following to the repositories section of the file:
This identifies the location of the plugin's jar file.
Add the following line to the dependencies section of the file:
This defines the dependency on the plugin, and Gradle will look to verify that the plugin is installed before performing the task.
Manual install of the plugin
If there are problems using the automatic download method, above, it is possible to download the latest plugin jar file and store it locally on the development station disc.
- Browse to the repository at: https://repo1.perfectomobile.com/public/repositories/maven/com/perfectomobile/instrumentedtest/gradleplugin/plugin/
- Look for the folder of the latest version (18.8.2 in the screenshot below) and open the folder.
- Download the plugin-<version>.jar file and save to the project's file structure.
- The preferred location is the project's libs folder.
- If the libs folder does not exist - either create it and save the jar file there or save it to a different folder.
In any case, add a definition to the project level build.gradle file repositories clause that identifies the location of the jar file, using the following format:
Adding the Plugin tasks
In addition to the changes for the installation of the plugin for the project, you will need to "apply" the plugin to the tasks supported by the build.gradle file by adding the following line: