InterviewStack.io LogoInterviewStack.io

Assertions and Behavior Verification Questions

Choosing what to assert and how to verify behavior meaningfully. Covers assertion strategy, verifying observable behavior over implementation detail, avoiding weak or over-specified assertions, and using assertion libraries effectively. Emphasizes assertions that fail for the right reasons and give a clear diagnosis.

MediumTechnical
84 practiced

Write a pytest unit test (high-level pseudocode is fine) asserting that a web endpoint returns HTTP 422 for validation errors and that an error log line includes the tag "validation_failure" and the request_id. Describe how you'd structure the test setup and assertions.

That is every published Assertions and Behavior Verification question for Site Reliability Engineer (SRE) so far. Browse the other topics in this category, or practice this one interactively.