Improve test speed and add failure diagnostics