why won't Jenkins write the ouput of my jmeter test to the specified logfile? - batch-file

I have set up Jenkins to run my parameterized jmeter test (with the kind assistance of knowledgeable users here). I'm not using any other build technologies at the moment. I can run my tests and see the results in Jenkins as expected. However Jenkins is not writing the test data to my specified logfile. Here is my Windows batch script in Jenkins: C:\Users\MikeL\Documents\apache-jmeter\bin\jmeter.bat -n -t C:\Users\MikeL\Documents\apache-jmeter\bin\testApp.jmx -l log.jtl -Jenv=%env% -JloopCount=%loopCount% if I run jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1 from the windows cmd prompt inside of jmeters bin dir It does create the log file as expected. If anyone knows why the Jenkins script won't output it I'd be very obliged.

Related

Jenkins Output Incomplete Log to the Console - SilkTest

I have a Jenkins pipeline that will run a batch file which contains command to run silk test. The part of the pipeline is as follow:
stage('execute-testscripts') {
steps {
script {
bat "cd Automation"
bat "C:\\Users\\Administrator\\Desktop\\silk_test.bat"
}
}
}
The content of silk_test.bat is as follow:
"C:\Program Files (x86)\Silk\SilkTest\ng\gui\STW.exe" -d examplexx -u example_id -p xxxxxx -r MY_EXAMPLE -s "ExampleXML" -verbose >> output.txt
type output.txt
del output.txt
When I execute the batch file on the command prompt on the Jenkins slave (via Remote Desktop Connection), the result is as follow (some details are hidden):
However, when I run the build on Jenkins, the console output is incomplete (doesn't show the output after the line "VERBOSE MODE: ON"):
[The same command is being run on the same Jenkins slave]
Is there any way to fix the Jenkins pipeline so that it displays the complete console output?
The issue is resolved by running the Jenkins slave agent as a Windows process, rather than running it as a Windows service, so that the process can interact with the applications.

difference between jmeter.bat/jmeter.sh And jmeter.file

I would need clarification on jmeter.bat/sh and jmeter.FIle which are in bin folder.
With example:
1.If i setup different HEAP size in jmeter and jmeter.bat/sh file,which one will be considered.?
2.Does the above depend on how i run the test?(for ex: jmeter -n -t or jmeter.bat/sh -n -t)
3.If the test started with jmeter command instead of jmeter.bat ,will intern jmeter.bat be called and hence heap in jmeter.bat be used or vice-versa?
Update1: Adding screenshot where we can see jmeter/jmeter.bat/jmeter.bat files
You should update one file based on your OS Windows/ Unix
To run JMeter, run the jmeter.bat (for Windows) or jmeter (for Unix) file.
Both execute internally ApacheJMeter.jar
In windows execute jmeter -n -t is actually calls jmeter.bat
In Unix you can call either jmeter or jmeter.sh
Looking into your screenshot it seems that you're running Windows so the only file you should be considering is jmeter.bat
If you want to change JVM Heap it's better to go for changing HEAP environment variables on Windows level like:
set HEAP=4G && jmeter.bat
when you type jmeter Windows is looking for a relevant executable or shell script first in the current folder than on PATH so jmeter will call jmeter.bat if you're invoking it from JMeter's "bin" folder, if you do it from another folder the command-line interpreter will look for it in PATH and if nothing will be found - it'll fail with "'jmeter' is not recognized as an internal or external command,
operable program or batch file."
More information: How Do I Run JMeter in Non-GUI Mode?

Creating Jmeter Report

I have a scheduled load test which runs daily. Scripts are triggered from CLI (.bat file) and will be creating a html report at the end of the test.
I am saving test report with testnameDATE, where currently the date part is updated manually.
I tried to automate the date part to get the system date on run time using '${__time(MMddyyyy)}', but for html part its not working and report is not getting created.
Eg:
D:
cd D:\Performance Testing\Tools\apache-jmeter-3.0\bin
jmeter -n -t "D:\Performance Testing\batch\DailyRun\Test_DailyRegression.jmx" -l "D:\Performance Testing\batch\DaiyRun\csv\Test${__time(MMddyyyy)}_001.csv" -e -o "D:\Performance Testing\batch\DaiyRun\html\Test${__time(MMddyyyy)}_001.html"
Windows doesn't know anything about JMeter Functions, given you run your JMeter test in command-line non-GUI mode you will need to use date command instead like:
jmeter -n -t ..\extras\Test.jmx -l Test_%date:~10,4%%date:~4,2%%date:~7,2%_001.csv
Demo:

Run selenium test on Jenkins

I have tests in Visual Studio 2012, for the web site, I want to run those tests automatically from Jenkins, I write a windows batch command
<Path to PsExec.exe> -i \\remotemachineName -u UserName -p password <vstest.console.exePath> <Path to the MyTest.dll on the remotemachineName> /logger:trx
but no tests are running, if I execute the same command on the remotemachineName directly the tests runs, but not from jenkins
I put this command on batch File, try to run it from directly on remotemachineName : it's ok, but not from jenkins
use "BUILD_ID=dontKillMe" process tree killer
reference : https://wiki.jenkins-ci.org/display/JENKINS/ProcessTreeKiller

Batch file to run JMeter script

I have a .jmx file of all of my test plans and I want to create a batch file. When I click that, everything starts and ends automatically. So that I can provide it to my client as well to verify that I have performed the load test on his website. How can I achieve this?
jmeter does not support running batch of .jmx files as document part 2.4.3 (Command Line Mode) gives to us.
I would recommend you to try 2 approaches:
1) to follow best practices of running jMeter in non GUI mode.
In accordance to this approach you are expected to use the command
jmeter -n -t D:\TestScripts\script.jmx -l D:\TestScripts\scriptresults.jtl
Where the pareameters:
-n [This specifies JMeter is to run in non-gui mode]
-t [name of JMX file that contains the Test Plan]
-l [name of JTL file to log sample results to]
-j [name of JMeter run log file]
2) to use any cloud service for running your .jmx file.
BlazeMeter (http://blazemeter.com/) worked for me fine.
One can adjust the test plan settings.
Testing results can be seen on “Load Report” tab as soon as test finishes.
For detalization one can follow Getting Started: Scripting with JMeter steps.
Hope this works for you.
Just write the following command in a text file and save this file as SomeName.bat
#ECHO OFF
jmeter -n -t "Your .jmx file path" -l "Your .jtl file path"
For example:
#echo off
jmeter -n -t F:\DEV\WORKSPACE\buyer.jmx -l F:\DEV\WORKSPACE\output.jtl
After saving click on that bat file. The test plan result will be stored into .jtl file.
Note: Make sure you put this bat file into JmeterinstallationDirectory/bin folder.

Resources