Test Severity Filtering with Contract-Distinguishing Cases

Read the full interview experience this question came from →

Quick Overview

Test severity filtering with independent expected results, inclusive boundaries, misleading message text, missing fields, empty records, and preserved order and duplicates.

Test Severity Filtering with Contract-Distinguishing Cases

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

Design unit tests for severity-threshold log filtering. Explain what each test would detect and how you would validate test suggestions from an AI assistant. ### 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? ### What a Strong Answer Covers Boundary and malformed-record cases, adversarial messages, ordering/duplicate checks, independent expected values, and a reason for each assertion. ### 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?

Overview: Test severity filtering with independent expected results, inclusive boundaries, misleading message text, missing fields, empty records, and preserved order and duplicates.

Read the full Software Engineer interview experience this question came from

|Home/Software Engineering Fundamentals
Sep 16, 2026
mediumSoftware EngineerOnsiteSoftware Engineering Fundamentals
0
0

Design unit tests for severity-threshold log filtering. Explain what each test would detect and how you would validate test suggestions from an AI assistant.

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 Guidance

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?

What a Strong Answer Covers Guidance

Boundary and malformed-record cases, adversarial messages, ordering/duplicate checks, independent expected values, and a reason for each assertion.

Follow-up Questions Guidance

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?

Loading comments...