โ† All Web Development Flashcard Decks

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
  1. What is 'snapshot testing' as used in Jest?

    Answer: Serializing a component's rendered output and comparing it to a stored reference on future runs

    Jest snapshot testing serializes a component's output (often JSX/HTML) into a `.snap` file and fails if the output changes unexpectedly.

  2. Which Playwright locator is most resistant to CSS/styling changes when targeting elements?

    Answer: .getByRole('button', { name: 'Submit' })

    Role-based locators use ARIA semantics rather than visual attributes, making them resilient to style changes and better for accessibility.

  3. What is the purpose of `afterAll` in Jest?

    Answer: Runs a cleanup function once after all tests in the describe block complete

    `afterAll` runs a teardown function exactly once after all tests in its scope have finished, useful for closing database connections or servers.

  4. In load testing, what does 'throughput' measure?

    Answer: The number of requests processed per unit of time

    Throughput measures how many requests (or transactions) a system can handle per second, indicating its processing capacity.

  5. What is the difference between a 'mock' and a 'stub' in testing terminology?

    Answer: Mocks verify behavior (expectations); stubs provide canned responses without assertions

    Stubs return pre-configured responses to make tests work, while mocks additionally assert that specific interactions occurred (they are pre-programmed with expectations).

  6. Which of the following correctly describes a 'regression test'?

    Answer: A test that verifies previously working functionality still works after a code change

    Regression tests guard against old bugs reappearing by re-verifying that existing functionality remains intact after new changes.

  7. What does `supertest` help you test in a Node.js application?

    Answer: HTTP endpoints by making requests against an Express/Koa app without starting a live server

    Supertest allows you to make HTTP assertions against an Express (or similar) app instance directly in your tests without binding to a network port.

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