# AI-Assisted Test Generation Quiz

## Question 1

What is AI typically good at when generating tests?

A) Deciding which tests matter most for your business
B) Generating boilerplate, edge cases, and test data
C) Knowing your team's testing conventions without being told
D) Writing perfect tests that never need review

<!-- ANSWER: B -->
<!-- EXPLANATION: AI excels at generating structure (describe, it, expect), suggesting edge cases, and creating fixtures. It does not know your business priorities or conventions without explicit context. -->

## Question 2

Why should you review AI-generated tests critically?

A) AI always produces bugs
B) AI often produces shallow assertions and over-mocking that need strengthening
C) Review is only for style
D) AI-generated tests don't need review

<!-- ANSWER: B -->
<!-- EXPLANATION: AI commonly produces tests with weak assertions (e.g., toBeDefined), excessive mocking, or missing edge cases. Human review ensures tests actually verify behavior. -->

## Question 3

What improves AI test generation prompts?

A) Longer prompts are always better
B) Providing the function, framework, example tests, and desired cases
C) Asking for "comprehensive" tests without specifics
D) Avoiding any examples to keep output original

<!-- ANSWER: B -->
<!-- EXPLANATION: Context matters: the function under test, the framework (Jest, Vitest), one example test for style, and specific case types (happy, edge, error) all improve output quality. -->

## Question 4

When is AI most useful for test generation?

A) Only for e2e tests
B) For unit test boilerplate and edge case suggestions; human decides strategy
C) To replace all manual test writing
D) Only when you have no tests yet

<!-- ANSWER: B -->
<!-- EXPLANATION: AI is strongest for unit-level drafts and suggestions. Human judgment is essential for prioritization, integration/e2e strategy, and verifying assertions are meaningful. -->

## Question 5

What should you do when AI generates tests with the wrong framework (e.g., Jest instead of Vitest)?

A) Manually rewrite every test
B) Refine the prompt to specify the framework and regenerate
C) Switch your project to match the AI output
D) Use the tests as-is since APIs are similar

<!-- ANSWER: B -->
<!-- EXPLANATION: Refining the prompt to explicitly specify Vitest (vi.fn(), vi.mock()) and regenerating is efficient. Building a prompt library for your stack avoids repeats. -->

## Question 6

Match the AI capability to the test layer:

<!-- VISUAL: quiz-matching -->

- Unit tests :: Boilerplate, edge cases, mocks — human verifies assertions
- Integration tests :: Setup, fixtures, contracts — human verifies real flows
- E2E tests :: Selectors, steps — human chooses scenarios

<!-- ANSWER: (implicit from matching) -->
<!-- EXPLANATION: AI can draft at all layers, but human responsibility differs. Unit: verify assertions. Integration: verify real system behavior. E2E: choose what matters, avoid flakiness. -->
