Insomnia same request with different data - api

I'am trying to write unit tests for each one of my requests in insomnia.
Is there a way to access the request in javascript and modify the body/query params? I want to test the different edge cases.
Are the insomnia js functions documented anywhere?

Related

API requires HMAC authentication JMeter

I am getting error when setting up API test in Jmeter, same is working fine in POSTMAN.
Using HMAC authentication.
I have some basic knowledge of Jmeter new to the tool.
https://developer.firstdata.com/marketplace/api/authentication.html?shell#authentication.
Postman Pre-request Script
And Postman Header details
Postman API response is working fine.
Same as been work in Jmeter but I' getting response message as {"message":"HMAC signature cannot be verified, a valid date or x-date header is required for HMAC Authentication"}
I have added JSR223 PostProcessor and HTTP Header Manager.
and here are the details for both image attached below.
** JMeter - JSR223 PostProcessor**
JMeter HTTP Header Manager
Copying and pasting code from Postman won't work in JMeter because:
Postman is a browser extension and is capable of executing JavaScript and according to JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
If you're trying to run JavaScript code you need to choose the appropriate language from the dropdown
JMeter doesn't include CryptoJS library, you will need to download it and load before running the JavaScript
Since JMeter 3.1 it's recommended to use Groovy language for scripting as this option provides maximum performance especially when it comes to "heavy" cryptographic operations so I would recommend re-writing your code in Groovy
I see you like screenshots so I include an example implementation as a screenshot here:
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It

Does GET endpoint triggers underlying APIs on request (with Postman or JMeter)

I'm creating load testing with JMeter.
We have A Single Page Application (React).
Let's say I need to check the endpoint
GET /foo
When you go to that endpoint via the browser it triggers API endpoints (javascript fetch) to retrieve data. Let's say 2 endpoints
GET /api/fooData, GET /api/fooCalendar
My question is: If I request GET /foo with JMeter (or Postman for instance), will it trigger the other endpoints behind the scene like a normal user flow, or I would need to manually check all the endpoints that are being triggered?
As per JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
So you will have to create separate HTTP Request samplers for each JavaScript-driven calls. If the calls are made in parallel - it would be better to put them under the Parallel Controller as JMeter executes Samplers sequentially (upside down)

Easily Generate Mock HTTP Response for TestCafe

I am attempting to mock some responses in TestCafe and mocking the responses is pretty slow going. The workflow I would like is something like this:
Walk through a test scenario in Chrome.
Copy the selected network request to mock as a curl command.
Paste it in to a curl command to Testcafe translator.
Paste it in to testcafe.
I haven't found a good way to generate mock requests other than manually typing them out by hand. Is anyone aware of any tools which allow you to translate a fetch or curl command to TestCafe mock response?
The RequestMock.onRequestTo method gives an ability to identify and filter requests by their urls or parameters. You can simply copy a request url and response body from the Chrome DevTools Network tab and pass them to the onRequestTo and respond methods.

How can i use Jmeter as a normal browser?

I am using jmeter for performance testing
but jmeter only accept JS call they can not pass request like URL.
so my question is that how can i user jmeter as a normal browser for
load testing ?
As per JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
It is possible to configure JMeter to behave more like a real browser when it comes to normal HTTP requests given you:
Tell JMeter to download embedded resources (scripts, styles, fonts, images, sounds, etc.) in parallel
Add HTTP Cache Manager to mimic browser cache when it comes to handling the aforementioned embedded resources
Add HTTP Cookie Manager to represent browser cookies
Add HTTP Header Manager to represent browser headers
JMeter will not automatically kick off the requests triggered by JavaScript as it doesn't have full JavaScript runtime so you will have to add a separate HTTP Request sampler per such a request. If you need to simulate several AJAX requests - consider putting them under the Parallel Controller as browsers execute AJAX request simultaneously

Jmeter - waiting for a web grid to load

So we are tasked with doing automation against one of our web applications that has a lot of Ajax calls. We can't seem to get the Test Recorder to work, so right now we are manually writing out those requests. There is a particular web grid that contains about 100 rows x 20 columns of data. We are trying to measure how long it takes to load up that grid. The response data doesn't have any information on the grid too. Do you guys have any idea how to tackle this?
Using HTTP(S) Test Script Recorder will not help too much as it generates sequential calls while AJAX requests are parallel.
As per JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
So I would recommend reconsidering your approach and use i.e. WebDriver Sampler plugin in order to measure page loading time using a real browser instance. This way you will also be able to get extra information from the Navigation Timing API
If for some reason WebDriver Sampler approach is not acceptable for you - make sure that JMeter sends the same requests as real browser does:
Capture requests which are being sent by JMeter and by the real browser using a sniffer tool like Wireshark of Fiddler
Compare the requests, identify the differences
Amend JMeter configuration until requests would be exactly the same (apart from dynamic values in cookies or parameters)
Also be aware that you can mimic AJAX requests parallel execution in JMeter using Parallel Controller plugin.