Small improvements to the test code.

The remaining bits of my previous PR, just some minor improvements.