Gradle

Gradle is an open-source build automation tool that is flexible enough to build any type of software. This section walks you through setting up Gradle with Perfecto.

A sample Gradle with Perfecto project is available here: https://github.com/PerfectoMobileSA/Perfecto_Gradle

Important: This document includes references to a third-party product, Gradle. The user interface and usage of third-party products are subject to change without notice. For the latest published information about Gradle, see https://docs.gradle.org/current/userguide/userguide.html.

Requirements

Perfecto supports Gradle 7.x and earlier.

Set up Gradle with Perfecto

  1. Download and install JDK 8.
  2. Set up the JAVA_HOME environment variable to point to the JDK 8 installation folder.
  3. Set up Gradle on a Windows or Mac machine by following the instructions at https://gradle.org/install.
  4. To verify that the installation is successful, launch a new command line window and run the following command:

    Copy
    gradle -v
  5. Import your existing Gradle project into your IDE, or create a new project.
  6. Update your build.gradle file with the following repositories:

    Copy
    repositories {
        mavenCentral()
        maven {
            url 'https://repo1.perfectomobile.com/public/repositories/maven'
        }
    }
  7. Add the following dependencies:

    Copy

    Gradle dependencies

        compile ('com.perfecto.reporting-sdk:reportium-java:+') {
            exclude group: "org.seleniumhq.selenium", module: "selenium-remote-driver"        exclude group: "org.seleniumhq.selenium", module: "selenium-java"        exclude group: "org.seleniumhq.selenium", module: "selenium-api"    }
        compile 'com.perfectomobile:http-client:+'
        compile 'com.perfectomobile:pm-webdriver:+'
        compile group: 'org.seleniumhq.selenium', name: 'selenium-server', version: '3.14.0'
        compile 'org.seleniumhq.selenium:selenium-api:3.14.0'
        compile 'org.seleniumhq.selenium:selenium-remote-driver:3.14.0'
        compile 'org.seleniumhq.selenium:selenium-support:3.14.0'
        compile 'commons-codec:commons-codec:1.10'
        compile 'commons-io:commons-io:2.4'
        compile 'org.apache.commons:commons-lang3:3.4'
        compile 'dom4j:dom4j:1.6.1'
        compile 'com.google.code.gson:gson:2.5'
        compile 'com.google.guava:guava:19.0'
        compile 'org.apache.httpcomponents:httpclient:4.5.1'
        compile 'org.apache.httpcomponents:httpcore:4.4.4'
        compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.0'
        compile 'com.fasterxml.jackson.core:jackson-core:2.7.0'
        compile 'com.fasterxml.jackson.core:jackson-databind:2.7.0'
        compile 'io.appium:java-client:3.3.0'
        compile 'jaxen:jaxen:1.1.6'
        compile 'org.slf4j:jcl-over-slf4j:1.7.16'
        compile 'org.json:json:20151123'
        compile 'ch.qos.logback:logback-classic:1.1.5'
        compile 'ch.qos.logback:logback-core:1.1.5'
        compile 'org.slf4j:slf4j-api:1.7.16'

    A sample build.gradle file, including all Perfecto and Smart Reporting dependencies, is available here: https://github.com/PerfectoMobileSA/Perfecto_Gradle/blob/master/build.gradle

  8. To confirm that the dependencies have downloaded properly, execute the following gradle task:

    Copy
    clean build