def try_randoop(self, classes_dir, tests_src, sut_class, mutant, randoop_params=None): junit = JUnit(java=self.java, classpath=classes_dir) return (junit.run_with_mutant(self.suite_randoop, sut_class, mutant) if self.suite_randoop else None)
def try_evosuite(self, classes_dir, tests_src, sut_class, mutant, evosuite_params=None): junit = JUnit(java=self.java, classpath=classes_dir) return (junit.run_with_mutant(self.suite_evosuite, sut_class, mutant) if self.suite_evosuite else None)
def check_class_coverage(self, classes_dir, sut_class, mutant, evo_test_result, ran_test_result): evosuite_coverage = False randoop_coverage = False original_dir = os.path.join(mutant.dir[:mutant.dir.rfind(os.sep)], 'ORIGINAL') original = Mutant(mid='ORIGINAL', operator=None, line_number=None, method=None, transformation=None, dir=original_dir) junit = JUnit(java=self.java, classpath=classes_dir) orig_evosuite_result = (junit.run_with_mutant(self.suite_evosuite, sut_class, original) if self.suite_evosuite else None) orig_ran_result = (junit.run_with_mutant(self.suite_randoop, sut_class, original) if self.suite_randoop else None) if orig_evosuite_result == None and evo_test_result == None: evosuite_coverage = True elif orig_evosuite_result == None or evo_test_result == None: evosuite_coverage = False else: evosuite_coverage = (orig_evosuite_result.coverage.class_coverage == evo_test_result.coverage.class_coverage) if orig_ran_result == None and ran_test_result == None: randoop_coverage = True elif orig_ran_result == None or ran_test_result == None: randoop_coverage = False else: randoop_coverage = (orig_ran_result.coverage.class_coverage == ran_test_result.coverage.class_coverage) return (evosuite_coverage and randoop_coverage)
class SuiteRunner(): def __init__(self, java, suite, suite_env): self.java = java self.suite = suite self.suite_env = suite_env self.junit = JUnit(java=self.java, classpath=suite_env.classes_dir) def run_with_mutant(self, mutant): return self.junit.run_with_mutant(self.suite, self.suite_env.sut_class, mutant) def get_tool_name(self): return self.suite.tool_name
def try_evosuite_diff(self, classes_dir, sut_class, mutant_dir, project_dep): junit = JUnit(java=project_dep.java, classpath=classes_dir) res = junit.run_with_mutant(self.suite_evosuite_diff, sut_class, mutant_dir) return res
def try_randoop(self, classes_dir, sut_class, mutant_dir, project_dep): junit = JUnit(java=project_dep.java, classpath=classes_dir) return (junit.run_with_mutant(self.suite_randoop, sut_class, mutant_dir) if self.suite_randoop else None)
def run_test_suite(self, classes_dir, sut_class, mutant_dir, project_dep): junit = JUnit(java=project_dep.java, classpath=classes_dir) res = junit.run_with_mutant(self.test_suite, sut_class, mutant_dir) return res