当前位置: 首页>>代码示例>>Python>>正文


Python GrinderExecutor.engine方法代码示例

本文整理汇总了Python中bzt.modules.grinder.GrinderExecutor.engine方法的典型用法代码示例。如果您正苦于以下问题:Python GrinderExecutor.engine方法的具体用法?Python GrinderExecutor.engine怎么用?Python GrinderExecutor.engine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bzt.modules.grinder.GrinderExecutor的用法示例。


在下文中一共展示了GrinderExecutor.engine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_install_Grinder

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
    def test_install_Grinder(self):
        path = os.path.abspath(__dir__() + "/../../build/tmp/grinder-taurus/lib/grinder.jar")
        shutil.rmtree(os.path.dirname(os.path.dirname(path)), ignore_errors=True)

        grinder_link = GrinderExecutor.DOWNLOAD_LINK
        grinder_version = GrinderExecutor.VERSION
        mirrors_source = GrinderExecutor.MIRRORS_SOURCE
        GrinderExecutor.DOWNLOAD_LINK = "file:///" + __dir__() + "/../data/grinder-{version}_{version}-binary.zip"
        GrinderExecutor.VERSION = "3.11"
        GrinderExecutor.MIRRORS_SOURCE = "file:///" + __dir__() + "/../data/unicode_file"

        self.assertFalse(os.path.exists(path))

        obj = GrinderExecutor()
        obj.engine = EngineEmul()
        obj.settings.merge({"path": path})
        obj.settings.merge({"properties-file": __dir__() + "/../grinder/grinder.base.properties",
                            "properties": {"sample_prop": "some_val"}})
        obj.execution.merge({"scenario": {
            "script": __dir__() + "/../grinder/helloworld.py",
            "properties-file": __dir__() + "/..//grinder/grinder.properties",
            "properties": {"grinder.useConsole": "false"}}})
        obj.prepare()

        self.assertTrue(os.path.exists(path))

        GrinderExecutor.DOWNLOAD_LINK = grinder_link
        GrinderExecutor.VERSION = grinder_version
        GrinderExecutor.MIRRORS_SOURCE = mirrors_source
开发者ID:PurdyForks,项目名称:taurus,代码行数:31,代码来源:test_Grinder.py

示例2: test_grinder_widget

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
 def test_grinder_widget(self):
     obj = GrinderExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": "tests/grinder/helloworld.py"}})
     obj.prepare()
     obj.get_widget()
     self.assertEqual(obj.widget.script_name.text, "Script: helloworld.py")
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:9,代码来源:test_GrinderExecutor.py

示例3: test_fail_on_zero_results

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
 def test_fail_on_zero_results(self):
     obj = GrinderExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"concurrency": {"local": 2},
                          "scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})
     obj.prepare()
     self.assertRaises(RuntimeWarning, obj.post_process)
开发者ID:dotIN,项目名称:taurus,代码行数:9,代码来源:test_Grinder.py

示例4: test_install_Grinder

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
    def test_install_Grinder(self):
        path = os.path.abspath(__dir__() + "/../../build/tmp/grinder-taurus/lib/grinder.jar")
        shutil.rmtree(os.path.dirname(os.path.dirname(path)), ignore_errors=True)

        self.assertFalse(os.path.exists(path))

        obj = GrinderExecutor()
        obj.engine = EngineEmul()
        obj.settings.merge({"path": path})
        obj.settings.merge(
            {
                "properties-file": __dir__() + "/../grinder/grinder.base.properties",
                "properties": {"sample_prop": "some_val"},
            }
        )
        obj.execution.merge(
            {
                "scenario": {
                    "script": __dir__() + "/../grinder/helloworld.py",
                    "properties-file": __dir__() + "/..//grinder/grinder.properties",
                    "properties": {"grinder.useConsole": "false"},
                }
            }
        )
        obj.prepare()

        self.assertTrue(os.path.exists(path))
开发者ID:VegiS,项目名称:taurus,代码行数:29,代码来源:test_Grinder.py

示例5: test_resource_files_collection_noscript

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
 def test_resource_files_collection_noscript(self):
     obj = GrinderExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"properties-file": "tests/grinder/grinder.properties"}})
     res_files = obj.resource_files()
     artifacts = os.listdir(obj.engine.artifacts_dir)
     self.assertEqual(len(res_files), 2)
     self.assertEqual(len(artifacts), 2)
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:10,代码来源:test_GrinderExecutor.py

示例6: test_resource_files_collection_local

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
 def test_resource_files_collection_local(self):
     obj = GrinderExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": "tests/grinder/helloworld.py",
                                       "properties-file": "tests/grinder/grinder.properties"}})
     obj.prepare()
     artifacts = os.listdir(obj.engine.artifacts_dir)
     self.assertEqual(len(artifacts), 2)
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:10,代码来源:test_GrinderExecutor.py

示例7: test_resource_files_collection_remote

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
 def test_resource_files_collection_remote(self):
     obj = GrinderExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": __dir__() + "/../grinder/helloworld.py",
                                       "properties-file": __dir__() + "/../grinder/grinder.properties"}})
     res_files = obj.resource_files()
     artifacts = os.listdir(obj.engine.artifacts_dir)
     self.assertEqual(len(res_files), 2)
     self.assertEqual(len(artifacts), 2)
开发者ID:vasischev,项目名称:taurus,代码行数:11,代码来源:test_GrinderExecutor.py

示例8: test_grinder_widget

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
 def test_grinder_widget(self):
     obj = GrinderExecutor()
     obj.engine = EngineEmul()
     obj.engine.config.merge({"provisioning": 'local'})
     obj.execution.merge({"concurrency": {"local": 2},
                          "ramp-up": 2,
                          "hold-for": 2,
                          "scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})
     obj.prepare()
     obj.get_widget()
     self.assertEqual(obj.widget.widgets[0].text, "Script: helloworld.py")
开发者ID:dotIN,项目名称:taurus,代码行数:13,代码来源:test_Grinder.py

示例9: test_script_generation

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
    def test_script_generation(self):
        obj = GrinderExecutor()
        obj.engine = EngineEmul()
        obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})
        obj.execution.merge({
            "scenario": {
                "default-address": "http://blazedemo.com",
                "headers": {
                    "My-Header": "Its-Value",
                    "Another-Header": "Another-Value",
                },
                "timeout": "30s",
                "think-time": "2s",
                "store-cookie": True,
                "requests": [
                    '/',
                    {'url': 'http://example.com/',
                     'method': 'POST',
                     'think-time': "1s",
                     'headers': {
                         'Custom': 'Header',
                     }},
                ]
            }
        })
        obj.prepare()
        script = open(os.path.join(obj.engine.artifacts_dir, 'grinder_requests.py')).read()

        default_addr = re.findall(r"url='http://blazedemo.com'", script)
        self.assertEquals(1, len(default_addr))

        requests = re.findall(r"request\.([A-Z]+)\('(.+?)'", script)
        self.assertEquals(2, len(requests))
        self.assertEquals(requests[0], ('GET', '/'))
        self.assertEquals(requests[1], ('POST', 'http://example.com/'))

        sleeps = re.findall(r"grinder\.sleep\((.+)\)", script)
        self.assertEquals(2, len(sleeps))
        self.assertEquals(sleeps[0], '2000')
        self.assertEquals(sleeps[1], '1000')

        headers = re.findall(r"NVPair\('(.+)', '(.+)'\)", script)
        self.assertEquals(3, len(headers))
        self.assertIn(("My-Header", "Its-Value"), headers)
        self.assertIn(("Another-Header", "Another-Value"), headers)
        self.assertIn(("Custom", "Header"), headers)

        timeout = re.findall(r"defaults.setTimeout\((\d+)\)", script)
        self.assertEquals(1, len(timeout))
        self.assertEquals(timeout[0], '30000')

        cookies = re.findall(r"defaults.setUseCookies\(1\)", script)
        self.assertEquals(1, len(cookies))
开发者ID:PurdyForks,项目名称:taurus,代码行数:55,代码来源:test_Grinder.py

示例10: test_resource_files_collection_invalid

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
    def test_resource_files_collection_invalid(self):
        obj = GrinderExecutor()
        obj.engine = EngineEmul()
        obj.execution.merge({"scenario": {"script": "tests/grinder/helloworld.py",
                                          "properties-file": "tests/grinder/grinder_invalid.properties"}})
        res_files = obj.resource_files()
        artifacts = os.listdir(obj.engine.artifacts_dir)
        self.assertEqual(len(res_files), 2)
        self.assertEqual(len(artifacts), 2)

        self.assertIn("helloworld.py", open(os.path.join(obj.engine.artifacts_dir,
                                                         "grinder_invalid.properties")).read())
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:14,代码来源:test_GrinderExecutor.py

示例11: test_fail_on_zero_results

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
 def test_fail_on_zero_results(self):
     obj = GrinderExecutor()
     obj.engine = EngineEmul()
     obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})
     obj.execution.merge({"concurrency": {"local": 2},
                          "scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})
     obj.prepare()
     obj.engine.prepared = [obj]
     obj.engine.started = [obj]
     obj.engine.provisioning = Local()
     obj.engine.provisioning.engine = obj.engine
     obj.engine.provisioning.executors = [obj]
     self.assertRaises(RuntimeWarning, obj.engine.provisioning.post_process)
开发者ID:PurdyForks,项目名称:taurus,代码行数:15,代码来源:test_Grinder.py

示例12: test_full_Grinder

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
    def test_full_Grinder(self):
        obj = GrinderExecutor()
        obj.kpi_file = os.path.abspath(__dir__() + "/../grinder/test.log")
        obj.engine = EngineEmul()
        obj.execution.merge(
            {"concurrency": {"local": 2}, "hold-for": 5, "scenario": {"requests": ["http://blazedemo.com"]}}
        )
        obj.prepare()

        try:
            obj.cmd_line = __dir__() + "/../grinder/grinder.sh"
            obj.startup()
            while not obj.check():
                time.sleep(obj.engine.check_interval)
        finally:
            obj.shutdown()
        self.assertRaises(RuntimeWarning, obj.post_process)
开发者ID:VegiS,项目名称:taurus,代码行数:19,代码来源:test_Grinder.py

示例13: test_with_results

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
    def test_with_results(self):
        obj = GrinderExecutor()

        obj.engine = EngineEmul()
        obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})
        obj.execution.merge({
            "concurrency": {"local": 2},
            "scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})
        obj.prepare()
        obj.engine.prepared = [obj]
        obj.engine.started = [obj]
        prov = Local()
        prov.engine = obj.engine
        prov.executors = [obj]
        obj.engine.provisioning = prov
        obj.reader.buffer = ['some info']
        obj.engine.provisioning.post_process()
开发者ID:PurdyForks,项目名称:taurus,代码行数:19,代码来源:test_Grinder.py

示例14: test_full_Grinder

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
    def test_full_Grinder(self):
        obj = GrinderExecutor()
        obj.kpi_file = os.path.abspath(__dir__() + '/../grinder/test.log')
        obj.engine = EngineEmul()
        obj.execution.merge({"concurrency": {"local": 2},
                             "hold-for": 5,
                             "scenario": {"requests": ['http://blazedemo.com']}})
        obj.prepare()

        self.assertEqual(len(obj.cmd_line), 5)
        cmd_line = ' '.join(obj.cmd_line)
        self.assertTrue(cmd_line.startswith('java -classpath'))
        self.assertNotEqual(cmd_line.find('net.grinder.Grinder'), -1)

        try:
            obj.cmd_line = __dir__() + "/../grinder/grinder" + EXE_SUFFIX
            obj.startup()
            while not obj.check():
                time.sleep(obj.engine.check_interval)
        finally:
            obj.shutdown()
        self.assertRaises(RuntimeWarning, obj.post_process)
开发者ID:dotIN,项目名称:taurus,代码行数:24,代码来源:test_Grinder.py

示例15: test_resource_files_collection_basic

# 需要导入模块: from bzt.modules.grinder import GrinderExecutor [as 别名]
# 或者: from bzt.modules.grinder.GrinderExecutor import engine [as 别名]
 def test_resource_files_collection_basic(self):
     obj = GrinderExecutor()
     obj.engine = EngineEmul()
     obj.execution.merge({"scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})
     res_files = obj.resource_files()
     self.assertEqual(len(res_files), 1)
开发者ID:PurdyForks,项目名称:taurus,代码行数:8,代码来源:test_Grinder.py


注:本文中的bzt.modules.grinder.GrinderExecutor.engine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。