Refactor tests to get more flexibility