Setting up a simple mock backend server

It isn't hard to realize why having end-to-end tests that communicate with a real server that returns mock responses can be useful. Outside of the testing complexity that involves the business logic your application uses to handle the data returned from the server, the spectrum of possible outcomes when relying upon HTTP communication (timeouts, server errors, and more) should be included in a robust end-to-end test suite. It's no stretch of the imagination then that a superb way of testing these corner cases is to actually create a mock server that your application can hit. You can then configure the mock server to support different endpoints that will have predetermined behavior, such as failing, slow ...

Get AngularJS Web Application Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.