Example #1
0
    def test_get_env(self):
        java = Java(self.java_home)

        env = java.get_env({'VARIABLE': 'VALUE'})

        self.assertTrue('JAVA_HOME' in env)
        self.assertTrue('VARIABLE' in env)
        self.assertEqual(env['VARIABLE'], 'VALUE')
Example #2
0
    def test_compile_java_file(self):
        java = Java(self.java_home)

        class_file = os.path.join(calculator_package_dir(), 'operations',
                                  'Operation.class')

        if os.path.isfile(class_file):
            os.remove(class_file)

        java.exec_javac(calculator_operation_java_file(), None, None, 10)

        self.assertTrue(os.path.isfile(class_file))
        os.remove(class_file)
Example #3
0
    def setUp(self):
        self.java_home = get_config()['java_home']
        self.maven_home = get_config()['maven_home']

        self.java = Java(self.java_home)
        self.maven = Maven(self.java, self.maven_home)

        self.maven.compile(calculator_project_dir(), 10)
Example #4
0
    def test_compile_all(self):
        java = Java(self.java_home)
        src_dir = calculator_src_dir()

        self._clean_class_files(src_dir)

        java.compile_all(src_dir, src_dir)

        class_files = 0

        for java_file in get_java_files(src_dir):
            class_file = os.path.join(src_dir,
                                      java_file.replace('.java', '.class'))
            if os.path.exists(class_file):
                class_files += 1

        self.assertEqual(6, class_files)

        self._clean_class_files(src_dir)
Example #5
0
def main():
    java = Java(get_config()['java_home'])
    maven = Maven(java, get_config()['maven_home'])

    nimrod = Nimrod(java, maven)
    nimrod.run(PROJECT_DIR,
               MUTANTS_DIR,
               'org.apache.commons.lang.WordUtils',
               randoop_params=['--time-limit=60'],
               evosuite_params=['-Dsearch_budget=60'],
               evosuite_diff_params=['-Dsearch_budget=60'])
Example #6
0
def main():
    java = Java(get_config()['java_home'])
    maven = Maven(java, get_config()['maven_home'])

    nimrod = Nimrod(java, maven)
    nimrod.run(PROJECT_DIR,
               MUTANTS_DIR,
               'tr.Triangle',
               randoop_params=['--time-limit=60'],
               evosuite_params=['-Dsearch_budget=60'],
               evosuite_diff_params=['-Dsearch_budget=60'])
Example #7
0
def main():
    java = Java(get_config()['java_home'])
    maven = Maven(java, get_config()['maven_home'])

    nimrod = Nimrod(java, maven)
    nimrod.run(
        PROJECT_DIR, MUTANTS_DIR,
        'pamvotis.core.Simulator',
        randoop_params=['--time-limit=60', '--flaky-test-behavior=DISCARD',
                        '--usethreads=true', '--call_timeout=1000'],
        evosuite_params=['-Dsearch_budget=60',
                         '-Dminimize=false',
                         '-Dcriterion=STATEMENT:LINE:BRANCH:WEAKMUTATION'],
        evosuite_diff_params=['-Dsearch_budget=60']
    )
Example #8
0
    def setUpClass(cls):
        cls.java_home = get_config()['java_home']
        cls.maven_home = get_config()['maven_home']

        cls.java = Java(cls.java_home)
        cls.maven = Maven(cls.java, cls.maven_home)

        cls.maven.compile(calculator_project_dir(), 10)

        cls.classpath = os.path.join(calculator_target_dir(), 'classes')
        cls.tests_src = os.path.join(calculator_project_dir(), 'randoop')
        cls.sut_class = 'br.ufal.ic.easy.operations.Sum'

        (cls.suite_name, cls.suite_dir, cls.suite_classes_dir,
         cls.suite_classes) = cls.generate_suite(cls.java, cls.tests_src,
                                                 cls.sut_class)
Example #9
0
def main():
    java = Java(get_config()['java_home'])
    maven = Maven(java, get_config()['maven_home'])

    nimrod = Nimrod(java, maven)
    nimrod.run(PROJECT_DIR,
               MUTANTS_DIR,
               'xcom.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder',
               randoop_params=[
                   '--time-limit=60', '--flaky-test-behavior=DISCARD',
                   '--usethreads=true', '--call_timeout=1000'
               ],
               evosuite_params=[
                   '-Dsearch_budget=60', '-Dminimize=false',
                   '-Dcriterion=STATEMENT:LINE:BRANCH:WEAKMUTATION'
               ],
               evosuite_diff_params=['-Dsearch_budget=60'])
Example #10
0
def main():
    java = Java(get_config()['java_home'])
    maven = Maven(java, get_config()['maven_home'])

    nimrod = Nimrod(java, maven)
    nimrod.run(PROJECT_DIR,
               MUTANTS_DIR,
               'org.joda.time.chrono.BasicMonthOfYearDateTimeField',
               randoop_params=[
                   '--time-limit=60', '--flaky-test-behavior=DISCARD',
                   '--usethreads=true', '--call_timeout=1000'
               ],
               evosuite_params=[
                   '-Dsearch_budget=60', '-Dminimize=false',
                   '-Dcriterion=STATEMENT:LINE:BRANCH:WEAKMUTATION'
               ],
               evosuite_diff_params=['-Dsearch_budget=60'])
Example #11
0
    def __init__(self, config, path_local_project, path_local_module_analysis,
                 project_name):
        self.config = config

        self.sut_class = None
        self.sut_method = None
        self.dRegCp = None  # base
        self.classes_dir = None  # left
        self.mergeDir = None  # merge

        self.java = Java(self.config['java_home'])
        self.maven = Maven(self.java, self.config['maven_home'])
        self.tests_dst = self.create_directory_test_destination()
        #self.tests_dst = self.config["tests_dst"]
        self.project = GitProject(path_local_project,
                                  path_local_module_analysis, project_name)
        self.projects_folder = self.config["projects_folder"]
        self.path_hash_csv = self.config["path_hash_csv"]
        self.path_output_csv = self.config["path_output_csv"]
Example #12
0
    def test_java_timeout(self):
        java = Java(self.java_home)

        with self.assertRaises(subprocess.TimeoutExpired):
            java.exec_javac(calculator_java_file(), None, None, 0)
Example #13
0
 def setUp(cls):
     cls.java_home = get_config()['java_home']
     cls.java = Java(cls.java_home)
     cls.jacoco = Jacoco(cls.java)
Example #14
0
    def test_maven_wrong_args(self):
        java = Java(self.java_home)

        with self.assertRaises(subprocess.CalledProcessError):
            java.exec_javac(calculator_java_file(), None, None, 10, '< x')
Example #15
0
    def test_java_path(self):
        java = Java(self.java_home)

        self.assertEqual(
            os.path.join(self.java_home, os.sep.join(['bin', 'java'])),
            java.java)
Example #16
0
 def test_init_with_wrong_parameter(self):
     with self.assertRaises(SystemExit):
         Java('wrong_path')
Example #17
0
 def test_init_wrong_java_home(self):
     os.environ['JAVA_HOME'] = 'wrong_path'
     with self.assertRaises(SystemExit):
         Java()
Example #18
0
 def test_init_with_parameter(self):
     Java(self.java_home)
Example #19
0
 def test_init_without_parameters(self):
     os.environ['JAVA_HOME'] = self.java_home
     Java()
Example #20
0
    def test_init_java_home_not_found(self):
        if 'JAVA_HOME' in os.environ:
            del os.environ['JAVA_HOME']

        with self.assertRaises(SystemExit):
            Java()
Example #21
0
 def setUp(self):
     self.java_home = get_config()['java_home']
     self.maven_home = get_config()['maven_home']
     self.java = Java(self.java_home)
Example #22
0
 def setUp(self):
     self.java = Java(get_config()['java_home'])
     self.maven = Maven(self.java, get_config()['maven_home'])
    def setUp(self):
        self.java = Java(get_config()['java_home'])

        self.tests_src = os.path.join(calculator_project_dir(), 'test_tool')
        self.suite_tool = ToolSuiteGenerator(self.java, '', self.tests_src, '')