Integrate Gradle with Perfecto Smart Reporting

If your Gradle project is configured to run in Perfecto, you can integrate it with Perfecto Smart Reporting by performing the following steps. 

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.

To integrate Gradle with Smart Reporting:

  1. Open the build.gradle file.
  2. Edit the file as follows:

    1. For the project to be able to access the Reporting SDK, add the following jars:

      Copy
      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"       }
    2. If your project is integrated with a CI tool, also add the following:

      Copy
      systemProperties['jobName']=project.hasProperty('jobName') ? jobName : "NA"systemProperties['jobNumber']=project.hasProperty('jobNumber') ? jobNumber : null
  3. In the code, fetch the jobName and jobNumber as follows:

    Copy
    .withJob(new Job(System.getProperty("jobName") , 
    Integer.parseInt(System.getProperty("jobNumber"))))