def test_selenium_startup_shutdown_java_folder(self):
        """
        run tests from .java files
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(
            yaml.load(open("tests/yaml/selenium_executor_java.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()

        prepared_files = os.listdir(obj.runner.working_dir)
        java_files = [
            file for file in prepared_files if file.endswith(".java")
        ]
        class_files = [
            file for file in prepared_files if file.endswith(".class")
        ]
        jars = [file for file in prepared_files if file.endswith(".jar")]
        self.assertEqual(2, len(java_files))
        self.assertEqual(2, len(class_files))
        self.assertEqual(1, len(jars))
        self.assertTrue(
            os.path.exists(os.path.join(obj.runner.working_dir,
                                        "compiled.jar")))
        self.assertTrue(os.path.exists(obj.runner.settings.get("report-file")))
 def test_no_test_in_name(self):
     """
     Test exact number of tests when annotations used and no "test" in class name
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge({
         ScenarioExecutor.EXEC: {
             "executor": "selenium",
             "scenario": {
                 "script": __dir__() + "/../selenium/invalid/selenium1.java"
             }
         }
     })
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
     with open(obj.kpi_file) as kpi_fds:
         reader = csv.reader(kpi_fds)
         rows = list(reader)
     self.assertEqual(len(rows), 3)
 def test_samples_count_annotations(self):
     """
     Test exact number of tests when java annotations used
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge({
         "execution": {
             "executor": "selenium",
             "scenario": {
                 "script": "tests/selenium/invalid/SeleniumTest.java"
             }
         }
     })
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
     with open(obj.kpi_file) as kpi_fds:
         reader = csv.reader(kpi_fds)
         rows = list(reader)
     self.assertEqual(len(rows), 3)
 def test_samples_count_testcase(self):
     """
     Test exact number of tests when test class extends JUnit TestCase
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge({
         ScenarioExecutor.EXEC: {
             "executor": "selenium",
             "scenario": {
                 "script":
                 __dir__() + "/../selenium/invalid/SimpleTest.java"
             }
         }
     })
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
     with open(obj.kpi_file) as kpi_fds:
         reader = csv.reader(kpi_fds)
         rows = list(reader)
     self.assertEqual(len(rows), 3)
 def test_prepare_java_folder(self):
     """
     Check if scripts exist in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution = BetterDict()
     obj.execution.merge(
         {"scenario": {
             "script": ABS_PATH("/../../tests/selenium/java/")
         }})
     obj.prepare()
     prepared_files = os.listdir(obj.runner.working_dir)
     java_files = [
         file for file in prepared_files if file.endswith(".java")
     ]
     class_files = [
         file for file in prepared_files if file.endswith(".class")
     ]
     jars = [file for file in prepared_files if file.endswith(".jar")]
     self.assertEqual(len(java_files), 2)
     self.assertEqual(len(class_files), 2)
     self.assertEqual(len(jars), 1)
示例#6
0
    def test_selenium_startup_shutdown_jar_single(self):
        """
        runt tests from single jar
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(yaml.load(open("tests/yaml/selenium_executor_jar.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config["execution"]
        obj.execution.merge({"scenario": {"script": ABS_PATH("/../../tests/selenium/jar/dummy.jar")}})
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()

        prepared_files = os.listdir(obj.runner.working_dir)
        java_files = [file for file in prepared_files if file.endswith(".java")]
        class_files = [file for file in prepared_files if file.endswith(".class")]
        jars = [file for file in prepared_files if file.endswith(".jar")]
        self.assertEqual(len(java_files), 0)
        self.assertEqual(len(class_files), 0)
        self.assertEqual(len(jars), 1)
        self.assertTrue(os.path.exists(obj.runner.settings.get("report-file")))
示例#7
0
    def test_selenium_startup_shutdown_java_folder(self):
        """
        run tests from .java files
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge({'execution': {'scenario': {'script': 'tests/selenium/java/'}, 'executor': 'selenium'},
                                 'reporting': [{'module': 'junit-xml'}]})
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()

        prepared_files = os.listdir(obj.runner.working_dir)
        java_files = [file for file in prepared_files if file.endswith(".java")]
        class_files = [file for file in prepared_files if file.endswith(".class")]
        jars = [file for file in prepared_files if file.endswith(".jar")]
        self.assertEqual(2, len(java_files))
        self.assertEqual(2, len(class_files))
        self.assertEqual(1, len(jars))
        self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "compiled.jar")))
        self.assertTrue(os.path.exists(obj.runner.settings.get("report-file")))
 def test_prepare_java_single(self):
     """
     Check if script exists in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution.merge({
         "scenario": {
             "script":
             ABS_PATH("/../../tests/selenium/java/TestBlazemeterFail.java")
         }
     })
     obj.prepare()
     self.assertTrue(
         os.path.exists(
             os.path.join(obj.runner.working_dir,
                          "TestBlazemeterFail.java")))
     self.assertTrue(
         os.path.exists(
             os.path.join(obj.runner.working_dir,
                          "TestBlazemeterFail.class")))
     self.assertTrue(
         os.path.exists(os.path.join(obj.runner.working_dir,
                                     "compiled.jar")))
示例#9
0
    def test_selenium_startup_shutdown_java_folder(self):
        """
        run tests from .java files
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(yaml.load(open("tests/yaml/selenium_executor_java.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config["execution"]
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()

        prepared_files = os.listdir(obj.runner.working_dir)
        java_files = [file for file in prepared_files if file.endswith(".java")]
        class_files = [file for file in prepared_files if file.endswith(".class")]
        jars = [file for file in prepared_files if file.endswith(".jar")]
        self.assertEqual(2, len(java_files))
        self.assertEqual(2, len(class_files))
        self.assertEqual(1, len(jars))
        self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "compiled.jar")))
        self.assertTrue(os.path.exists(obj.runner.settings.get("report-file")))
示例#10
0
 def test_selenium_startup_shutdown_java_package(self):
     """
     Run tests from package
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge({
         'execution': {
             'scenario': {
                 'script': 'tests/selenium/java_package/'
             },
             'executor': 'selenium'
         },
         'reporting': [{
             'module': 'junit-xml'
         }]
     })
     obj.engine.config.merge({"provisioning": "local"})
     obj.execution = obj.engine.config['execution']
     obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
     self.assertTrue(
         os.path.exists(os.path.join(obj.runner.working_dir,
                                     "compiled.jar")))
示例#11
0
    def test_selenium_startup_shutdown_java_folder(self):
        """
        run tests from .java files
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(
            {'execution': {'scenario': {'script': __dir__() + '/../selenium/java/'}, 'executor': 'selenium'},
             'reporting': [{'module': 'junit-xml'}]})
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()

        prepared_files = os.listdir(obj.runner.working_dir)
        java_files = [fname for fname in prepared_files if fname.endswith(".java")]
        class_files = [fname for fname in prepared_files if fname.endswith(".class")]
        jars = [fname for fname in prepared_files if fname.endswith(".jar")]
        self.assertEqual(2, len(java_files))
        self.assertEqual(2, len(class_files))
        self.assertEqual(1, len(jars))
        self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "compiled.jar")))
        self.assertTrue(os.path.exists(obj.runner.settings.get("report-file")))
    def test_selenium_startup_shutdown_jar_single(self):
        """
        runt tests from single jar
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(
            {'execution': {'scenario': {'script': __dir__() + '/../selenium/jar/'}, 'executor': 'selenium'},
             'reporting': [{'module': 'junit-xml'}]})
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.execution.merge(
            {"scenario": {"script": __dir__() + "/../selenium/jar/dummy.jar"}})
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()

        prepared_files = os.listdir(obj.runner.working_dir)
        java_files = [fname for fname in prepared_files if fname.endswith(".java")]
        class_files = [fname for fname in prepared_files if fname.endswith(".class")]
        jars = [fname for fname in prepared_files if fname.endswith(".jar")]
        self.assertEqual(len(java_files), 0)
        self.assertEqual(len(class_files), 0)
        self.assertEqual(len(jars), 1)
        self.assertTrue(os.path.exists(obj.runner.settings.get("report-file")))
 def test_not_junit(self):
     """
     Check that JUnit runner fails if no tests were found
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config = BetterDict()
     obj.engine.config.merge({
         "execution": {
             "executor": "selenium",
             "scenario": {
                 "script": "tests/selenium/invalid/NotJUnittest.java"
             }
         }
     })
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     try:
         while not obj.check():
             time.sleep(1)
         self.fail()
     except BaseException as exc:
         self.assertIn("Nothing to test", exc.args[0])
     obj.shutdown()
示例#14
0
    def test_fail_on_zero_results(self):
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(yaml.load(open(__dir__() + "/../yaml/selenium_executor_requests.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']

        obj.prepare()
        self.assertRaises(RuntimeWarning, obj.post_process)
示例#15
0
 def test_prepare_jar_single(self):
     """
     Check if jar exists in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution = BetterDict()
     obj.execution.merge({"scenario": {"script": ABS_PATH("/../../tests/selenium/jar/dummy.jar")}})
     obj.prepare()
     self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "dummy.jar")))
示例#16
0
 def test_prepare_java_single(self):
     """
     Check if script exists in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution.merge({"scenario": {"script": ABS_PATH("/../../tests/selenium/java/TestBlazemeterFail.java")}})
     obj.prepare()
     self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "TestBlazemeterFail.java")))
     self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "TestBlazemeterFail.class")))
     self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "compiled.jar")))
示例#17
0
    def test_resource_files_collection_remote_jar(self):
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge({'execution': {'scenario': {'script': 'tests/selenium/jar/'}, 'executor': 'selenium'},
                                 'reporting': [{'module': 'junit-xml'}]})
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))

        res_files = obj.resource_files()
        res_artifacts = os.listdir(os.path.join(obj.engine.artifacts_dir, res_files))
        self.assertEqual(len(res_artifacts), 2)
示例#18
0
 def test_prepare_jar_folder(self):
     """
     Check if jars exist in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution = BetterDict()
     obj.execution.merge({"scenario": {"script": __dir__() + "/../selenium/jar/"}})
     obj.prepare()
     java_scripts = os.listdir(obj.runner.working_dir)
     self.assertEqual(len(java_scripts), 2)
示例#19
0
 def test_javac_fail(self):
     """
     Test RuntimeError when compilation fails
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config = BetterDict()
     obj.engine.config.merge(
         {"execution": {"executor": "selenium", "scenario": {"script": "tests/selenium/invalid/invalid.java"}}})
     obj.execution = obj.engine.config['execution']
     self.assertRaises(RuntimeError, obj.prepare)
示例#20
0
 def test_prepare_java_package(self):
     """
     Check if scripts exist in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution = BetterDict()
     obj.execution.merge(
         {"scenario": {"script": __dir__() + "/../selenium/java_package/"}})
     obj.prepare()
     self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "compiled.jar")))
示例#21
0
 def test_prepare_jar_folder(self):
     """
     Check if jars exist in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution = BetterDict()
     obj.execution.merge({"scenario": {"script": ABS_PATH("/../../tests/selenium/jar/")}})
     obj.prepare()
     java_scripts = os.listdir(obj.runner.working_dir)
     self.assertEqual(len(java_scripts), 2)
示例#22
0
    def test_resource_files_collection_remote_jar(self):
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(
            {'execution': {'scenario': {'script': __dir__() + '/../selenium/jar/'}, 'executor': 'selenium'},
             'reporting': [{'module': 'junit-xml'}]})
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))

        res_files = obj.resource_files()
        res_artifacts = os.listdir(os.path.join(obj.engine.artifacts_dir, res_files[0]))
        self.assertEqual(len(res_artifacts), 2)
示例#23
0
 def test_javac_fail(self):
     """
     Test RuntimeError when compilation fails
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config = BetterDict()
     obj.engine.config.merge(
         {"execution": {"executor": "selenium",
                        "scenario": {"script": __dir__() + "/../selenium/invalid/invalid.java"}}})
     obj.execution = obj.engine.config['execution']
     self.assertRaises(RuntimeError, obj.prepare)
示例#24
0
    def test_requests(self):
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(yaml.load(open(__dir__() + "/../yaml/selenium_executor_requests.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']

        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()
        with open(os.path.join(obj.engine.artifacts_dir, "junit.err")) as fds:
            contents = fds.read()
            self.assertEqual(1, contents.count("ok"))
            self.assertEqual(1, contents.count("OK"))
 def test_prepare_jar_single(self):
     """
     Check if jar exists in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution = BetterDict()
     obj.execution.merge({
         "scenario": {
             "script": ABS_PATH("/../../tests/selenium/jar/dummy.jar")
         }
     })
     obj.prepare()
     self.assertTrue(
         os.path.exists(os.path.join(obj.runner.working_dir, "dummy.jar")))
示例#26
0
    def test_selenium_startup_shutdown_jar_single(self):
        """
        runt tests from single jar
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge({
            'execution': {
                'scenario': {
                    'script': 'tests/selenium/jar/'
                },
                'executor': 'selenium'
            },
            'reporting': [{
                'module': 'junit-xml'
            }]
        })
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']
        obj.execution.merge({
            "scenario": {
                "script": ABS_PATH("/../../tests/selenium/jar/dummy.jar")
            }
        })
        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()

        prepared_files = os.listdir(obj.runner.working_dir)
        java_files = [
            file for file in prepared_files if file.endswith(".java")
        ]
        class_files = [
            file for file in prepared_files if file.endswith(".class")
        ]
        jars = [file for file in prepared_files if file.endswith(".jar")]
        self.assertEqual(len(java_files), 0)
        self.assertEqual(len(class_files), 0)
        self.assertEqual(len(jars), 1)
        self.assertTrue(os.path.exists(obj.runner.settings.get("report-file")))
示例#27
0
 def test_no_test_in_name(self):
     """
     Test exact number of tests when annotations used and no "test" in class name
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge({ScenarioExecutor.EXEC: {
         "executor": "selenium",
         "scenario": {"script": __dir__() + "/../selenium/invalid/selenium1.java"}
     }})
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
示例#28
0
 def test_samples_count_testcase(self):
     """
     Test exact number of tests when test class extends JUnit TestCase
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge({ScenarioExecutor.EXEC: {
         "executor": "selenium",
         "scenario": {"script": __dir__() + "/../selenium/invalid/SimpleTest.java"}
     }})
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
示例#29
0
 def test_samples_count_annotations(self):
     """
     Test exact number of tests when java annotations used
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge({ScenarioExecutor.EXEC: {
         "executor": "selenium",
         "scenario": {"script": __dir__() + "/../selenium/invalid/SeleniumTest.java"}
     }})
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
示例#30
0
    def test_requests(self):
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(yaml.load(open(__dir__() + "/../yaml/selenium_executor_requests.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']

        obj.prepare()
        obj.get_widget()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()
        with open(os.path.join(obj.engine.artifacts_dir, "junit.err")) as fds:
            contents = fds.read()
            self.assertEqual(1, contents.count("ok"))
            self.assertEqual(1, contents.count("OK"))
示例#31
0
 def test_prepare_java_folder(self):
     """
     Check if scripts exist in working dir
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.execution = BetterDict()
     obj.execution.merge({"scenario": {"script": ABS_PATH("/../../tests/selenium/java/")}})
     obj.prepare()
     prepared_files = os.listdir(obj.runner.working_dir)
     java_files = [file for file in prepared_files if file.endswith(".java")]
     class_files = [file for file in prepared_files if file.endswith(".class")]
     jars = [file for file in prepared_files if file.endswith(".jar")]
     self.assertEqual(len(java_files), 2)
     self.assertEqual(len(class_files), 2)
     self.assertEqual(len(jars), 1)
示例#32
0
    def test_selenium_startup_shutdown_java_package(self):
        """
        Run tests from package
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(yaml.load(open("tests/yaml/selenium_executor_java_package.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config["execution"]

        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()
        self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "compiled.jar")))
示例#33
0
 def test_selenium_startup_shutdown_java_package(self):
     """
     Run tests from package
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge(
         {'execution': {'scenario': {'script': 'tests/selenium/java_package/'}, 'executor': 'selenium'},
          'reporting': [{'module': 'junit-xml'}]})
     obj.engine.config.merge({"provisioning": "local"})
     obj.execution = obj.engine.config['execution']
     obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
     self.assertTrue(os.path.exists(os.path.join(obj.runner.working_dir, "compiled.jar")))
示例#34
0
 def test_samples_count_testcase(self):
     """
     Test exact number of tests when test class extends JUnit TestCase
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge(
         {"execution": {"executor": "selenium", "scenario": {"script": "tests/selenium/invalid/SimpleTest.java"}}})
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
     with open(obj.kpi_file) as kpi_fds:
         reader = csv.reader(kpi_fds)
         rows = list(reader)
     self.assertEqual(len(rows), 3)
示例#35
0
 def test_not_junit(self):
     """
     Check that JUnit runner fails if no tests were found
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config = BetterDict()
     obj.engine.config.merge(
         {"execution": {"executor": "selenium", "scenario": {"script": "tests/selenium/invalid/NotJUnittest.java"}}})
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     try:
         while not obj.check():
             time.sleep(1)
         self.fail()
     except BaseException as exc:
         self.assertIn("Nothing to test", exc.args[0])
     obj.shutdown()
示例#36
0
 def test_no_test_in_name(self):
     """
     Test exact number of tests when annotations used and no "test" in class name
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge(
         {"execution": {"executor": "selenium", "scenario": {"script": "tests/selenium/invalid/selenium1.java"}}}
     )
     obj.execution = obj.engine.config["execution"]
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
     with open(obj.kpi_file) as kpi_fds:
         reader = csv.reader(kpi_fds)
         rows = list(reader)
     self.assertEqual(len(rows), 3)
示例#37
0
 def test_samples_count_annotations(self):
     """
     Test exact number of tests when java annotations used
     :return:
     """
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     obj.engine.config.merge(
         {ScenarioExecutor.EXEC: {"executor": "selenium",
                                  "scenario": {"script": __dir__() + "/../selenium/invalid/SeleniumTest.java"}}})
     obj.execution = obj.engine.config['execution']
     obj.prepare()
     obj.startup()
     while not obj.check():
         time.sleep(1)
     obj.shutdown()
     with open(obj.kpi_file) as kpi_fds:
         reader = csv.reader(kpi_fds)
         rows = list(reader)
     self.assertEqual(len(rows), 3)
    def test_selenium_startup_shutdown_java_package(self):
        """
        Run tests from package
        :return:
        """
        obj = SeleniumExecutor()
        obj.engine = self.engine_obj
        obj.settings = self.selenium_config
        obj.engine.config.merge(
            yaml.load(
                open("tests/yaml/selenium_executor_java_package.yml").read()))
        obj.engine.config.merge({"provisioning": "local"})
        obj.execution = obj.engine.config['execution']

        obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
        obj.prepare()
        obj.startup()
        while not obj.check():
            time.sleep(1)
        obj.shutdown()
        self.assertTrue(
            os.path.exists(os.path.join(obj.runner.working_dir,
                                        "compiled.jar")))
示例#39
0
 def get_selenium_executor(self):
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     return obj
示例#40
0
 def get_selenium_executor(self):
     obj = SeleniumExecutor()
     obj.engine = self.engine_obj
     obj.settings = self.selenium_config
     return obj