def test_gatling_widget(self): obj = GatlingExecutor() obj.engine = EngineEmul() obj.execution.merge({"scenario": {"script": "tests/gatling/BasicSimulation.scala"}}) obj.prepare() obj.get_widget() self.assertEqual(obj.widget.script_name.text, "Script: BasicSimulation.scala")
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
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")
def test_install_Gatling(self): path = os.path.abspath(__dir__() + "/../../build/tmp/gatling-taurus/bin/gatling" + EXE_SUFFIX) 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 mirrors_link = GatlingExecutor.MIRRORS_SOURCE GatlingExecutor.DOWNLOAD_LINK = "file:///" + __dir__() + "/../data/gatling-dist-{version}_{version}.zip" GatlingExecutor.VERSION = '2.1.4' GatlingExecutor.MIRRORS_SOURCE = "file:///" + __dir__() + "/../data/unicode_file" 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 GatlingExecutor.MIRRORS_SOURCE = mirrors_link
def test_resource_files_collection_local(self): obj = GatlingExecutor() obj.engine = EngineEmul() obj.execution.merge({"scenario": {"script": "tests/gatling/LocalBasicSimulation.scala"}}) obj.prepare() artifacts = os.listdir(obj.engine.artifacts_dir) self.assertEqual(len(artifacts), 14) self.__check_path_resource_files(os.path.join(obj.engine.artifacts_dir, "LocalBasicSimulation.scala"))
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"))
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)