I have my JMeter scripts (.jmx) ready to run a performance test.
The script works fine and the HTML reports are generated, but the report does NOT have any information on which environment(ST/ET/QA) the tests was run against .
Is there any way to add environment/custom information to the report?
Command:
Jmeter -n -t -Jenv="ST" test.jmx -l output.jtl -e -o Dashboard
test.jmx = script which is auto-generated
output.jtl = user defined file for output
Dashboard = user defined directory to store HTML dashboards
I believe you're looking for the jmeter.reportgenerator.report_title property so if you run the report generation as:
Jmeter -n -t -Jenv="ST" -Jjmeter.reportgenerator.report_title=ST -l output.jtl -e -o Dashboard
More information:
Overriding Properties Via The Command Line
Apache JMeter Properties Customization Guide
#Dmitri T shared the right link. One thing I want to add that you can choose what info to write to the logs through the Results tree settings. See the screenshot
here
Related
I am currently using JMeter 5.1.1 on a Mac and have developed a very simple JMeter project to test out property value substitutions via Command Line. My JMeter project is pretty simple with a Dummy Sampler trying to print out the following
${__P(resources.folder)}, ${__P(propertiesfile)} and ${__property(propertiesfile)}
Link to JMeter project image
I am trying to run this project via CLI using the command
jmeter -n -t TestProj.jmx -l jmeter/TestProjResults.jtl -j jmeter/TestProj.log -Dresources.folder=/Users/h244955/Coding/bga/spogdashboard/tests/perf -Dpropertiesfile=baforgeperfproperties
The values are not getting substituted and I am seeing the following in the log:
2019-10-22 20:48:09,531 DEBUG o.a.j.e.u.ValueReplacer: About to replace in property of type: class org.apache.jmeter.testelement.property.StringProperty: ${__P(resources.folder)}
${__P(propertiesfile)}
${__property(propertiesfile)}
2019-10-22 20:48:09,533 DEBUG o.a.j.t.p.AbstractProperty: Not running version, return raw function string
2019-10-22 20:48:09,533 DEBUG o.a.j.e.u.ValueReplacer: Replacement result: ${__P(resources.folder)}
${__P(propertiesfile)}
${__property(propertiesfile)}
2019-10-22 20:48:09,534 DEBUG o.a.j.e.u.ValueReplacer: About to replace in property of type: class org.apache.jmeter.testelement.property.StringProperty: Dummy Sampler used to simulate requests and responses
without actual network activity. This helps debugging tests.
2019-10-22 20:48:09,534 DEBUG o.a.j.e.u.ValueReplacer: Replacement result: Dummy Sampler used to simulate requests and responses
without actual network activity. This helps debugging tests.
2019-10-22 20:48:09,534 DEBUG o.a.j.e.u.ValueReplacer: About to replace in property of type: class org.apache.jmeter.testelement.property.StringProperty: ${__Random(50,500)}
2019-10-22 20:48:09,534 DEBUG o.a.j.t.p.AbstractProperty: Not running version, return raw function string
2019-10-22 20:48:09,534 DEBUG o.a.j.e.u.ValueReplacer: Replacement result: ${__Random(50,500)}
However, when I run this project from GUI with the help of declaring the same properties using a JSR223 Sampler, the values are getting substituted in the Dummy Sampler as expected. I tried looking around for answers for the highlighted log above, but in vain.
You need to override JMeter property using -J:
jmeter -n -t TestProj.jmx -Jresources.folder=/Users/h244955/Coding/bga/spogdashboard/tests/perf -Jpropertiesfile=baforgeperfproperties -l jmeter/TestProjResults.jtl -j jmeter/TestProj.log
-D[prop_name]=[value]
defines a java system property value.
-J[prop_name]=[value]
defines a local JMeter property.
To add additional JMeter property file use -q
-q, --addprop <argument>
additional JMeter property file(s)
I cannot reproduce the issue:
so my expectation is that your JMeter installation is broken somehow, i.e. make sure that ApacheJMeter_functions.jar file is present in "lib/ext" folder of your JMeter installation
Make sure to get JMeter from the official downloads page and check the downloaded archive integrity, check How to Get Started With JMeter: Part 1 - Installation & Test Plans article for details.
Make sure to launch JMeter from its "bin" folder, to wit
cd /path/where/jmeter/lives/bin
./jmeter -Dpropertiesfile=baforgeperfproperties -n -t test.jmx ....
this ./jmeter bit is important to ensure that you launch JMeter from the current folder, not from another folder in your MacOS PATH
When I run a baseline scane on a target I get the following result:
docker run -t owasp/zap2docker-stable zap-baseline.py -d -t https://mytarget.com
Result:
WARN-NEW: HTTP Parameter Override [10026] x 3
What does this result mean? What this scan is about?
Interesting timing, this was just being discussed on the issue tracker the other day: https://github.com/zaproxy/zaproxy/issues/4454
The thread that started it all: http://lists.owasp.org/pipermail/owasp-leaders/2012-July/007521.html
Basically it has to do with forms that don't have actions, or that propagate GET paras into form actions. (Mainly impacting JSP/Servlet).
Edit: Of course you could also use the -r report.html (or any of the reporting options) to get full details vs. just the summary.
-r report_html file to write the full ZAP HTML report
-w report_md file to write the full ZAP Wiki (Markdown) report
-x report_xml file to write the full ZAP XML report
I'm running apache jmeter 3.3 on centos command line and generating ".jtl" Summary Report file using following command
./jmeter -n -t requests.jmx -l log.jtl
Can I generate some file and view result tree by importing file to apache jmeter GUI. If yes , then how.
To do that, just add a View Result Tree to your test and fill in the filename field:
Ensure you check the fields you want by clicking on "Configure":
Note that the more you save things the more you impact performances of JMeter
You can run your test as:
./jmeter -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.response_data=true -Jjmeter.save.saveservice.samplerData=true -Jjmeter.save.saveservice.requestHeaders=true -Jjmeter.save.saveservice.url=true -Jjmeter.save.saveservice.responseHeaders=true -n -t requests.jmx -l log.jtl
Alternatively you can add the next lines to user.properties file (lives in "bin" folder of your JMeter installation)
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.responseHeaders=true
This way JMeter will store results in a way they could be examined in the View Results Tree listener.
References:
Configuring JMeter
Results file configuration
Apache JMeter Properties Customization Guide
I want to start load testing by running JMeter from command line for more accurate test results, but how can I monitor the run and then analyze the results after the test finishes.
You can generate JTL (JMeter results) file while executing the JMX (JMeter script) file from command line. A sample command for generating JTL file will look like this..
jmeter -n -t path-to-jmeterScript.jmx -l path-to-jtlFile.jtl
After completion of script execution you can open the JMeter GUI and simply open the JTL file in any listener (as per your requirement).
Most of the listeners in JMeter have an option to save the results into a file. This file contains usually not the report itself, but the samples which are generated by the tests. If you define this filename, you can generate the reports using these saved files. For example see http://jmeter.apache.org/usermanual/component_reference.html#Summary_Report .
If you run JMeter in command-line non-GUI mode passing results file name via -l parameter it will output results there. After test finishes you will be able to open the file with the Listener of your choice and perform the analysis.
By default JMeter writes results in chunks, if you need to monitor them in real time add the following line to user.properties file (lives under /bin folder of your JMeter installation)
jmeter.save.saveservice.autoflush=true
You can use other properties which names start with jmeter.save.saveservice.* to control what metrics you need to store. The list with default values can be seen in jmeter.properties file. See Apache JMeter Properties Customization Guide for more information on various JMeter properties types and ways of working with them.
You can also consider running your JMeter test via Taurus tool - it provides some statistics as the test goes either in console mode or via web interface.
As like we pass the browser name and other details from command prompt in codecetion, can we pass any variable which can be used within the script from command prompt?
I didn't find any way to do it in documentation and other feeds.
I add pull request for this ability use params from console in tests
When it will be merged in master you can run tests like this:
php codecept run -p "site-id: 123456, group: admin" -p "duty: free"
You can find more information in PR.