Refactor testcase