|Regression tests and regtest.erl
||[May. 29th, 2007|01:22 pm]
My new favourite kind of program is one that tests whether two big and complex programs are
substantially equivalent. With tools like this I can take one big and
complex program, rewrite parts of it for clarity, and then have
confidence that my new version preserves the original behaviour.
I think this is much simpler than testing for correctness.
I wrote one particular Erlang regression test program called regtest.erl along these
lines. The idea is first to execute a large and complex program on a
lot of inputs and to record what happens in log files, then to test
the logs from separate runs for equivalence. If the consequences in
the logs are the same before and after my hacking then I know the
overall behaviour is substantially the same.
Lately I write small programs like this any time I want to rewrite
important code that has no explicit test suite. I'm finding it very