def test_gatling_widget(self):
     obj = GatlingExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": __dir__() + "/../gatling/BasicSimulation.scala"}})
     obj.prepare()
     obj.get_widget()
     self.assertEqual(obj.widget.widgets[0].text, "Script: BasicSimulation.scala")
示例#2
0
def get_gatling():
    path = os.path.abspath(RESOURCES_DIR + "gatling/gatling" + EXE_SUFFIX)
    obj = GatlingExecutor()
    obj.engine = EngineEmul()
    obj.env = obj.engine.env
    obj.settings.merge({"path": path})
    return obj
示例#3
0
    def test_install_Gatling(self):
        path = os.path.abspath(
            __dir__() + "/../../build/tmp/gatling-taurus/bin/gatling.sh")
        shutil.rmtree(os.path.dirname(os.path.dirname(path)),
                      ignore_errors=True)

        # backup download link and version
        gatling_link = GatlingExecutor.DOWNLOAD_LINK
        gatling_ver = GatlingExecutor.VERSION

        GatlingExecutor.DOWNLOAD_LINK = "file://" + __dir__(
        ) + "/../data/gatling-dist-{version}_{version}.zip"
        GatlingExecutor.VERSION = '2.1.4'

        self.assertFalse(os.path.exists(path))
        obj = GatlingExecutor()
        obj.engine = EngineEmul()
        obj.settings.merge({"path": path})

        obj.execution = BetterDict()
        obj.execution.merge({
            "scenario": {
                "script": "tests/gatling/BasicSimulation.scala",
                "simulation": "mytest.BasicSimulation"
            }
        })
        obj.prepare()
        self.assertTrue(os.path.exists(path))
        obj.prepare()
        GatlingExecutor.DOWNLOAD_LINK = gatling_link
        GatlingExecutor.VERSION = gatling_ver
示例#4
0
 def getGatling():
     path = os.path.abspath(__dir__() + "/../resources/gatling/gatling" +
                            EXE_SUFFIX)
     obj = GatlingExecutor()
     obj.engine = EngineEmul()
     obj.settings.merge({"path": path})
     return obj
示例#5
0
 def getGatling(self):
     path = os.path.abspath(__dir__() +
                            "/../../build/gatling-taurus/bin/gatling" +
                            EXE_SUFFIX)
     obj = GatlingExecutor()
     obj.engine = EngineEmul()
     obj.settings.merge({"path": path})
     return obj
 def test_resource_files_collection_local(self):
     obj = GatlingExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": __dir__() + "/../gatling/LocalBasicSimulation.scala"}})
     obj.prepare()
     artifacts = os.listdir(obj.engine.artifacts_dir)
     self.assertEqual(len(artifacts), 12)
     self.__check_path_resource_files(os.path.join(obj.engine.artifacts_dir, "LocalBasicSimulation.scala"))
示例#7
0
 def test_resource_files_collection_remote(self):
     obj = GatlingExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": "tests/gatling/LocalBasicSimulation.scala"}})
     res_files = obj.resource_files()
     artifacts = os.listdir(obj.engine.artifacts_dir)
     self.assertEqual(len(res_files), 15)  # file "gatling_" will be not found
     self.assertEqual(len(artifacts), 13)
     self.__check_path_resource_files(os.path.join(obj.engine.artifacts_dir, "LocalBasicSimulation.scala"))
示例#8
0
 def test_resource_files_collection(self):
     obj = GatlingExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({
         "scenario": {
             "script": "tests/gatling/LocalBasicSimulation.scala"
         }
     })
     res_files = obj.resource_files()
     artifacts = os.listdir(obj.engine.artifacts_dir)
     self.assertEqual(len(res_files), 15)
     self.assertEqual(len(artifacts), 14)
 def test_fail_on_zero_results(self):
     obj = GatlingExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": __dir__() + "/../gatling/BasicSimulation.scala"}})
     obj.prepare()
     self.assertRaises(RuntimeWarning, obj.post_process)