Monday, March 6, 2017

Setting up Gatling on Jenkins as Gradle Project

In this article we are going to discuss on setting up Gatling on Jenkins using Gradle build tool.
To start you will need to create a gradle project.
The build.gradle should contain:
buidl.gradle
1
2
3
4
5
6
7
plugins {
    id 'com.github.lkishalmi.gatling' version '0.4.1'
}
 
repositories {
    jcenter()
}

The project structure should be like the following:
Make sure that the code is checked into github.

Now let's have a look at how to setup BrewMaster for Automating the job:

  1. You will need to add the source code to the Jenkins:

  2. Set the JDK version to jdk8.

  3. Set up Gradle Plugin on Jenkins (You can skip this test if Gradle plugin is already configured on your Jenkins):
    i. Go to Manage Jenkins.
    ii. Go to Manage Plugins 


     

    iii. Find and add Gradle Plugin. (For more look here: https://wiki.jenkins-ci.org/display/JENKINS/Gradle+Plugin)
  4. Once you are done with the above steps got to Configure Jenkins:
    i. Go to Gradle
    ii. Add a Gradle Profile


  5. To run the Job you need to add the gradle goals on the build process.
    i. Click on Invoke Gradle
    ii. Add the following in Tasks: gatlingRun

After this we are all set and we can build the Jenkins job with or without parameters.
Your code should handle the default values of the parameters and do the null checks.
Once you start running the jobs you should be able to see the console output and once the job is run successfully you will be able to see the result of the tests. The path will be there in the output.
It should be available in the workspace in the target/gatling directory like the following directory:
GradleGatlingPluginTest/ws/build/reports/

You can use the following github project to test your job: https://github.com/pritambanerjee999/gradle-gatling-test.git

No comments:

Post a Comment