Stubbing the Back-end
Learn the limitations of E2E tests, and how to implement Ui integration tests.
We'll cover the following...
What’s the matter with E2E tests? Well, they:
-
They are slow: in the previous chapter, we dedicated a lot of attention to reducing the test duration but still they are slow.
-
They do not allow the front-ender to work without a back-ender which greatly limits testing.
-
They make edge cases replication difficult.
E2E tests are not feasible for front-end testing. Although they are important we cannot rely on them too much. This is why E2E testing is at the top of the testing pyramid. They give you the most confidence of any test, but they are very expensive in terms of writing, maintenance, and stability.
Going down the testing pyramid we can also find integration tests (where a part of the application is tested) and unit testing (a single unit/module test). Cypress allows us to write another test type easily: UI Integration Tests. The goal is to test the entire front-end app but without a real back-end. All the AJAX ...