logoalt Hacker News

shoo • today at 9:36 PM • 0 replies • view on HN

> run a test 1000x with random input "just in case" as if that helps

if the code being tested does something interesting is responsible for processing variably sized inputs that can encode a variety of different situations, if you're throwing randomly generated inputs at broken code, the broken code may succeed for 10,000 random inputs but only start to fail & give you a clue that the defect exists once you throw 100,000+ inputs at it. i've seen this happen a few times when working on domain specific graph algorithm type stuff, where the inputs are some kind of annotated graph & defects only manifest when the input has a graph with a particular topology.

still, probably not worth it to run 10,000+ random inputs each time CI runs -- maybe better to have a protocol of manually doing a run of 100,000 or 1000,000 random test cases whenever someone modifies that code & if that surfaces any cases that cause their proposed change to fail, capture those specific counterexamples to be re-run every build.

could probably be streamlined with sufficiently clever logic to figure out the subset of tests that need to be run for any given code change. most of the time you're not modifying the guts of subsystems like this so running any of its tests is waste.