Skip to main content

Setup Java Autotest Agent

This page describes how to setup Autotest Agent to collect metrics for automated API and E2E tests written in Java / other JVM language.

Supported tehcnologies#

While Drill4J provides plugins both for Maven and Gradle, for Autotest Agent to work it has to also support both test runner and transport. Why: refer to Data Collection section for the detailed explanation.

Supported testing frameworks / runners#

  • TestNG
  • JUnit
  • JMeter
  • Spock
  • Cucumber

Support quality for future versions may vary. Good thing is it's either going to work or not. Please make sure to report issue if you encounter problems with the listed framework/runner.

Example configuration#

We provide plugins for both Maven and Gradle.

First step is to add com.epam.drill.agent.runner plugin - it will download autotest agent and launch it accordingly with configuration (see bellow)

Maven config#

Add the following lines to pom.xml configuration file in test project. Remember to enter the appropriate values for agentId (or groupId, if using groups), adminPort, adminHost.

<build>
<plugins>
<plugin>
<groupId>com.epam.drill.agent.runner</groupId>
<artifactId>maven</artifactId>
<version>0.3.4</version>
<executions>
<execution>
<goals>
<goal>autotest</goal>
</goals>
</execution>
</executions>
<configuration>
<drill>
<version>0.22.4</version>
<agentId><!--YOUR AGENT ID--></agentId>
<adminHost><!--DRILL-ADMIN SERVICE HOST--></adminHost>
<adminPort><!--DRILL-ADMIN SERVICE PORT--></adminPort>
<!-- <groupId>YOUR GROUP ID</groupId> -->
<!-- optional logging -->
<!-- <logLevel>TRACE</logLevel>
<logFile>./drill4j-autotest-agent.log</logFile> -->
</drill>
</configuration>
</plugin>
</plugins>
</build>

Gradle config#

Add the following lines to build.gradle configuration file in test project. Remember to enter the appropriate values for agentId (or groupId, if using groups), adminPort, adminHost.

plugins {
id 'java'
id 'com.epam.drill.agent.runner.autotest' version '0.3.4'
}
group 'com.epam'
version '1.0-SNAPSHOT'
allprojects {
repositories {
mavenCentral()
}
dependencies {
apply plugin: 'java'
apply plugin: 'com.epam.drill.agent.runner.autotest'
}
drill {
version = "0.22.4"
agentId = /*YOUR AGENT ID*/
adminHost = /* DRILL-ADMIN SERVICE HOST */
adminPort = /* DRILL-ADMIN SERVICE PORT */
// groupId = /*YOUR GROUP ID*/
// optional logging
// logLevel= "TRACE"
// logFile = "./drill4j-autotest-agent.log"
}
}

Troubleshooting#

Issue - failed to locate/download Autotest Agent#

Tests launch fails with error "Failed to locate or download autotest agent zip file. Reason: connection refused"

Most likely tests are launched in environment that is behind VPN / proxy, where default repository is unavailable.

Solution: either configure VPN/proxy to allow connection to GitHub or supply Autotest Agent directly:

  1. Make sure com.epam.drill.agent.runner is not lower than 0.3.4

  2. Download platform-appropriate release from https://github.com/Drill4J/autotest-agent/releases (e.g. agent-linuxX64-0.22.4.zip)

  3. Add either directLocalPathToZip or directUrlToZip to the root level of the drill section.

    When both are present directLocalPathToZip takes precedence.

See changes to example configs below

Gradle#

plugins {
id 'java'
/* Make sure com.epam.drill.agent.runner version is equal or greater than 0.3.4 */
id 'com.epam.drill.agent.runner.autotest' version '0.3.4'
}
group 'com.epam'
version '1.0-SNAPSHOT'
allprojects {
repositories {
mavenCentral()
}
dependencies {
apply plugin: 'java'
apply plugin: 'com.epam.drill.agent.runner.autotest'
}
drill {
/* version = "0.2.24" */
/* comment out or remove "version" field - it wont have an effect when direct path/url is specified
/* Agent from local path - handy for a one-time launch */
/* both relative and absolute paths are allowed */
directLocalPathToZip = "agent-mingwX64-0.22.4.zip"
/* Direct url is a more approriate solution, if you cannot alter VPN/proxy configuration */
/* host file anywhere you like (e.g. local webserver, corporate artifactory) */
directUrlToZip="http://localhost:3000/agent-mingwX64-0.22.4.zip"
/*... rest of the drill section config */
agentId = /*YOUR AGENT ID*/
adminHost = /* DRILL-ADMIN SERVICE HOST */
adminPort = /* DRILL-ADMIN SERVICE PORT */
}
}

Maven#

<build>
<plugins>
<plugin>
<groupId>com.epam.drill.agent.runner</groupId>
<artifactId>maven</artifactId>
<!-- Make sure com.epam.drill.agent.runner version is equal or greater than 0.3.4 -->
<version>0.3.4</version>
<configuration>
<drill>
<!--<version>0.22.4</version>-->
<!-- comment out or remove "version" field - it wont have an effect when direct path/url is specified-->
<!-- Agent from local path - handy for a one-time launch -->
<!-- both relative and absolute paths are allowed -->
<directLocalPathToZip>agent-mingwX64-0.22.4.zip</directLocalPathToZip>
<!-- Direct url is a more approriate solution, if you cannot alter VPN/proxy configuration -->
<!-- host file anywhere you like (e.g. local webserver, corporate artifactory) -->
<directUrlToZip>http://localhost:3000/agent-mingwX64-0.22.4.zip</directUrlToZip>
<!--... rest of the drill section config -->
<agentId><!--YOUR AGENT ID--></agentId>
<adminHost><!--DRILL-ADMIN SERVICE HOST--></adminHost>
<adminPort><!--DRILL-ADMIN SERVICE PORT--></adminPort>
</drill>
</configuration>
</plugin>
</plugins>
</build>