Test Severity Filtering with Contract-Distinguishing Cases
OtherSoftware Engineer · OnsiteLast updated
Test severity filtering with independent expected results, inclusive boundaries, misleading message text, missing fields, empty records, and preserved order and duplicates.
Constraints & Assumptions
Use the practice contract: levels are ordered low to high; include the threshold and higher levels; drop empty records and missing/unknown levels; keep an empty message when its known level qualifies; preserve order and duplicates. Do not derive expected results by calling the implementation being tested.
Clarifying Questions
What is the intended behavior for missing levels? Is matching based on structured severity or message text? Are threshold boundaries inclusive? Which test distinguishes the competing interpretations?
Follow-up questions
- How can a test suite pass while encoding the wrong requirement? What properties should hold when the threshold is raised? How would you separate filtering tests from concurrent logging tests?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.