I have a very complex SPA made up of a client that uses AJAX to make calls, and a rather large number of endpoints that respond to REST requests. We are writing tests the "classic" way; however, one of the ways we are exploring is:

  • We use the app doing a set of tasks so that we cover 100% of the use
  • The browser (an extension?) records all of the ajax calls, and all of the responses
  • Some kind of data file is created with the requests and the exact responses
  • A server-side script that will emulate all of the requests and check that the responses match

I realise that if the data structure changes, the data will be outdated.

Is there anything like this out there? Or is it really a matter of writing everything by hand?

3 Answers 3


data structure changes, the data will be outdated

Yes, and the failure shows that your frontend application is no longer compatable with the service.

The problem is that you are mixing semantic checking and syntax checking.

Semantic validation of a service is done by the service itself - a service knows about the business rules and entities it manipulates: And these are of no concern of the external world.

What concerns the external world is the interface the service provides: What format of input does the service expect? What format of output does service provide?

Here we have to check the syntax of the input and output. It is also known as Contract Testing:

Contract testing ensures that a pair of applications will work correctly together by checking each application in isolation to ensure the messages it sends or receives conform to a shared understanding that is documented in a "contract".

Maybe your tech stack provides Contract Testing options.

Alternatively, you can check out Pact.io

enter image description here


Ajax applications are rarely the subject where one can effectively apply record-playback approach. This is because A in Ajax stands for "asynchronous" which means that if you execute two requests say A and then B there is no guarantee that you will get response for A earlier then for B.

I would distinguish REST points testing and SPA with Selenium and probably with mocking your endpoints so that you're not dependent on changing data. And will put some effort to do everything by hands. Probably you will save some time if your devs used the tools like Swagger.


Not sure if I understand completely, but if you are looking for a tool to record HTTP traffic, then there are plenty to choose from, for instance: JMeter or HP LoadRunner. Other then that I think even Postman has some kind of an extension to record traffic. The latter will probably be the easiest when it comes to exporting requests to file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.