JMeter Response Times Over Time too many UseCases - jmeter

I've created a JMeter load test to test our API.
Currently we have four defined Use Cases that we want to test.
The Testplan is set up like this:
When I execute the tests, the report for the Response Times Over Time looks like this:
I would have expected to find only the four defined Use Cases... what are the other Use Cases shown in the graph and how can I group them?
Thanks in advance

You can put your "Use Cases" under the Transaction Controller and tick "Generate parent sampler" box
Another option is filtering the samplers labels you want to see at the charts via jmeter.reportgenerator.exporter.html.series_filter property

Related

Generate JMeter custom pie chart

I'm looking for a way to display pie chart/table after running 100 tests, but all available built-in reports seem to accumulate data on time spent per sample, controller and about performance metrics.
Although tests mostly check performance and some metrics are usefull, we also need statistics on actual response data.
Each http request queries service for items availability per product.
After tests finish we also would like pie chart appear with 3 sections:
Available
Low on stock
Unavailable
Now, I found "Save Responses to a file" listener but it generates separate files which isn't very good. Also with "View Results Tree" we can specify filename where responses will be dumped.
We don't need the whole response object and preferably not even write anything to disk.
And than, how to actually visualize that data in JMeter after tests complete? Would it be Aggregate Graph?
So to recap: while threads run, each value from json response object (parsed with JPath) should be remembered somewhere and after tests complete these variables should be grouped and displayed as a pie chart.
I can think only of Sample Variables property, if you add the next line to user.properties file:
sample_variables=value1,value2,etc.
next time when you run JMeter test in command-line non-GUI mode the .jtl result file will contain as many extra columns as you have Sample Variables and each cell will contain respective value of the variable for each Sampler.
You will be able to use Excel or equivalent to build your charts. Alternatively you could use Backend Listener and come up with a Grafana dashboard showing what you need.

How to also Ignore the Parent sample generated by the Transaction Controller along with it's children samples?

I am using JMeter 5.5 to put load on some webpages.
I have some webpage navigation flow recorded and I am using The Transaction Controller with the "Generate parent sample" checkbox checked to represent a webpage navigation (load). Underneath the Transaction Controller are the some HTTP Request samplers with "Retrieve All Embedded Resources" checked.
I want to ignore the first and last minute of script execution so I am using a JSR223 Postprocessor with code to conditionally ignore the samples based on the current time in the execution.
This works well if I don't use the Transaction controller, but when I use the prev.setIgnore() function and the sampler being ignored is underneath a Transaction controller with the "Generate parent sample" checkbox checked, then in the "View Results Tree" listener (and also in the JMeter Dashboard) I get an empty parent sample with Load time:0; Connect Time:0; Latency:0. This impacts my metrics in the final generated report.
Is there any way to ignore the Parent sample as well (remove it from the reporting) or can I achieve the goal in a different way?
Thanks in advance.
I think you need to replace prev.setIgnore() with prev.getParent().setIgnore()
In general ignoring samples with Groovy is not something I would recommend to do as it causes extra overhead, I would rather suggest using
either Filter Results Tool
or JMeter Plugins Command Line Tool
or use jmeter.reportgenerator.start_date and end_date properties in case of using HTML Reporting Dashboard

How to run jmeter samplers for specific throughput

I am using jmeter to load test my application.I have a sampler under Transaction Controller.But we have updated some of the parameters in the request.So i want to run 90% time old sampler and 10% of time new sampler,which are almost doing same thing but only have some extra parameters in second sampler.I tried checking switch controller but could not figure out if it will work for my requirements.My test plan looks similar to this
If you want to continue with the Switch Controller you can proceed with the following "Switch Value" (or equivalent)
${__javaScript( var s="000000000001"; s.charAt( Math.floor(Math.random()*s.length) ))}
Another options are in (you may find them easier to implement):
Throughput Controller
Weighted Switch Controller
More information: Running JMeter Samplers with Defined Percentage Probability

Disable/Enable all Test Action controllers in JMeter test

I have placed many DIFFERENT think times (pauses) in JMeter test. In this way I am trying to simulate real user think times, because at different places user will need different times to think/wait. Sometimes he will need 5 sec to figure out his next action, and sometimes he will need 15 sec. As I manage to check Test Action Controllers are the only way for me to do this. BUT, my problem is that while I am creating/repairing test I don't want to wait for all these pauses when I run the test just to check whether my change is passing. I want some way to easily disable all Test Action controllers during creation of test, and then when I want to run real test with bunch of concurrent threads then just to easily enable all pauses.
You first modify your Test Action this way:
Set sleep to 0
Add as a child to each one a Timer with pause you want
Then
There is a menu called Start no pause in the GUI which is here exactly for this need:
http://www.ubik-ingenierie.com/blog/jmeter-new-gui-features-to-increase-your-productivity/
There is also since 3.0 a "Validation Mode" that you can acces by right click on Thread Group and select validate
https://jmeter.apache.org/changes.html
I believe the easiest way of doing it is running your test via Taurus tool. It has possibility to enable/disable Test Elements basing on their names so you will be able to switch your Test Actions samplers on and off.
See Modifications for Existing Scripts chapter for more details.
Example Taurus YAML config to disable Test Action samplers. Save it as i.e. test.yml in the same folder your .jmx script lives
---
scenarios:
modification_example:
script: test.jmx # Name of your original JMeter test script
modifications:
disable: # Names of the tree elements to disable
- Test Action
execution:
- scenario: modification_example
Running bzt test.yml -gui command will open JMeter GUI with modifications applied.
Taurus entry level information: Navigating your First Steps Using Taurus
Don't waste your time trying "Run no pauses" and "Validate" options, the guy doesn't seem to know how does JMeter work.
All right, here's JMeter-only solution via Beanshell Sampler
import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
import org.apache.jmeter.sampler.TestAction;
GuiPackage guiInstance = GuiPackage.getInstance();
guiInstance.getTreeModel().getTestPlan();
List testactionlist = guiInstance.getTreeModel().getNodesOfType(TestAction.class);
for (Object testAction : testactionlist) {
JMeterTreeNode testActionSampler = (JMeterTreeNode) testAction;
testActionSampler.setEnabled(false);
}
I used Test Actions because I did not understand how timers are working. I thought they are always applied to all samplers (which is not true). I can easily accomplish what I want with constant timer. So using test actions wasn't a must. I will just add constant timer to specific sampler and it will be applied only to this sampler. Sorry if I made confusion with a way I asked the question :(
If you open the test in any text editor you will see all the test actions like
you can easyly find & replace all " testname="Test Action" enabled="true" " to enabled="false"

Call function in user parameter definition

I'm running a set of thread groups (consecutively) and I need to reset a number of parameters at the start of each thread group so that they have a unique value.
Presently I'm referencing a User Paramaters node using a test fragment, and setting the value to value-${__time()}. Unfortunately, this results in the value being used verbatim (without resolving the time).
Is there a better way to achieve per-thread group variables that include function calls?
Works fine for me (Jmeter 2.5.1), as per below example.
Sample params set to ${__time(HMS,)} and value-${__time()} successfully resolved, generated and updated (once per iteration) for each thread (in this case:3 Thread Groups, 5 threads # 3 loops).
Can you please answer why are you using User Parameters via Test Fragment (as per your post)?
...And several articles, just fyi:
Parametrization in JMeter with user parameter
JMeter Variables vs. Properties. vs. Parameters
UPDATED:
Please find below results for example with both User Params and test logic put into Test Fragment and called from Module Controllers.
Works the same way as in sample above: successfully resolved, preserved between samplers in separate loop and updated (once per iteration) between loops for each thread (well, I 've commented in screen the rest of thread groups to get output for the first only; works fine with all TGs enabled too).
I think you could also try to put User Params config from Test Fragment to each thread group and leave in Test Fragment only test logic - if the above schema will still not work for you:
It's not very nice but both the Module Controller and Include Controller are still quite "buggy" and sometimes unpredictable.
You could also try to debug problem controllers in your scenario: select controller > click Help in jmeter's main menu > click Enable Debug > look into jmeter.log for details after execution.
You could also look onto custom Parameterized Controller - maybe it will work better.

Resources