Detection regression tests
Expected outcomes
A regression fixture pairs an input with an independently reviewed expected result. Include a positive match, a legitimate matching event, a nonmatch, an unrelated source and malformed input. Keep ground truth about the scenario separate from the rule output. A legitimate matching event can be a false positive for the investigation goal even when the rule works exactly as specified.
Missing data is a separate outcome
The classroom comparator first checks required string fields, then source and selection. Missing or wrongly typed data yields invalid rather than no-match. This is a local validation policy, not universal Sigma behavior. Store rejected row IDs and counts without exposing sensitive payloads. Validate an entire ingest contract as well as a matching condition.
Correlation boundaries
For a fictional review queue, group unique matched event IDs by actor in the half-open interval [0,10) minutes. Trigger a review summary at three or more matches. Events at minute 10 belong to the next interval. Duplicate copies of one ID must not inflate counts. Preserve each evidence ID; if one ID has conflicting contents, flag the conflict instead of choosing silently.
Evaluate errors
Suppose five valid labeled events yield TP=2, FP=1, TN=1, FN=1. Precision = 2/3 and recall = 2/3. Precision answers how many alerts were relevant; recall answers how many known relevant events were caught. Report invalid records separately. If a denominator is zero, mark the measure undefined, not perfect. A small fixture is not a production estimate.
Practice with independent answers
Before running the validator, write expected row outcomes and the grouped alert counts. Check the boundary at minute 10, duplicate handling, and malformed rows. Change the comparator to always match in a disposable copy and confirm that the negative tests reject it; an always-no-match model should also fail. Keep the original data unchanged.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Detection regression tests — knowledge check
Apply detection hypotheses, rule structure, regression and lifecycle principles to fictional scenarios.
What should a missing required field produce in this lab?
Which event belongs outside [0,10)?
How should an identical duplicate ID affect counts?
TP=2 and FP=1: precision?
Why test an always-match comparator?