本文整理匯總了Python中tests.mocks.EngineEmul.configure方法的典型用法代碼示例。如果您正苦於以下問題:Python EngineEmul.configure方法的具體用法?Python EngineEmul.configure怎麽用?Python EngineEmul.configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tests.mocks.EngineEmul
的用法示例。
在下文中一共展示了EngineEmul.configure方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: SeleniumTestCase
# 需要導入模塊: from tests.mocks import EngineEmul [as 別名]
# 或者: from tests.mocks.EngineEmul import configure [as 別名]
class SeleniumTestCase(BZTestCase):
def setUp(self):
super(SeleniumTestCase, self).setUp()
self.engine_obj = EngineEmul()
self.paths = [ABS_PATH("/../../bzt/10-base.json"), local_paths_config()]
self.engine_obj.configure(self.paths)
self.selenium_config = self.engine_obj.config["modules"]["selenium"]
示例2: SeleniumTestCase
# 需要導入模塊: from tests.mocks import EngineEmul [as 別名]
# 或者: from tests.mocks.EngineEmul import configure [as 別名]
class SeleniumTestCase(BZTestCase):
"""
:type obj: SubprocessedExecutor
"""
def __init__(self, methodName='runTest'):
super(SeleniumTestCase, self).__init__(methodName)
self.obj = None
def setUp(self):
super(SeleniumTestCase, self).setUp()
self.engine = EngineEmul()
paths = [local_paths_config()]
self.engine.configure(paths) # FIXME: avoid using whole engine in particular module test!
self.virtual_display = VirtualDisplay()
self.virtual_display.engine = self.engine
self.virtual_display.startup()
self.obj = SeleniumExecutor()
self.obj.engine = self.engine
self.obj.settings = self.engine.config.get("modules").get("selenium")
self.obj.env = self.obj.engine.env
def tearDown(self):
self.virtual_display.shutdown()
super(SeleniumTestCase, self).tearDown()
def configure(self, config):
self.obj.engine.config.merge(config)
self.obj.execution = self.obj.engine.config.get('execution')
if isinstance(self.obj.execution, list):
self.obj.execution = self.obj.execution[0]
示例3: SeleniumTestCase
# 需要導入模塊: from tests.mocks import EngineEmul [as 別名]
# 或者: from tests.mocks.EngineEmul import configure [as 別名]
class SeleniumTestCase(BZTestCase):
def setUp(self):
super(SeleniumTestCase, self).setUp()
self.engine_obj = EngineEmul()
self.paths = [__dir__() + "/../../bzt/10-base.json", local_paths_config()]
self.engine_obj.configure(self.paths) # FIXME: avoid using whole engine in particular module test!
self.engine_obj.config.get("modules").get("selenium").merge({"virtual-display": {"width": 1024, "height": 768}})
self.selenium_config = self.engine_obj.config["modules"]["selenium"]
示例4: setUp
# 需要導入模塊: from tests.mocks import EngineEmul [as 別名]
# 或者: from tests.mocks.EngineEmul import configure [as 別名]
def setUp(self):
super(TestTestNGTester, self).setUp()
engine_obj = EngineEmul()
paths = [local_paths_config()]
engine_obj.configure(paths)
self.obj = TestNGTester()
self.obj.settings = engine_obj.config.get("modules").get("testng")
self.obj.engine = engine_obj
self.obj.env = self.obj.engine.env
示例5: setUp
# 需要導入模塊: from tests.mocks import EngineEmul [as 別名]
# 或者: from tests.mocks.EngineEmul import configure [as 別名]
def setUp(self):
super(TestJUnitTester, self).setUp()
engine_obj = EngineEmul()
paths = [local_paths_config()]
engine_obj.configure(paths)
# just download geckodriver & chromedriver with selenium
selenium = SeleniumExecutor()
selenium.engine = engine_obj
selenium.install_required_tools()
for driver in selenium.webdrivers:
selenium.env.add_path({"PATH": driver.get_driver_dir()})
self.obj = JUnitTester()
self.obj.env = selenium.env
self.obj.settings = engine_obj.config.get("modules").get("junit")
self.obj.engine = engine_obj
示例6: TestEngine
# 需要導入模塊: from tests.mocks import EngineEmul [as 別名]
# 或者: from tests.mocks.EngineEmul import configure [as 別名]
class TestEngine(BZTestCase):
def setUp(self):
super(TestEngine, self).setUp()
self.obj = EngineEmul()
self.paths = local_paths_config()
def test_requests(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/get-post.json",
__dir__() + "/json/reporting.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
for executor in self.obj.provisioning.executors:
executor._env['TEST_MODE'] = 'files'
self.obj.run()
self.obj.post_process()
def test_double_exec(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/yaml/triple.yml",
__dir__() + "/json/reporting.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
for executor in self.obj.provisioning.executors:
executor._env['TEST_MODE'] = 'files'
self.obj.run()
self.obj.post_process()
def test_unknown_module(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/gatling.json",
self.paths
]
self.obj.configure(configs)
self.obj.config["provisioning"] = "unknown"
self.obj.config["modules"]["unknown"] = BetterDict()
try:
self.obj.prepare()
self.fail()
except ValueError:
pass
示例7: TestEngine
# 需要導入模塊: from tests.mocks import EngineEmul [as 別名]
# 或者: from tests.mocks.EngineEmul import configure [as 別名]
class TestEngine(BZTestCase):
def setUp(self):
super(TestEngine, self).setUp()
self.obj = EngineEmul()
self.obj.artifacts_base_dir = tempfile.gettempdir() + "/bzt"
self.paths = local_paths_config()
def test_jmx(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/jmx.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.obj.run()
self.obj.post_process()
def test_requests(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/get-post.json",
__dir__() + "/json/reporting.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.obj.prepare()
self.obj.run()
self.obj.post_process()
def test_double_exec(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/yaml/triple.yml",
__dir__() + "/json/reporting.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.obj.run()
self.obj.post_process()
def test_grinder(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/grinder.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.obj.run()
self.obj.post_process()
def test_gatling(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/gatling.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.obj.run()
self.obj.post_process()
def test_unknown_module(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/gatling.json",
self.paths
]
self.obj.configure(configs)
self.obj.config["provisioning"] = "unknown"
self.obj.config["modules"]["unknown"] = BetterDict()
try:
self.obj.prepare()
self.fail()
except ValueError:
pass
示例8: TestEngine
# 需要導入模塊: from tests.mocks import EngineEmul [as 別名]
# 或者: from tests.mocks.EngineEmul import configure [as 別名]
class TestEngine(BZTestCase):
def setUp(self):
super(TestEngine, self).setUp()
self.obj = EngineEmul()
self.paths = local_paths_config()
def test_find_file(self):
self.sniff_log(self.obj.log)
config = RESOURCES_DIR + "json/get-post.json"
configs = [config, self.paths]
self.obj.configure(configs)
self.assertEqual(2, len(self.obj.file_search_paths))
self.obj.find_file(config)
self.assertEqual("", self.log_recorder.warn_buff.getvalue())
self.obj.find_file("reporting.json")
self.assertIn("Guessed location", self.log_recorder.warn_buff.getvalue())
self.obj.find_file("definitely_missed.file")
self.assertIn("Could not find", self.log_recorder.warn_buff.getvalue())
self.obj.find_file("http://localhost:8000/BlazeDemo.html")
self.assertIn("Downloading http://localhost:8000/BlazeDemo.html", self.log_recorder.info_buff.getvalue())
def test_missed_config(self):
configs = ['definitely_missed.file']
try:
self.obj.configure(configs)
self.fail()
except TaurusConfigError as exc:
self.assertIn('reading config file', str(exc))
def test_configuration_smoothness(self):
def find_ad_dict_ed(*args):
if isinstance(args[0], dict) and not isinstance(args[0], BetterDict):
raise BaseException("dict found in Configuration")
configs = [
RESOURCES_DIR + "json/get-post.json",
self.paths]
self.obj.configure(configs)
self.assertTrue(isinstance(self.obj.config, Configuration))
BetterDict.traverse(self.obj.config, find_ad_dict_ed)
def test_requests(self):
configs = [
RESOURCES_DIR + "json/get-post.json",
RESOURCES_DIR + "json/reporting.json",
self.paths]
self.obj.configure(configs)
self.obj.prepare()
for executor in self.obj.provisioning.executors:
executor.env.set({"TEST_MODE": "files"})
self.obj.run()
self.obj.post_process()
def test_double_exec(self):
configs = [
RESOURCES_DIR + "yaml/triple.yml",
RESOURCES_DIR + "json/reporting.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.assertEquals(1, len(self.obj.services))
for executor in self.obj.provisioning.executors:
executor.env.set({"TEST_MODE": "files"})
self.obj.run()
self.obj.post_process()
def test_unknown_module(self):
configs = [
RESOURCES_DIR + "json/gatling.json",
self.paths
]
self.obj.configure(configs)
self.obj.config["provisioning"] = "unknown"
self.obj.config["modules"]["unknown"] = BetterDict()
self.assertRaises(TaurusConfigError, self.obj.prepare)
def test_null_aggregator(self):
self.obj.config.merge({
"execution": [{
"scenario": {
"requests": [{"url": "http://example.com/"}],
}}],
"settings": {
"aggregator": None,
"default-executor": "jmeter",
},
"modules": {
"local": "bzt.modules.provisioning.Local",
#.........這裏部分代碼省略.........