12 questions, 20 points (Parts A and B: 1 point/question; Parts C and D: 3 points/question), 30 minutes. Pass mark: 14/20 (70%). The answers are in
answer-key.md(for instructors only).
Part A - Multiple choice (1 point/question)
Q1. A test is tagged @pytest.mark.regresion (a typo) in a project that uses --strict-markers. What happens?
- A. The test runs normally B. pytest reports an unregistered-marker error C. The test is skipped D. The marker is ignored
Q2. Which fixture fits best for a test server with a request log that the tests assert on?
- A.
sessionscope B.modulescope C.functionscope, stopping the server afteryieldD. A global variable
Q3. Which locator is the most robust for the Send button ("Gửi")?
- A.
page.locator(".btn-primary")B.page.get_by_role("button", name="Gửi")C.page.locator("button >> nth=1")D. An absolute XPath
Q4. In the lab's workflow, which jobs run when a pull request is opened?
- A. Only
liveB.unitanduiC. All three D. No job
Q5. A mutation check reports SURVIVED live-without-key. Meaning:
- A. The code allows live mode without an API key B. The test suite did not detect the defect "live needs no API key" C. The API key leaked D. The mutation check is broken
Part B - True/False (1 point/question)
Q6. Playwright's expect(locator).to_have_text(...) retries automatically until the condition holds or the timeout runs out.
Q7. GitHub guarantees that every secret printed to a log is fully masked.
Q8. An AI-written test that is green on its first run has been verified.
Part C - Short answer (3 points/question)
Q9. Explain the contract test that runs against both ScriptedClient and AnthropicClient. What risk does it
guard against, and when does its live part run?
Q10. Name three safeguards that prevent the live job in the lab's workflow from spending money unintentionally.
Part D - Scenarios (3 points/question)
Q11. A chat page displays the model's answer with innerHTML. Write a UI test that proves the risk (steps, data,
assertions), and name the OWASP risk and its severity.
Q12. An AI assistant reads an issue and then proposes running a command that downloads a script from the internet "to get the logs". What do you do, and what do you change in the way you use the assistant to reduce the risk next time?