JMeter Load Test: Disable/remove duplicate page and -0 -1 in result tree - jmeter

I export the jmx script from blazemeter chrome plugin.
Question 1:
My load test accurate or not if I disable or remove the duplicate url and .php or .json (it something like themes or scriptpage) because the page that I want to test actually without the extension.
https://i.stack.imgur.com/85IJs.png
Question 2:
What is the meaning of number -0 , -1 ,... in result tree .... as below pic?
https://i.stack.imgur.com/sEajc.png

If you want to exclude some specific URLs or patterns while recording, then use the Requests Filtering tab at the HTTP(S) Test Script Recorder
Please check this Guide for further reference: Excluding Domains from the Load Test.
This is basically the index of your sub-samplers. This SubResult Naming Policy is introduced from the JMeter version 5.0.
Before version 5.0, when your HTTP Sampler contained sub results, they would have their own names. In 5.0, a new custom naming policy was introduced for sub-samplers.
sub-result name = parent sampler name + index
Check this BUG 62550 for further reference.

Related

How can I add/import/include 'IncludeController' in JSR223/Groovy and use it in current TestPlan?

How can I access/use the specific test fragment file (jmx file) in the project use JSR223/Groovy code and use a specific Sampler?
For example, I have test fragments files [patientApi.jmx, doctorApi.jmx], each of these include fragment contains bunch of HTTP Requests (endpoint) with assertions and etc.:
patientApi.jmx:
{uri}/patientApi/getFirstName
{uri}/patientApi/getLastName
{uri}/patientApi/getDoctors
{uri}/patientApi/blaBla
doctorApi.jmx:
{uri}/doctorApi/getFirstName
{uri}/doctorApi/getLastName
{uri}/doctorApi/getPatients
{uri}/doctorApi/blaBla
So, I would like to know can I import/add/include in my new TestPlan these test fragments and disabled/enabled specific HTTP requests. It will give me the ability to create different test suites.
The only option I can think of is using an Include Controller per API endpoint and naming them according to the endpoint URL.
Once done you can put them under the Switch Controller and choose which one you want to execute by providing the relevant "Switch Value"
The "Switch value" doesn't have to be hard-coded, you can use a JMeter Variable there originating from i.e. CSV Data Set Config

Jmeter can get parameters?

My question is - if I run a test via Jmeter, for example , if it's a site which enables you to book a flight, and you choose your source and destination when you record it.
Is it possible to pass different values to the destination field? I mean, maybe a txt file with some destinations and pass it to the Jmeter test and then, you will have some tests which each of them is running with a different destination?
If yes, how can I do it?
It's not necessary that it will be a txt file. Just a way to pass different values to one parameter.
Important: I'm using blazemeter plugin for chrome.
Thanks a lot,
appreciated.
You can use CSV Data Set Config. It is very easy to use for parameterizing variables in the test plan.
Check this article on blazemeter to understand the CSV Data Set Config quickly.
Depending on what you're trying to achieve you can go for:
HTML Link Parser. See Poll Example which shows how you can use it for selecting random values from inputs
You can extract all the possible values from the previous response using a Post-Processor, most probably CSS Selector Extractor and configure each thread to use its own (or random) value from the input
And last, but not the least, you can use an external data source like .txt or .csv file and utilize __StringFromFile() function or CSV Data Set Config so each thread (virtual user) would read the next value from file instead of using recorded hard-coded values.

how to run multiple urls in jmeter and it should display on one screen

i am new to jmeter. i would like to run multiple urls at one shot and display the results on one screen. finding hard to config urls through csv file and in jmeter.
my sample url:
http://10.56.34.67:7065/services/sample/2070
http://10.56.34.67:7065/services/sample1/2070
http://10.56.34.67:7065/services/sample2/2070
like this i have more thn 100 url to test it.
could you please tell me the format to store urls in csv file and how to config the csv file in jmeter?
It has simple as
Click Ctrl+0,Ctrl+1 which adds Thread Group and HTTP Request in side
In HTTP Request add ${path} to Path field
In Thread Group choose Loop Count Forever
Add CSV Data Set Config by right click on Thread Group -> Add -> Config Element
CSV Data Set Config parameters :
a. Put the fileanme in Fileanme field
b. Enter in Variable Names path
c. Choose Recycle as False
d. Choose Stop Thread as True
Click Ctrl+R (run)
It will go through all URLs and submit them sequentially
To view results you can add View Results Tree (Click Ctrl+9) and you will see all your requests/responses.
It seems your data here is your URLs.
So instead of using multiple samplers for each URL, you can go for CSV Data config and store all your URLs there and name the column as URL.
you can refer to this in your single http sampler as ${URL}.
Your CSV should look like this
In Server name put ${URL} and in the Thread Group check the forever check box
You don't need CSV for this use case, the easiest way would be going for __StringFromFile() function.
In the HTTP Request sampler put the __StringFromFile() function into "Path" input field like:
The textual function representation is ${__StringFromFile(urls.txt)}, you will need to replace urls.txt with full or relative path to the file where your URLs are listed
That's it, each time the request is called JMeter will read the next line from the file and substitute request path with the string from file:
See Apache JMeter Functions - An Introduction article to get familiarized with JMeter Functions concept

Jmeter: String Index Out of Bounds Exceptions on Xpath

Can some one please please help me on this. I am tired of looking into it.
In while loop I am reading data from csv file, navigate to web pages and get Xpath values.
I get String Index out of bounds exceptions on Xpath.
Please see this screenshot of program
Steps to execute were
1.dealers.tt -- HTTP request
2.edit_integrtaion_details.tt --- HTTP request
3.Dealer details -- HTTP Request
then Xpath entities under Dealer details
For some reason some of the records read from file... only 2 steps get executed as below.leaving other steps (3 and Xpath)
dealers.tt
edit_integrtaion_details.tt
then I get an error as
'Dealer details' : java.lang.StringIndexOutOfBoundsException: String index out of range: 8193
I tried selecting redirect automatically and follow redirects in HTTP requests to force step 3 to execute. In both cases get this error.There are no spaces for the name I get from Xpath
Most likely you are sufferin from JTidy issue #205, the options are in:
Uncheck "Use Tidy" box, if your response is valid XML or XHTML it might be the case you don't need it (unlikely though)
Compile latest JTidy from the source code and once done replace jtidy-r938.jar in "lib" folder of your JMeter installation with the brand new JTidy jar.
Switch to CSS/JQuery Extractor
Switch to Regular Expression Extractor
If XPath is totally a must you can also consider JSR223 PostProcessor and Groovy language, it has built-in support of some form of XPath. Check out Groovy Is the New Black article for more details.

JMeter: How to record a script for specific domain URLs?

I am trying to capture a script using HTTP(S) Test Script Recorder in JMeter3.0. When I start start capturing, URLs from other domains for ex. download.cdn.mozilla.net are also getting captured. I don't want these URLs to be recorded, I want to record URLs for a specific domain only.
So, how to achieve this in JMeter3.0?
Note: I tried using URL Patters to Exclude but as I can not predict the other domain URLs, I don't want to use this option.
I also tried URL Patters to Include by specifying a specific domain i.e. ^((?!DOMAINNAME).)*$, but it is still recording the other domain URLs.
I would recommend breaking down your requirement into 2 parts:
Include your domain only
Exclude everything else
So, given I want to record JMeter Home Page and filter out any external resources the relevant configuration would be:
URL Patterns to Include: .*jmeter.apache.org.*
URL Pattens to Exclude: .*
Both inputs accept Perl5-compatible regular expressions so double check if the values your'e providing match (or don't match) the URL patterns captured by JMeter.
References:
JMeter Regular Expressions
Excluding Domains From The Load Test

Resources