Simulating a response for an ajax call that a web page makes (web-testing)

不想你离开。 提交于 2019-12-11 06:56:37

问题


How can I test that a web app successfully falls back from one faulty back-end API to a secondary legacy API service?
Could Firebug or Chrome, or Fiddler do it?
How can I setup my client to return error responses for ajax calls to a certain URL pattern?

  • Using HTTPS.
  • I don't have control over the server-side.
  • I want to err just certain ajax calls the remaining should work the same (pulling the network plug is not an option).

回答1:


Yes, Fiddler can do this easily. In Fiddler, click the AutoResponder tab. Create a new rule that specifies the behavior you want. For instance:

If request matches: webdbg.com/test/Service1 Then respond with: *drop

If Fiddler ever gets a request for the specified URL, it will immediately close the connection. Or you could set the response action to return a HTTP/5xx error, or use *reset to TCP/IP RESET the connection.

See http://www.telerik.com/automated-testing-tools/blog/13-02-15/testing-html5-appcache-with-fiddler.aspx for more details.



来源:https://stackoverflow.com/questions/19154037/simulating-a-response-for-an-ajax-call-that-a-web-page-makes-web-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!