def parse_tests(tests_dir): ans = [] for filename in os.listdir(tests_dir): abs_path = os.path.join(tests_dir, filename) if os.path.isdir(abs_path): ans.extend(parse_tests(abs_path)) elif filename.endswith(".java"): ans.append(TestObjects.TestClass(abs_path)) return ans
def setUp(self): os.chdir(orig_wd) test_doc_1 = os.getcwd( ) + r'\static_files\TEST-org.apache.tika.cli.TikaCLIBatchCommandLineTest.xml' test_doc_2 = os.getcwd( ) + r'\static_files\MavenProj\sub_mod_2\target\surefire-reports\TEST-p_1.AssafTest.xml' self.test_report_1 = TestObjects.TestClassReport(test_doc_1, '') try: self.test_report_2 = TestObjects.TestClassReport( test_doc_2, os.getcwd() + r'\static_files\MavenProj\sub_mod_2') except TestObjects.TestParserException as e: print("Unexpected state of the test driver. Caused excpetion:") print(e.msg) #resetEnvritonment() self.test_1 = TestObjects.TestClass( os.getcwd() + r'\static_files\MavenProj\sub_mod_2\src\test\java\NaimTest.java') self.test_2 = TestObjects.TestClass( os.getcwd() + r'\static_files\MavenProj\sub_mod_1\src\test\java\p_1\AmitTest.java' ) self.test_2 = TestObjects.TestClass( os.getcwd() + r'\static_files\MavenProj\sub_mod_1\src\test\java\p_1\AmitTest.java' ) self.test_3 = TestObjects.TestClass( os.getcwd() + r'\static_files\tika_1\src\test\java\org\apache\tika\parser\AutoDetectParserTest.java' ) self.test_4 = TestObjects.TestClass( os.getcwd() + r'\static_files\tika_1\src\test\java\org\apache\tika\sax\AppendableAdaptorTest.java' ) self.test_5 = TestObjects.TestClass( os.getcwd() + r'\static_files\tika_1\src\test\java\org\apache\tika\sax _1\AppendableAdaptorTest.java' ) self.testcase_1 = [ t for t in self.test_3.testcases if t.id.endswith('None_testExcel()') ][0] self.testcase_2 = [ t for t in self.test_4.testcases if t.id.endswith('None_testAppendChar()') ][0] self.testcase_3 = [ t for t in self.test_5.testcases if t.id.endswith('None_testAppendChar()') ][0] self.testcase_4 = [ t for t in self.test_5.testcases if t.id.endswith('None_testAppendString()') ][0]