Run massively scalable performance tests on web, mobile, and APIs

Request a Demo
Jul. 30th, 2018

How to Keep BlazeMeter Test Data Updated with GitHub and Jenkins

What we will learn today? In this blog post I’ll explain how you can use GitHub and Jenkins so your BlazeMeter performance test automatically runs the most updated test data. This is an easy way to ensure your tests are always accurate and complete.

 

This new feature in the BlazeMeter Jenkins plugin lets you update many types of test data. Test data can be executable script files from any tool BlazeMeter supports: jmx, yml, scala etc. Or, configuration or data storage files for the main scripts, like CSVs and properties files.

 

To do this, we will setup Jenkins CI to run an automated test in BlazeMeter. We will use Github for storing the test configuration and data for this test (e.g. csv file). When Jenkins starts a job, it will go to our github repository and update the test files in BlazeMeter. As a result, our tests will always have the newest test data. I will show you how to run a Taurus performance test, but you can use any of the testing tools BlazeMeter supports: Apache JMeter™, Gatling, Taurus, etc.  

 

Let’s get started.

 

Creating a Performance Test Scenario

 

As a first step, let’s create a test scenario in Taurus. I chose Taurus, because it has a simple yaml config file that is very easy for test scenario configuration. But, you can also use tools like JMeter.

 

Let’s take the simplest scenario from the Taurus website:

 

execution:
- concurrency: 30
  ramp-up: 1m
  hold-for: 5m
  scenario: quick-test

scenarios:
  quick-test:
    requests:
    - http://blazedemo.com

 

This scenario will open the http://blazedemo.com page while gradually increasing the number of concurrent virtual users from 0 to 30 within a minute. Then, the scenario with 30 users will run for 5 minutes.

 

This is the main page, which has a simple form. Let’s add a POST request to our test plan.

 

jenkins performance plugin tutorial

 

execution:
- concurrency: 30
  ramp-up: 1m
  hold-for: 5m
  scenario: quick-test

scenarios:
  quick-test:
    requests:
    - http://blazedemo.com
    - url: http://blazedemo.com/reserve.php
      method: POST
      headers:
        Content-Type: application/x-www-form-urlencoded
      body:
        fromPort: Paris
        toPort: Rome

 

The values 'Paris' and 'Rome' are constants, which will be changed in the future. So, let’s turn them into variables, and store all possible values in a CSV file (data.csv), from which we will want to update data:

 

execution:
- concurrency: 30
  ramp-up: 1m
  hold-for: 5m
  scenario: quick-test

scenarios:
  quick-test:
    requests:
    - http://blazedemo.com
    - url: http://blazedemo.com/reserve.php
      method: POST
      headers:
        Content-Type: application/x-www-form-urlencoded
      body:
        fromPort: ${from}
        toPort: ${to}
        
    data-sources:
    - data.csv

 

Data from data.csv file:

 

from,to
Paris,Buenos Aires
Philadelphia,Rome
Boston,London
Portland,Berlin
San Diego,New York
Mexico City,Dublin
São Paolo,Cairo

 

Creating a Test in BlazeMeter

 

The next step is create the Taurus test in a.blazemeter.com.

 

1. Click on the button ‘Create Test’.

 

2. Select ‘the Taurus Test’ type.

 

BlazeMeter jenkins plugin tutorial

 

3. Upload your *.yml and *.csv files to the test.

 

how to update test data in BlazeMeter and Jenkins

 

Now your test is ready for execution in BlazeMeter.

 

Putting Your Test Files in GitHub

 

1. Create a repository.

 

2. Add the *.yml and *.csv files to your repository.

 

In my case, I have a test.yml file in the yml folder and  a data.csv file in the csv folder.

 

Blazemeter test files, jenkins, github, agile, shift left

 

blazemeter jenkins job, fast

 

Creating a Jenkins Job

 

This is the last step. Create and setup a Jenkins job that will get these files from GitHub and update them in BlazeMeter before running the test.

 

1. Open Jenkins and create a FreeStyleProject.

 

updating test script in jenkins

 

2. In ‘Source Code Management’, select ‘Git’ and paste your repository URL.

 

updating csv file in jenkins for blazemeter

 

3. In ‘Build’ add a BlazeMeter build step. Select the test that you already created and write the paths to the files. The path should be relative to ‘JOB_WORKSPACE/BUILD_NUMBER/’.

 

I know, that ‘Source Code Management’ will clone my repository to JOB_WORKSPACE/ so I start my path from ‘..’, which means parent directory.

 

github data updates in jenkins, performance test

 

4. Save your job and run. Every time your Jenkins job is run, Jenkins will clone the Git repository to the Jenkins workspace, the BlazeMeter Jenkins plugin will upload the files the user selected in the job configuration, and the BlazeMeter Jenkins plugin will run the BlazeMeter test.

 

performance testing best practices

 

The updated BlazeMeter test:

 

how to use jenkins with blazemeter

 

That’s it! Your BlazeMeter test will now always contain the most updated data. To see how BlazeMeter works, put your URL in the box below and your test will start in minutes. You can also get a free BlazeMeter demo from one of our performance engineers.

     
arrow Please enter a valid URL

Interested in writing for our Blog? Send us a pitch!