Last updated: Sep 22, 2019 17:54
The Perfecto Gradle plugin allows the tester to:
- Select a device or multiple devices from the Perfecto Lab to run Instrumentation Tests for Android applications.
- Install the application and test apk files onto the selected devices.
- Run the test methods on the devices.
- See the progress of the test set on the console.
- Access a DigitalZoom Report Library grid that presents the results of the tests.
The procedure presented here is used when the application and test apk files are available on the local disc storage and the plugin jar file is not installed.
Work within an Android Studio project
Android Studio projects are integrated with Gradle and the project will include several build.gradle files - one for the project level and one for each module of the project, See below in this screenshot:
To execute the plugin with an Android Studio project:
Open the project build.gradle file.
Add the lines to the build gradle file that define the location of the plugin library and the dependency on the plugin:
2a. To configure Gradle to automatically locate and download the plugin library add the following lines to build.gradle file:
2b. If the plugin library is already downloaded to a folder (for example: libs sub-folder) add the following lines to build.gradle file:
Open the module build.gradle file.
Add the line that defines the plugin task
- Add the plugin configuration settings - Lab authentication parameters
Include the URL for the Perfecto Lab
Your personal Security Token, generated for the Perfecto Lab
- Open a command-line (or terminal) window at the project folder.
Execute the plugin using the following command in the command-line window:
Important Note: User should verify that the "assembleDebug" and "assembleAndroidTest" gradle tasks execute before executing the perfecto-android-inst task. The plugin will search for the generated apk files in the standard gradle output folders or in the package Debug and AndroidTest folders. If the apk files are located in other locations, user should supply the apkPath and testApkPath .
Note: When testing an Android (aar or jar) library, set both the apkPath and testApkPath fields to the location specified for the assembleAndroidTest gradle task. By default, this location is: <project folder>/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
Here we also supply the full path to the Configuration File created in steps 6-10. Other configuration parameters (except for device selection) could be added to the command line.
- Select the devices as specified in the Device selection parameters of the configuration file [or a random device if no specification provided],
- Install the application and test apk files onto the device
- Run the test methods (based on the configuration parameters)
- Send output to the console window
- Generate an execution report that can be viewed in the Test analysis with Smart Reporting interface.
- During the execution, the plugin will report on the progress of the execution, and the completion of each test method to the command-line window.
- At the end of the execution, a high-level summary report of the completion status for each device used will be presented in the command-line window
Copy the report URL from the summary report on your console:
- Open the URL in your browser to access the execution report:
The following video demostrates these steps.