Testing Flashcards
7 cards from real Web Development practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Testing flashcards as text
Which testing technique checks boundary values at the edges of input ranges?
Answer: Boundary value analysis
Boundary value analysis tests values at the minimum, maximum, and just inside/outside the boundaries of valid input ranges.
In Jest, what does the `beforeEach` hook do?
Answer: Runs before each individual test in a describe block
`beforeEach` executes a setup function before every individual test (`it`/`test`) within its scope.
What is a test double that records calls and allows assertions on how it was used?
Answer: Spy
A spy wraps a real function and records information about its calls (arguments, return values, call count) for later assertions.
Which HTTP status code range should a REST API return when a client sends an invalid request that fails validation?
Answer: 4xx
4xx status codes indicate client-side errors; 400 Bad Request or 422 Unprocessable Entity are typical for validation failures.
What does `screen.getByRole('button', { name: /submit/i })` test in React Testing Library?
Answer: That a button is accessible with the text 'submit' using ARIA roles
React Testing Library's `getByRole` queries the DOM using ARIA roles and accessible names, promoting accessibility-first testing.
Which tool is commonly used to measure code coverage in a Node.js/Jest project?
Answer: Istanbul (nyc)
Istanbul (also known as nyc) is the code coverage tool integrated into Jest by default via `--coverage`.
What is the purpose of contract testing in a microservices architecture?
Answer: To verify that services agree on the API shape they expect from each other
Contract testing (e.g., with Pact) ensures that a consumer's expectations of a provider's API match what the provider actually delivers.
How this page was made: written with AI tools. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy