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.
- Enter NodeJs in the Filter search box and click.
- Select Nodejs, click on the checkbox and install. If NodeJs is already installed, it will be in Installed tab.
You can verify your installation from Installed tab, search for Nodejs in installed tab.
Click on Manage Jenkins -> Global Tool Configuration.
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.
Click on Apply and the save.
Let’s create a job (workspace) for artillery,
- Click on New Item.
- Enter an Item name.
- Select the project type as Freestyle project and click on Ok button to confirm.
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)
Setup NodeJs & npm bin/folder to Path
Scroll to Build option and select Execute shell from drop down.
Enter the command needed for execution of the artillery project.
npm -version
npm install artillery
artillery run artsample.yml
- Click on Apply and Save.
- 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.