Refactor test cases