Does TestCafe RequestMock Stop the Original Request - testing

When implementing a RequestMock in TestCafe does the original request still get made and completed and then modified by TestCafe or does TestCafe intercept the request and stop the original?
I'm asking because we are thinking about using this feature to mock some requests to speed up testing, such as mocking images. However, if the original request still has to be completed before the mock then this does not seem like a viable solution.

RequestMock intercepts requests to a web resource and emulates a response, so the original request is not performed. Please refer to the documentation for more information.

Related

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.

Requests to an API endpoint denied due to Testcafe prepending request URLs - solutions?

When Testcafe runs against our local site, every request it makes during the test steps are prepended with something like http://192.168.1.182:59304/http://localhost:3000 (port number varies per run).
For the most part this works, but our web application makes calls to certain APIs during a user journey, and within TestCafe they might look like: http://192.168.1.182:59304/http://www.example.com/api/v2/customers/1 which come back with a 401 and response body of 'unauthorized'. Some API calls are fine, however.
I guess my question is:
Are there any way to get around this from my side, such as rewrite certain requests, or do I need to contact the API provider - and if so, what would they be potentially looking to do to allow these requests to go ahead?
You have faced this issue: https://github.com/DevExpress/testcafe-hammerhead/issues/2344. It was fixed. Try to run your tests with the latest TestCafe version (1.8.8-alpha.3).

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.

How to monitor node http requests in node-webkit

How can I monitor http requests that were made by node in node-webkit? When I make a request I don't see it in the developer tools. I can see the request only when I make it with jquery or xmlhttprequest.
I've binded a console.log on the 'end' event and I can see that node-webkit is actually doing the request and it's returning me a correct response. But doing this blind requests is very hard because there is absolutely no way to debug them (except for logging the params that I've called the request method with).
Such low-level procedures can only be handled by the supported node.js so one of these node.js functions is bound to solve your HTTP header monitoring problem:
https://nodejs.org/dist/latest-v6.x/docs/api/http.html#http_event_checkexpectation