API Testing
Learn about API testing features within leading JavaScript automation frameworks and the languages supported by these frameworks.
We'll cover the following...
In the traditional testing pyramid, it’s clear that lower-level automated testing is API testing. However, it’s powerful, fast, very reliable, and stable. Most testing projects use API testing as part of their test plan scoping. But when it comes to API testing within the four leading frameworks, not all of them offer this as a built-in capability.
Cypress API testing
Cypress offers built-in support for API testing. With the Cypress testing framework, we can create any kind of API testing across all different types of methods (GET
, POST
, DELETE
, PATCH
, and PUT
). Cypress performs most of its API tests via the cy.request()
method, which serves as a GET
command to the web server being tested.
In the following examples, we will be using the free JSONPlaceholder website that’s available for API testing activities. On the website, several resources can be used for testing purposes and training, such as 200 to-do list items, thousands of photos, 10 usernames, and many other options. With the Cypress API testing abilities, we can perform various validations on this sample website. ...