Reuse more code in tests.