API and Component for Test Automation Engineers
API and component testing checks behaviour below the browser, where tests are faster and more stable. API tests send HTTP requests and assert on status codes, headers, bodies and schemas, for example with Playwright's request context or similar tools. Component tests render a single UI component in isolation, with stubbed data, to verify its states.
Stage: Writing Tests · Part of the Test Automation Engineer roadmap · Last reviewed 19 November 2026
What to learn in API and Component
- Send requests and assert status, headers and JSON body fields in an API test
- Validate a response against a JSON schema
- Test negative cases such as missing authentication and invalid input
- Mock a backend response to test a component in isolation
- Use API calls to set up and clean up data for UI tests
API and Component interview questions
Why are API tests usually more stable than UI tests?
API tests skip rendering, timing and selector issues in the browser, so they run faster and fail less for unrelated reasons. They check business logic directly. Many teams cover rules thoroughly through the API and keep UI tests for a few key journeys.
What is contract testing?
Contract testing verifies that a service provider and its consumers agree on the shape of requests and responses, using a shared contract, as with Pact. Each side is tested against the contract independently, catching breaking changes without running a full integration environment.
Where API and Component fits in the Test Automation Engineer roadmap
API and Component belongs to the Writing Tests stage (intermediate level), which takes about 30 hours. Hands-on automation.
Other units in this stage
Back to the full Test Automation Engineer roadmap