refactor testcase and add new test case