Removing duplication from tests