How to automatically simulate server responses from a browser plugin (Firefox/Chromium) - ajax

While I am testing a web application, for some requests that are computational intensive on the server side, I would like to simulate the server response directly from a browser add-on. I would like to be able to configure the URL and set-up a JSON response that will be returned by the browser without sending the request to the server.
Does any of you know a good tool for this purpose ?
P.S. So far I am either changing the server code to simulate the response or changing the client code to return the response without triggering the request to server.

Related

Load Testing in Struts2 Application - JMeter

I am trying to do a load test using JMeter for the first Time.
My approach is to test each page one by one.
The main page is like http://localhost:8180/myapp/login.do?actionType=login(I hardcoded the credentials)
I am able to reach this page without any problem.
I created a HTTP request component and able to see the response without any issue.
In the main page there is a button which populates the report, in the browser , the url is like
http://localhost:8180/myapp/mainmenu.do
But when i create a HTTP request it is reaching but shows the security error page in the 'Response
Data' as Due to security reasons, we still recommend you to close this window.
can someone guide me how to test the other pages without these security errors. This is a struts2 Web application.
No matter what technology is being used under the hood of the web application you're testing you should stick to one simple rule:
Well-behaved JMeter test must send exactly the same requests as real browser
It includes:
Same number/sequence/nature of the HTTP Requests
Same HTTP Headers (including Cookies)
any dynamic values need to be properly correlated
Once JMeter will send the same requests as real browser does it should receive the same responses. So just use a 3rd-party sniffer tool like Fiddler or Wireshark to capture the requests originating from browser and JMeter and amend JMeter's configuration until the requests start looking exactly the same. This should resolve your issue.
Solved the issue by adding HTTP Cookie Manger and
set Cookie Policy as Standard
click HTTP Cookie Manager
and click save icon on the top.
Source
https://jmeter.apache.org/usermanual/build-web-test-plan.html#adding_cookie_support
Thanks #Dimitri T and #Roman C for their valuable suggestion.

How to allow https to access content from wowza http link?

I have one question. Recently i have get link from my streaming server to play in my website. My streaming server use http link but my website use https ssl. During i get the link to play it cannot get content from my streaming server by show the following error:
enter image description here
I am looking forward to hearing from all of you soon.
Thanks in advance.
Best Regards,
Chhenghong
This error happens because you cannot access HTTP resource from HTTPS page, for security consideration. It is the browser behaviour.
To fix this issue, a proxy endpoint can be made in server side, such as /proxy/playlist.m3u8, which accept HTTP GET request. The browser will fetch the resource from https://<your-server>/proxy/playlist.m3u8, as if it is stored in your host. As it is an HTTPS request, no error.
In the server side, when GET request to /proxy/playlist.m3u8 is listened, the HTTP request would be proxied to your streaming server (send GET request to the streaming server with all headers, parameters and body). When the response from streaming server is received, the response would be returned to browser directly, with all response headers and data.
As the HTTP request to streaming server happens in your server side, the restriction logic from browser does not apply any more.
For example, if the server is written in Node.js, with Express and request module, the proxy endpoint would look like:
app.get('/proxy/playlist.m3u8', function(req, res) {
req.pipe(request('http://<streaming-server>/path/playlist.m3u8')).pipe(res);
});

Getting Internal server error for partcular request in jmeter

I am getting Internal server error in jmeter for particular request but same url its working fine in browser,even i handled the cookie in the script and checked web traffic in fiddler and header manager everything is correct but still its showing internal server error.
Perhaps you need to configure some HTTP header in your request to make it work. Your browser is inserting them as default, but for JMeter you need to do it manually.
Using a recording tool might help on the specifics, but even though you will need some changes on your test script.
I recommend BlazeMeter Chrome Plugin, it will insert any necessary HTTP headers for you based on the browser of choice.
https://chrome.google.com/webstore/detail/blazemeter-the-load-testi/mbopgmdnpcbohhpnfglgohlbhfongabi
Your site might require Cookies, therefore you need to use a Cookie Manager for that. In order to Test the requests, use the Listeners "Response Assert" or "Save Responses to a File" to check if the response was sent properly.

How to see all HTTP Get request sent from browser without debugging tool?

so, I have page doing a number of ajax and jsonp(i.e. injection) to get data. I would like to know how to find out the request URL I have made without using debugging tools, like firebug. etc. i.e. the history of GET request of the browser. Thanks
For the most part, browsers do NOT log a history of their HTTP GET requests. Also, if you're using ajax, you're probably doing HTTP POST requests as well.
You don't have to use an in-browser tool like Firebug, but you will need some tool to actually get a history of requests and the request bodies.
You can use a tool like Fiddler2, which is a proxy that gets all HTTP traffic outgoing from your computer (including from your browser and all other applications).
If you have control of the server environment, you can also set up logging on the server to capture this data.
You can use WireShark or a similar tool to monitor the network traffic and inspect the packets.

How JMeter tests web application

I made load test on my web application with JMeter using HTTP Proxy. In HTTP Request I insert some data which I want to change. After load test when I go to the web page the page was without changes and I get all results(graph and table). Is that test real or not? Because was without page (data) changes?
Use the "tree view" LISTENER to see what request you sent to your web application. That will tell you if Jmeter was sending the new data, or just sending what you recorded. If Jmeter sent new data, then your application probably has a problem. If Jmeter sent the old recorded data, then you need to update your script by going to the request and changing the parameters.

Resources