The New BlazeMeter Drone.io CI/CD Plugin
December 20, 2021

The New BlazeMeter Drone.io CI/CD Plugin

Performance Testing

We have recently released a new BlazeMeter plugin - the BlazeMeter Drone.io plugin. With this plugin, BlazeMeter performance tests can now be created and executed in your Drone CI CD pipeline. 

By using the new BlazeMeter Drone CI CI plugin, you can:

  • Automatically test your application after publishing files and artifacts to GitHub Release.
  • Trigger your BlazeMeter test after changing source code files in the source code management system, by committing the drone yaml file
  • Continue the CI pipeline without waiting for the completion of your BlazeMeter test.

Table of Contents:

How Does The BlazeMeter Drone CI CD Plugin Work?

The core functionality of creating, launching, and executing performance tests within BlazeMeter is packaged inside a Docker image that is developed and maintained by BlazeRunner. 

Image Name: blazerunner/blazemeter:drone

Test execution within the drone pipeline involves importing this Docker image and providing the necessary input parameters. 

Below is an overview of the input options available. The input parameters listed here will be used in your .drone.yaml file, as you will see later in this article.

  • apikey: BlazeMeter API Key (mandatory) - Generate from your BlazeMeter account 
  • apisecret: BlazeMeter API Secret (mandatory) - Generate from your BlazeMeter account 
  • testid: ID of the test (mandatory for existing test) - This is the number after ‘/tests/’ in your BlazeMeter test URL
  • createtest: When set to true, it creates a new test (mandatory for new test)
  • testname: Specify a name if you want to create a new test
  • projectid: Creates the test under this Project ID
  • inputstartfile: Path to the test start file (mandatory for new test)
  • inputallfiles: Path to the folder where dependencies exist (jar files, csv files, etc)
  • uploadfilechk: Set this flag in case you want to upload dependencies
  • totalusers: Specify load criteria (default is 20)
  • duration: Specify test duration in minutes (default is 20)
  • rampup: Specify ramp-up time in minutes (default is 1)
  • continuepipeline: Do you want to continue the pipeline while the test is running in the background? (default is true- continuepipeline: true - drone.io will display ‘success’ upon test kick off (does not wait for test completion)continuepipeline: false - drone.io will display ‘running’ upon test kick off, will wait for test completion to say ‘success’ or ‘failure’

How Do I Use the Drone CI CD Pipeline to Execute a BlazeMeter test?

Prerequisites

Before beginning, you must complete the following:

  • Go to www.github.com and log in
    • You must have at least one public github repository
      • Your repository must be public for drone.io to recognize it
  • Go to a.blazemeter.com and log in
    • Generate your API key and API secret
      • Reference this BlazeMeter Guide article for instructions on how to generate these
  • Go to www.drone.io and log in using your github credentials
    • All public repositories will display on the dashboard
      • Click on your desired repository
  • Click Activate Repository
Project visibility options
  1. You can change a project’s visibility in drone.io (optional)
Project visibility options
  1. Click on Secrets
    1. Add your apiKey and apiSecret you created in BlazeMeter, here:
null

Running an Existing BlazeMeter Test

To run an existing test:

  1. Go to www.github.com 
  2. Go to your desired repository
    1. Upload any required script files and dependencies
  3. Add a .drone.yml file manually
  4. Include all input parameters for your specific test like the screenshot below
  5. Be sure to include your BlazeMeter test ID. This is the number after ‘/tests/’ in your BlazeMeter test URL.
kind:pipelinename:defaultworkspace:path:/drone/srcsteps:-name:run-testimage:blazerunner/blazemeter:droneenvironment:apikey:from_secret:apiKeyapisecret:from_secret:apiSecretcreatetest:falsetestid:{testid}continuepipeline:false
 
  1. Go back to www.drone.io
  2. Within your desired repository, click the ‘+ NEW BUILD’ button in the top right corner
    1. Specify the branch you wish to run 
    2. Specify any additional parameters (optional)
    3. Click ‘Create’
nulll
  1. While it is running, you can monitor it on www.drone.io and on a.blazemeter.com and see the status of your test.
null

Running a New BlazeMeter Test

To create a new test from the pipeline:

  1. Go to www.github.com 
  2. Go to your desired repository
    1. Upload new test files and any other required script files and dependencies
    2. Specify the path correctly for the start file and dependencies
  3. Add a .drone.yml file manually

a. Include all input parameters for your new test like the screenshot below

b. Load configuration is optional

kind:pipelinename:defaultworkspace:path:/drone/srcsteps:-name:create-testimage:blazerunner/blazemeter:droneenvironment:apikey:from_secret:apiKeyapisecret:from_secret:apiSecrettestname:{testName}projectid:{projectID}createtest:trueinputstartfile:DemoTest.jmxinputallfiles:/drone/src/{DependenciesFolderName}uploadfilechk:truetotalusers:{Users}duration:{Duration}rampup:{RampUp}continuepipeline:true

 

4. Go back to www.drone.io and follow the build steps listed in the first example 

Running a New BlazeMeter Test with Taurus

To create a new test from the pipeline with a Taurus based YAML:

  1. Go to www.github.com 
  2. Go to your desired repository
    1. Upload new test files and any other required script files and dependencies
  3. Add a .drone.yml file manually
    1. Include all input parameters for your new test like the screenshot below
    2. Load configuration like location, users, ramp up and failure criteria can be defined in the taurus file
  4. Set the taurus file as the start file for test
  5. Put the JMX file under the dependencies folder
  6. Refer to this Sample Yaml File
kind:pipelinename:defaultworkspace:path:/drone/srcsteps:-name:create-testimage:blazerunner/blazemeter:droneenvironment:apikey:from_secret:apiKeyapisecret:from_secret:apiSecrettestname:{testName}projectid:{projectID}createtest:trueinputstartfile:SampleYamlFile.ymlinputallfiles:/drone/src/{DependenciesFolderName}uploadfilechk:truecontinuepipeline:true
  1. Go back to www.drone.io and follow the build steps listed in the first example 

After your test runs:

If your test passed, the status will say ‘Success’

null

If your test failed, the status will say ‘Failure’

null

You can click on a bar in the chart or a specific test execution to see more information about the test

null
  • You can also download log files to analyze the results
null
null

That’s it! Now you know all the necessary information about how to use the Drone CI CD plugin.

START TESTING NOW