Can we limit the number of request hits per second in karate - karate

I am using karate 0.9.0. I need to limit the request hits to 5 per second in my test suite due to threshold limit at gateway. is it possible in karate or not? If yes, how?

Here is the suggestion - configure headers as a JavaScript function. Within the function body - use a Java singleton (and a static method) to track how many requests have been sent and how much "sleep" needs to be added to maintain the required throttling / threshold.
You will need some Java skills to do this, all the best. The documentation has details on how to call Java code.

Related

How to send back to back http post request without waiting for response in Karate framework [duplicate]

I am using karate for automating the things in my project and I am so much exited to say that the way karate gives solutions on API testing. I have a requirement in my project where I need to check the effect on the system when multiple users are performing the same task at the same time(exactly same time including fraction of seconds). I want to identify the issues like deadlock, increased response time, application crashes etc... using this testing. Give me a glint that how can I get concurrent testing solution in karate?
There is something called karate-gatling, please read: https://github.com/intuit/karate/tree/master/karate-gatling

Karate Listener support

Does karate provide any listener support where I can intercept any specific things like rest calls?
This is more like added customization we want to perform apart from what the karate provides. There will be always something or other we need to customize based on the need.
Say that I have 10000 test cases running in parallel and using karate parallel runner I get a nice report with the time it takes for each step and test cases. One of my service is getting called multiple times and I wanted to know what is the average time the service takes out of all the calls. What is the maximum or minimum time it takes.
I think Karate Hooks will get you what you need - if you write a function to aggregate the responseTime.
I'm willing to look at introducing this feature if needed, but you'll have to make a proposal on what the syntax should look like. Feel free to open a feature request. Today we do have configure headers that is like a "before" for all requests. Maybe something along those lines.

JMeter - Limitation in HTTPRequest parameter

I'm using JMETER 2.4
I'm using HTTP request sampler with a Post action.
In this sampler, I have a parameter. The value for this parameter that I have to sent, is more than 5375 characters.
When I run this case in JMeter, the value seems to be sent from my end, but my website does not see this value.
When I check the check the received value using Fiddler the parameter is showing Empty.
After many try it seems JMeter has a limitation around 5375 characters for the parameter's value in a HTTPRequest sampler.
Do you know how to avoid this limitation?
In my opinion, you may have reached the maximum URL lenght (is 8K).
You may try if a more recent version has increased this limit, but probably even a real browser will find the same limitation.
A complete discussion about maximum URL length can be find here.
JMeter as of 2.9 has not such limitation, it respects HTTP Standard which puts a limit on a GET request length (as sbos61 pointed it).
But it seems from your question you are using POST (not GET).
Can you show your sampler configuration ?
Anyway I highly suggest upgrading to JMeter 2.9, I have just tested with this 2.9 version , and there is no problem.

Shopify API call limit for private apps

We are developing a private app for use with our Shopify store. To ensure we don't cross the API limits, we've implemented a basic configurable delay per API call.
We started with the documented API limit of 500 calls every 5 minutes, which mapped to a delay of 600ms per call. However, after 50 calls the server doesn't respond to the HTTP GET.
Even after we increased the delay to 1200ms per API call, it still fails after 50 calls.
We are using the Shopify4J on a store that is in a trial period (myfirststore-3).
I've looked at the wiki, api docs, forums and SO - but there is no mention of any other limit except the official 500/5min limit.
Are we running into a different call limit for private apps or trial stores ?
It seems the problem is in the java client implementation itself. We figured this out by adding all initializations inside our loop.
After making that change, we were able to make up to 500 API call per 5 minutes as documented.
We had added the apache httpclient library to the Shopify4J package to make it work on our backend servers, and it probably needs some tweaking. Ofcourse this is not a long term solution to our problem but it does answer this question.
Once we figure out the problem in our code, will post a comment here.

Benchmarking/Performance testing of the API - REST/SOAP

I'm trying to benchmark/ do performance testing of API's at my work. So the client facing is REST format while the backend data is retrieved by SOAP messages. So my question is can some of you share your thoughts on how you implement it (if you have done so in the past/doing it now), am basically interested in avg response time it takes for API to return results for the client
Please let me know if you need any additional information to answer the question
Could not say it any better than Mark, really: http://www.mnot.net/blog/2011/05/18/http_benchmark_rules
Maybe you should give JMeter a try.
You can try using Apache Benchmark.This is simple and quick
Jmeter gives you additional flexibility like adding functional cases along with performance details. Results will be almost similar to Apache Benchmark tool.
The detailed one which gives Functional Test Result, performance counters settings, Call response time details, CPU and Memory changes along with Load/Stress results, with different bandwidth and browser settings - Visual Studio Team system
I used VSTS2010 for performance testing. Also GET and POST are straight forward. PUT and DELETE need coded version of webtest.
Thanks,
Madhusudanan
Tesco
If you are trying to test the REST -> SOAP calls. One more thing you can consider is to have some stubs created (for backend). This way you can perf test REST -> Stub performance followed by Stub -> SOAP perfomance. This will help in analyzing the individual components.