Refactor tests to use a base class