Improved test script with collapsing output.