refactoring of the testcase and TestcaseFactory classes and adding comments