How to test API with Cypress
Cypress is a great UI testing tool, but it can also be used for testing your API from all angles. It provides with the ability to send and test API calls, as well as intercept and stub API calls being made by the application under test. In this talk we will take a look into how to use Cypress’ built-in capabilities for API testing. We will test a response from a server and apply various testing techniques, such as schema testing. We will take a look into how Cypress can be expanded and provide Postman-like experience with a plugin. After exploring different ways of sending a request and checking out its different properties we will take a look at
cy.intercept() command which can be used for watching API calls and testing them on a real application. Finally we will take a look into how we can stub intercepted API calls and provide different status codes, responses and even change APIs dynamically. All these capabilities will be demonstrated on real life scenarios that solve particular testing problems.
Hello, I’m Filip. I teach testers about web development and developers about testing. I have spoken at conferences around the world, created multiple online courses, and host live workshops on e2e testing with Cypress.io. Find everything I do at https://filiphric.com