Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Open the project build.gradle file.

  2. Add the lines to the build gradle file that define the location of the plugin library and the dependency on the plugin:

    Section
    bordertrue
    Column
    width45%

    2a. To configure Gradle to automatically locate and download the plugin library add the following lines to build.gradle file:

    Code Block
    languagegroovy
    themeMidnight
    buildscript {
        repositories {
            jcenter()
            maven {
                url "https://repo1.perfectomobile.com/public/repositories/maven"
            }
        }
     
        dependencies {
            classpath "com.perfectomobile.instrumentedtest.gradleplugin:plugin:+"
        }
    }
    Column
    width45%

    2b. If the plugin library is already downloaded to a folder (for example: libs sub-folder) add the following lines to build.gradle file:

    Code Block
    languagegroovy
    themeMidnight
    buildscript {
        repositories {
            jcenter()
     
    		flatDir dirs: 'libs'
        }
     
        dependencies {
            classpath "com.perfectomobile.instrumentedtest.gradleplugin:plugin:+"
        }
    }



    Column
    width9%


  3. Open the module build.gradle file.

  4. Add the line that defines the plugin task 

    Code Block
    languagegroovy
    themeMidnight
    apply plugin: 'com.perfectomobile.instrumentedtest.gradleplugin'
  5. Add the plugin configuration settings - Lab authentication parameters
    1. Include the URL for the Perfecto Lab

    2. Your personal Security Token, generated for the Perfecto Lab

      Code Block
      languagegroovy
      themeMidnight
      perfectoGradleSettings { 
          cloudURL "mobilecloud.perfectomobile.com" 
          securityToken "AAABNg0ODAoPeNqtkT1PwzAQhnf/CkssM...JxQ3HEI8NsX02ff" 
      } 

      Note: You could also supply the   configuration file location parameter in this gradle-file clause.

  6. Create a configuration file.

  7. Open a command-line (or terminal) window at the project folder.
  8. Execute the plugin using the following command in the command-line window:

    Info
    iconfalse

    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 configuration parameters.

    Info
    iconfalse

    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.

    Code Block
    languagebash
    themeMidnight
    gradle perfecto-android-inst -PconfigFileLocation="C:\temp\Espresso\ConfigFile.json"

    This will
     - 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 DigitalZoom Test analysis with Smart Reporting interface.


  9. 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.
  10. 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
  11. Copy the report URL from the summary report on your console:

    Code Block
    languagebash
    themeMidnight
    View the detailed report at: https://demo.reporting.perfectomobile.com/library?startExecutionTime[1]=lastMonth&tags[0]=5af27a82-54cc-405a-8c6e-fa46fcae874b 
    Finished flow execution
  12. Open the URL in your browser to access the execution report:

...