Jenkins - Artillery Tool Integration Using NodeJS

Prerequisite

Jenkins should be installed in your local machine. We will be using a playground in this course.

Artillery works on nodejs. So we need a plugin nodejs to be installed in the Jenkins.

Configure your Jenkins with the nodejs.

Configuring Jenkins

To try out Jenkins integration with artillery in the local machine the following steps are involved for configuration:

Install Jenkins in your local machine.

Start Jenkins server. Use the command Jenkins to start the server. To run Jenkins server on a specific port, say 9090, use Jenkins --httpPort=9090.

Please note, by default, Jenkins server will start on 8080 port. In case 8080 port is already taken by other application server, you may use 9090 port.

Login to Jenkins.

Click on Manage Jenkins->Select Manage Plugins.

Click on the Available tab.

  1. Enter NodeJs in the Filter search box and click.
  2. Select Nodejs, click on the checkbox and install. If NodeJs is already installed, it will be in Installed tab.

Jenkins - Artillery Tool Integration using NodeJs

You can verify your installation from Installed tab, search for Nodejs in installed tab.

Jenkins - Artillery Tool Integration using NodeJs

Click on Manage Jenkins -> Global Tool Configuration.

Jenkins - Artillery Tool Integration using NodeJs

Scroll down to Nodejs and click on the NodeJs installations... button. Enter the Node name. Select the node version you want to use. Ensure you select the latest version of the nodejs. Select Global npm packages to install so that we are using artillery to be installed using npm package. Enter artillery. Enter the Global npm packages refresh hours.

Jenkins - Artillery Tool Integration using NodeJs

Click on Apply and the save.

Let’s create a job (workspace) for artillery,

  1. Click on New Item.
  2. Enter an Item name.
  3. Select the project type as Freestyle project and click on Ok button to confirm.

Jenkins - Artillery Tool Integration using NodeJs

It is time to setup our artillery script for execution.

If you have your project in Git, you can set the git repo location. Else you can set path from the local system. (I am using my personal git repository artsample.yml for Demo)

Jenkins - Artillery Tool Integration using NodeJs

Setup NodeJs & npm bin/folder to Path

Jenkins - Artillery Tool Integration using NodeJs

Scroll to Build option and select Execute shell from drop down.

Jenkins - Artillery Tool Integration using NodeJs

Enter the command needed for execution of the artillery project.

npm -version
npm install artillery
artillery run artsample.yml

  1. Click on Apply and Save.
  2. Build Now

Summary

After completing both configuration, you can use artillery Preformation tool using Jenkins. Please follow all step carefully otherwise you will get multiple exception related to npm/nodejs or permission related.


Similar Articles