Refactor TestRegistry into something reusable