I have a load test plan which posts requests to an API. After the API successfully processing these requests. There are Async processes that process these requests and store the processed request in a NoSQL database.
my goal of the load test is to see whether all my requests are successfully persisted in the database.
in order to test this- I have to save my hashkey and sortKey from my requests - how can this be achieved? and also once the load test is done I have to do these validations
so I have to write a separate validation script after sending the request . is my approach correct?
You could do it in a single shot like:
Send an API request using HTTP Request sampler
Extract the hashKey and the sortKey using a suitable JMeter Post-Processor (most probably JSON Extractor or JSON JMESPath Extractor)
"Wait" for the "async" process to finish by querying the NoSQL database under the While Controller
You can also put the whole sequence under the Transaction Controller so JMeter would measure the "end-to-end" time for the whole scenario
Related
I am new to jMeter so hope you can help me out.
I have a thread group with several HTTP request samplers. I am sending an email every time any sampler fails. The thing is I would like to collect the names + response bodies of the several failed samplers to send in the email.
Can anybody please give an example of how to do it?
The best solution would be using Simple Data Writer listener configured to save only failed requests, there you can choose whatever metrics you need to store:
Another option is using JSR223 test elements and Groovy language to extract the "interesting" fields from the failed requests:
in the above example the sampler gets the label and the body from the previous result and stores them into ${requestName} and ${responseData} JMeter Variables which you can use wherever you want. More information on these prev, vars and other JMeter API shorthands: Top 8 JMeter Java Classes You Should Be Using with Groovy
I make a post call to an api, and don't need to log the response (post to google cloud pubsub), but after that i need to measure time it takes for the data to be processed and appear in another GET request (need to keep hitting it unless the response changes).
I also need to measure the performance under load. I tried JMeter but could not figure out a way to get what I wanted. Is there a way to do this in Jmeter? or some other tool that will let me do what i want
You can put your "another GET request" under a While Controller so JMeter will keep sending this request unless it will match some defined condition
You can put the whole sequence of requests under the Transaction Controller - this way JMeter will measure end-to-end duration of the whole scenario
As per our project requirement , we have to write response time of each transaction to a DB During our Load test.
For web services scripts , we are using prev.getTime() function in Beanshell and write the response time of that transaction in a DB.
But for UI level scripts , we have to use transaction controller and under the transaction controller many HTTP requests are there. If we use prev.getTime() function it will fetch only the response time of last request .
If some one has solution for the above requirement, please share it...
If you're using Transaction Controller in Generate parent sample mode you can get the total duration of all nested samplers as prev.getParent().getTime()
See SampleResult.getParent() method JavaDoc for details.
I would recommend switching either to JSR223 Test Elements and Groovy language, since as when it comes to high loads Beanshell performance might be a big question mark. Groovy is Java-compliant (even more than Beanshell) so most likely you won't have to change a single line of code in order to migrate.
References:
BeanShell Scripting
JSR223 Elements
Apache Groovy - Why and How You Should Use It
our application is testing file upload and I'm curious if I can make Jmeter wait for a specific response and then report collective time.
What I have now is:
whileLoop()
-- HTTP Sampler
-- JSON Extractor
JSON Extracor pulls out a specific field and if it's not null then the loop stops.
The problem is that JMeter doesn't report response time as a sum of all the responses (response times) it had to make and that is what I'm looking for. Is there a way to implement this?
You can put this code inside a Transaction Controller .
You should get what you want.
I want to fire multiple soap requests with different data through jmeter and I want all the soap requests to hit the application concurrently. Also I would like to know if I can do the same thing with soap ui? If possible do describe the steps in detail. Thanks in advance.
For JMeter:
Add HTTP Request sampler to your test plan
Add Switch to "Body Data" tab and put your XML payload skeleton there
Substitute the parts of the body you want to parameterise with JMeter Variables or Functions, the most commonly used for parameterisation test elements are:
CSV Data Set Config
__StringFromFile()
__FileToString()
__CSVRead()
For "concurrency" you also have different options:
If you want X threads to execute requests as fast as they can - just specify them in Thread Group
If you want X requests per second - go for Constant Throughput Timer
If you want all requests at exactly the same time - Synchronizing Timer
For SoapUI check out Simulating Different Types of Load article