Switch to test helpers instead of TestCase classes

This is the bulk of the test cleanup work. There are still a few things that could use improving, but we can probably do those incrementally during other work.

I'm breaking this up into smaller bits to make reviewing it possible:
 - [x] #786