Refactor test base classes a bit and update places that use them.