Testcase add and refactoring