Create multiple jmeter.log files - jmeter

I am using Jmeter for performance testing and running our tests via Jenkins build server.
We have Jmeter installed on our jenkins box and I am using an Ant build file to launch the jmx file and create the jtl report; which is then evaluated via the Performance plugin in Jenkins.
My problem is that we only have one instance of Jmeter and as such it only creates one jmeter.log file in the /bin directory.
As we will have multiple jobs calling the one Jmeter installation I don't want it, potentially, writing to the same log.
Is there a way of specifying multiple jmeter.log files per plan/job or amending the location?

Thanks for your suggestions. Using a Jmeter Ant Task and have managed to place the log file into the workspace of the jenkins job by the following:
jmeterlogfile="${basedir}/jmeter.log"
This sits within the JMeter tags within the build file.

Without changing .properties file, running jmeter from Windows cmd, simply navigate to bin folder and pass the argument -j[yourLogFileName.log], if you want log entries in a different log file.
C:\apache-jmeter-2.11\bin>jmeter.bat -j myLog.log

Related

How to install Jmeter on Gitlab runner machine?

I am new to using JMeter with GitLab CI/CD. I have created loadTest suite and want to configure it in Gitlab CI/CD pipeline. I have run.sh file in my loadTest project which do following:
Create and set up test data
Download JMeter dependencies and plugins (if JMeter already exists, skip this step)
Run the test
Clean up test data
Questions:
Is it a good idea to download JMeter in your project folder while you run the script or use JMeter docker image and run the tests ? I am concern about keeping JMeter folder in GitLab repo and occupying unnecessary space.
How to install Jmeter on Gitlab runner machine ?
Thank you in advance.
If your run.sh script downloads JMeter you don't need to put JMeter into Github repo. Using Docker is also possible, you can either check existing images or create your own with your own test data and plugins.
Gitlab runners are normal Linux machines (if you choose the relevant executor), my expectation is that your run.sh should work just fine there as it is (or with minimal amendments, like installing Java prior to installing JMeter)

java.io.FileNotFoundException With jmeter testplan while running it from Jenkins-Maven build

I am using File Upload (Post) Rest API in jmeter. file Path in the file upload section I have given as "File name" directly as its in the same folder where jmx file is.
Its working fine in jmeter ui but when running it through Jenkins I am getting file not found Exception.
how ever I am not sure whether I need to update anything in POM file or my jmx file it self to make jenkins find file path.
Current Scenario Jmeter:
jmx file location: xyz/test.jmx
Fie upload location: xyz/abc.file
file path in Jmeter UI(HTTP POST request): abc.file
Result: Working Fine
Current Scenario Jenkins:
jmx file location: xyz/src/test/jmeter/test.jmx
Fie upload location: xyz/src/test/jmeter/abc.file
file path in Jmeter UI(HTTP POST request): abc.file
Result: getting file not found exception
please suggest me solution if any I have already checked many blogs/answers. but none of them result my situation.
Thanks,
Divyang Raval
I believe when JMeter is being run from Maven it tries to look for files under the following folder:
target\jmeter\bin
So the options are in:
use full path instead of relative
copy the file from its original location to target\jmeter\bin folder using i.e. OS Process Sampler from setUp Thread Group
given you don't execute mvn clean copy the file to target\jmeter\bin folder once
The best solution would be using Jenkins Parameterisation, i.e. pass WORKSPACE Jenkins Variable property value to Maven build and access it in JMeter via __P() function

How to set path to the file location in the "CSV Data Set Config" if csv.file is located in bitbucket

I want to run Jmeter project in Jenkins. I commited project.jmx and related csv files in bitbucket. How can I set the path to the csv file located in bitbucket
CSV Data Set config will accept
Absolute path (the complete path like c:\path\to\csv\file.csv)
Relative path from the test (csvfolder\csvfile.csv)
csvfolder
csvfile.csv
.jmx
Assuming the 'csvfolder' folder is present where you have .jmx
If your folder structure is as given below,
csvfolder
csvfile
jmxfolder
jmx
then your CSV file path should be ../csvfolder/csvfile
Not sure about you specific combination, but usually if your files are in the same location you can refer to them by name only.
Let's say
%JMETER_HOME%\jmeter -n -t %LOAD_TESTS_RUNNER_%/_warmup.jmx
-Jusers=1 -Jrampup=5 -Jloop=2 -JpathToToken=Token.txt
Token.txt is just located in the same directory as *.jmx file.
Optionally, you could use system variables to contain your paths.
Depending on your Bitbucket underlying repository type you can configure Jenkins job to be triggered by commit using
Jenkins Git Plugin
Jenkins Mercurial Plugin
So you will be able to refer paths to JMeter .jmx and .csv files just using their names. Or if you prefer full paths - you can use WORKSPACE Jenkins variable like:
%WORKSPACE% - for MS Windows Family
$WORKSPACE - for Linux/Unix/MacOSX
See Continuous Integration 101: How to Run JMeter With Jenkins article for more information on running JMeter tests from Jenkins
How to read data from CSV File and run jmx for linux
If my jmx file is login.jmx
my input file is users.csv
what should be the syntax or command in linux

Atlassian Bamboo - Display JMeter test results using JMeter Aggregator plugin

I've been tasked to install and figure out how to use the JMeter Aggregator plugin for Bamboo on a locally built vagrant server with Bamboo on it on my machine so I can learn how to use it before putting it on the project that I'm working on's Bamboo instance but I can't figure out how to get the Aggregator plugin to actually read any of the test results properly so it keeps failing the assertions.
Currently, I've just set up a JMeter test through the gui client and saved the .jmx to my jmeter folder on the vagrant server so I can run it headless from a bash script and send the results to a .jtl file in another directory. Below is the bash script:
I've got the Aggregator plugin installed and I've pointed it to the resulting .jtl file but when I try and put any assertions on it, it breaks the build and says the assertion failed because the value was 0, which is not actually the case. Below is the current configuration I've got on the plugin - I've tried changing the filepath to an absolute one but that didn't fix it so I don't know if it's pointed at the wrong file or if it needs to be XML to do anything with the data it gets out?
If anyone could offer any guidance on this, I'd really appreciate the assist - been struggling with this for a couple of days now and there's precious little in the way of documentation on it...
I know it is an old post, I recently came across a similar issue.
hope this helps.
Bamboo looks for .jtl files in working directory of the job. So instead changing directory give absolute/relative path of the JMeter executable file changing the command to
bash <path to jmeter executable>jmeter -n -t <path to jmx>/steve.jmx -l results.jtl
While giving Build log file path use expression like
**/<file_name>.jtl (for picking up specific file)
or you can also use
**/*.jtl (to pickup all files available in working dir).

Bamboo Script Task using inline bat commands failing

Im new to Bamboo and just trying to run this two lines of code in the script task.
cd C:\apache-jmeter-2.11\bin\
jmeter-n.cmd Test.jmx​
It is failing and it is showing this message on the logs.
Failing task since return code of [c:\Program Files\Bamboo\temp\TEST-16-ScriptBuildTask-4637676047487491491.bat] was -1 while expected 0
Is path to JMeter correct?
Does Test.jmx script live in JMeter's bin directory
Do you have "java.exe" in your PATH environment variable? Does Bamboo pick it up?
Can you look into "C:\apache-jmeter-2.11\bin\Test.log" file to see whether they are errors there. If there is no such a file one of points 1-3 isn't met.
Are you aware of Bamboo JMeter Plugin?
By the way, Bamboo is capable of executing Ant or Maven tasks and JMeter test can be kicked off using these build systems as well.
References:
Automated Performance Testing using Maven and JMeter
JMeter Maven Plugin
5 Ways To Launch a JMeter Test without Using the JMeter GUI

Resources