Practice ยท 2 of 2
Diagnose the flaky test
Implement diagnose_flaky(test_record) โ the record has booleans uses_time, uses_random_unseeded, shared_state, order_dependent:
- returns (verdict, causes): 'flaky' when any cause fires, else 'sound'
- causes are human-readable fixes in fixed order: time โ 'reads the wall clock: inject a clock'; randomness โ 'unseeded randomness: seed it'; shared state โ 'shared state: give each test its own world'; order dependence โ 'order-dependent: construct prerequisites in the test'
Mechanized triage: the reviewer's first five minutes, as a function.
Difficulty: advanced
Press Submit to check your solution.
Back to lesson: Practice: Property & Diagnosis Drills