There are numerous ways to install Jenkins locally, depending on your operating system.
For example, a tester can use brew on macOS: – brew install Jenkins
The apt command will be a good fit for Debian:
wget -q -O – https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add –
deb https://pkg.jenkins.io/debian-stable binary/
sudo apt update
sudo apt install jenkins
Ultimately, you can use bash Jenkins and the service will be launched instantly.
This command will show an administrator default password and then the next screens will lead users through editing settings of Jenkins.
You can use values for the task we will analyze further in the article.
That’s it. Jenkins is ready for use now.
Launching JMeter from a command line
To configure Jenkins, a user should know how to launch Jenkins plans properly, from a command line.
So the first step is to find the location of JMeter on your local PC.
On Linux and Windows, it can be located in a folder where a user has unpacked it.
On macOS, if it has been installed from brew, you can use the where jmeter command to find it (you should probably search for it here: usr/local/bin/jmeter).
And now, to activate JMeter in the special NON_GUI mode, you need to enter a special command:
PATH_TO_JMETER/bin/jmeter -n -t PATH_TO_MY_PLAN/MY_PLAN.jmx -l PATH_WHERE_I_WANT_TO_SAVE_THE_RESULTS/MY_PLAN.jtl
Developing a task in Jenkins to launch a JMeter plan
We will use the JMeter plan that calls Open Maps API functionality as an example.
So first, we need to add a performance plugin, to see graphic reports on a screen.
Next, we need to go to the Manage Jenkins and Manage Plugins section.
Then, you need to select the Performance section from the special Available tab.You don’t need to relaunch the program.
After that, we need to return to Jenkins default screen, click on the Create new jobs function and create the Freestyle project.
To add steps, you need to click on Configure.
First, you need to add a build step, that can execute the command we used to launch JMeter from a command line.
Then, we need to add a step after the build. The step type is Publishing performance test result report that belongs to performance plugins.
Finally, we need to add a correct path to the .jtl file inside the Source data files field.
That’s it. We can develop numerous triggers to launch Jenkins — for example, a new commit inside GitHub or a deployment in a special operating environment.