When using .Net application,
and checking error logs,
getting below error: Object reference not set to an instance of an object.
Most probably you're sending the wrong request due to missing or improperly implemented correlation
So if you have recorded a request using HTTP(S) Test Script Recorder most probably there is at least one parameter there which is supposed to be dynamic, to wit
extracted from the previous response using a suitable JMeter Post-Processor
stored into a JMeter Variable
and the dynamic variable to be sent along with the request instead of recorded hard-coded value
In .NET web applications the most commonly used parameter is ViewState, however other may also be required like EventValidation
so given you properly handle these dynamic parameters you should start getting "good" responses, see ASP.NET Login Testing with JMeter for example handling of the dynamic parameters.
Also don't forget to add HTTP Cookie Manager to your test plan.
Related
A dynamic value that appears in the subsequent web requests appears in the Request Header throughout the script. I am unable to correlate this value as it is not available in response header / body section. How can I now correlate this value?
I have tried recording using VUGEN - HTML & URL Mode. I have also used Fiddler as well as HAR files exported via Chrome Developer Tools. None of them have any additional request/responses that could have been potentially missed while recording with VUGen or other tools.
The dynamic value appears in the Request Header like this :
Reference:
https://*****/suite/sites/ecase-case-worker/page/home/start-process/iUBVQU4qoHEAl9UkPVyXKjTxMt3bz-olj7yCJ6dulSOHbmIIDal?parameters=**855b2a7b-a175-49e6-9ee0-7b7f37667197**
The "855b2a...." value appears throughout the script in different places like this below :-
web_custom_request("iUBVQU4qoHEAl9UkPVyXKjTxMt3bz-olj7yCJ6dulSOHbmIIDal",
"URL=https://****/suite/rest/a/sites/latest/ecase-case-worker/page/home/startProcess/iUBVQU4qoHEAl9UkPVyXKjTxMt3bz-olj7yCJ6dulSOHbmIIDal?cacheKey=**855b2a7b-a175-49e6-9ee0-7b7f37667197**",
I have manually verified in the application that it this value keeps changing every single time "Create application" link is clicked. Is there a way to capture this dynamically changing value?
If this is not sent to you from the server, as a correlated value, then what remains is that the value is generated on the client, likely as a part of a JavaScript function output.
Speak with the developer of your application about the location of the generation of this value. If it is locally generated then simply execute the JavaScript inside of your HTTP script or reproduce the algorithm in C for native inclusion in a C HTTP virtual user. You have some alternate paths as well, which includes the newer JavaScript based virtual user, Truclient (which runs a full browser), Citrix, RDP or GUI virtual users.
With Truclient, Citrix, RDP or GUI you are simply going to run a full browser and inherit the JavaScript execution and inclusion of the key value as a part of full stack execution.
The Fiddler recording helped in identifying the correlation value as it was hidden in one of the EXTRARES references, which wasn't captured anywhere by the VUGen. The request had to be subsequently added manually into the script to pick up the dynamic value in it's response.
Just like how the response information can be accessed through response, responseHeaders etc, is there any way to access the request information? I noticed that request information is not available through variables. Are there are any workarounds to access this information?
I understand that we build the request ourselves in the test scenario using the Given, When steps, so it may sound redundant. The reason I'm looking for this is I would like to access the complete request details Karate would've built using our test definition. The idea is to make this information available to a java class which can be called through the Java Interop. More specifically, I'm trying to build a swagger request and response validator to be used from karate.
The workaround I am using is to explicitly create variables like apipath and apimethod and use them with path and method. This does the job, but still one has to ensure that these variables are explicitly set. It will be cleaner if whatever request Karate built is just accessible through a variable.
Please raise a feature request. We can look at making this available as karate.request or similar.
How can I handle data from ":/some/api/link" while I am recording using JMeter it works and when I try it again it shows "null" message in 'View results tree'.
In the majority of cases you won't be able to record and replay you test as modern applications and web APIs normally use dynamic parameters for authentication and security purposes. So most probably your Test Plan should look as follows:
1st request
Post Processor (in case of REST API it will be JSON Extractor, in case of SOAP API it will be XPath Extractor) to extract any dynamic parameters and save them into JMeter Variables
2nd request where you should replace hard-coded recorded values with the variables defined in the previous step
The easiest way to detect the dynamic parameters is recording your test 2 times and compare the generated requests, you will need to correlate parameters which differ.
See API Testing With JMeter and the JSON Extractor for more details.
I'm creating a 50 users load test on a JSF web application.
I record a scenario using JMeter proxy for one user who logs in, does some db operations and logs out. After recording the scenario, the recorded test contains http requests and data that particularly belongs to the user used while scenario recording.
At the time of running the test for 50 unique virtual users, the recorded test sends http requests and data which was in the recorded scenario. But in our application, the http requests and data vary depending upon the user. So how do I handle such situations in JMeter when it comes to methods being called depending upon the existence or non-existence of data for a user after logging in?
To be precise how would I make changes in my Test plan to manage dynamic urls and dynamic data for each virtual user?
Latest versions of JMeter allow you to write the whole parameters (raw data) from scratch, so you could use variables in this field.
To achieve dynamic URLs use a Regular Expression Extractor (Post-Processor) on a prior request that define what request will be sent and use the variable in HTTP Request's path field.
If you know what request each type of users will send you could use If Controllers and test a thread variable, created by a previous Regular Expression Extractor, and inside each controller add the specific request.
If the subsequent request for each user is defined by the server, using redirection, just check "Follow Redirection" field.
See JMeter Wiki for more examples on how to do this.
I am trying to solve following problem:
I have a system with which communication is done through SOAP (XML over http).
In Jmeter I am using SOA/XML-RPC (not wsdl based webservice).
I am sending one SOAP request and receiving response in vollowing tag
<Prodrevision>5</Prodrevision>
This number changes from time to time and goal is to get that number in that tag put it as user defined variable and pass it to another SOAP/XML-RPC
Mine jmeter test plan looks like that
-User defined variabla - here I have empty varaibla named "var'
-SOAP/XML- RPC (this SOAP REQUEST causes that RESPONSE is received)
- XPath Extractor with
reference name: var
XPath Query: //*[local-name()='Prodrevision']/text()
(this should according to FAQ's process/parse response and asssign it to variable var)
-SOAP/XML-RPC - and in this XML request SOAP/XML-RPC data field has
..xml data
<Prodrevision>${var}</Prodrevision>
...xml data
But I am not sending anything in the second request ??? mine requests hits server but there is no value.
Where I made a mistake?
Whenever you see ${variableName} in the request, it means the variable hasn't been defined. Most likely, it's an issue with how XPath is setup. I've never used that component, so unfortunately I can't help you there.
However, I've found the post processor Regular Expression Extractor to be very easy and accurate.
The structure would like this:
1st Soap Request
-- regular expression stored to "var"
2nd Soap Request, using ${var}
The problem has been partially solved.
There was an issue in a wrong or badly, for JMeter, defined XPath query
reference name: var
XPath Query://name[contains(text(),'Prodrevision')]/parent::multiRef/value
After the XPath query I have added beanshell postprocessor with following code
print("Beanshell processing SOAP response");
print("var" +${var} );
So finally I see what value is being grabbed by the XPath extractor.
I have also installed xpather 1.4.5 as a Firefox add-on. And opened XML response and tuned a bit XPath query to have a proper answer. Then this was copied to JMeter and worked.
Next, in SOAP request that had to be sent by JMeter, I have put my XPath extractor value in the following way:
<name xsi:type="soapenc:string">Prodrevision</name>
<value xsi:type="soapenc:string">${var}</value>
and this again worked well for one thread.
Problem at this moment is with threads. If there is more than 1 (one) thread, it is generating wrong requests :-(