u/Global-Development56

▲ 1 r/u_Global-Development56+1 crossposts

Many teams use just basic API tests confirming what should be returned from the API. As a result, the basic API test returns a passing status code as part of the CI pipeline process; however, once you are under production traffic, a new version or payload breaks the API test and shows errors only under the production environment.

I found a helpful technical article about API testing strategies, and how they can improve reliability and dependability on the API as a whole. The following are some of the key points from that article:

- Functional Testing - testing endpoints, status codes, and response correctness (e.g., was the expected response returned?)

- Contract Testing - preventing consumer integration from breaking

- Regression Testing - verifying functionality after a release

- Performance Testing - under load and concurrency conditions

- Security Testing - for auth, rate limits, and overall data security vulnerabilities.

- Automated Testing - utilizing automated tests in your CI/CD pipelines whenever feasible.

- Real production environment patterns to create better test case patterns.

One major highlight was that most issues occur due to only performing tests that confirm the "happy path" or regular operation, which only focuses on the normal path(s) the API will experience in production. The focus should also include edge cases via failure scenarios and with production-like data used to create the tests needed for proper validation.

For teams developing with microservices or making quick deployments, increasing API testing coverage is likely one of the highest Return on Investment (ROI) engineering activities. What type of API testing has worked best for your development team's needs (i.e., contract testing, integration testing, production traffic simulation, etc.)?

u/Global-Development56 — 28 days ago