本文整理汇总了Python中tests.mocks.EngineEmul类的典型用法代码示例。如果您正苦于以下问题:Python EngineEmul类的具体用法?Python EngineEmul怎么用?Python EngineEmul使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EngineEmul类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SeleniumTestCase
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]
示例2: SeleniumTestCase
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"]
示例3: SeleniumTestCase
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
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: test_encode_decode_infinities
def test_encode_decode_infinities(self):
engine = EngineEmul()
obj = Configuration()
obj.merge({
"foo": float("inf"),
})
cfg = engine.create_artifact("config", ".json")
obj.dump(cfg, Configuration.JSON)
with open(cfg) as fds:
dump = json.loads(fds.read())
self.assertEqual(dump["foo"], "inf")
self.assertEqual(dehumanize_time(dump["foo"]), float("inf"))
示例6: setUp
def setUp(self):
super(SeleniumTestCase, self).setUp()
self.engine_obj = EngineEmul()
self.engine_obj.artifacts_base_dir = ABS_PATH("/../../build/test")
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"]
示例7: setUp
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
示例8: test_functional_report
def test_functional_report(self):
engine = EngineEmul()
aggregator = FunctionalAggregator()
aggregator.engine = engine
engine.aggregator = aggregator
obj = JUnitXMLReporter()
obj.engine = engine
obj.parameters = BetterDict()
reader = FuncSamplesReader(RESOURCES_DIR + "functional/nose.ldjson", engine, ROOT_LOGGER)
aggregator.add_underling(reader)
aggregator.prepare()
obj.prepare()
aggregator.post_process()
obj.post_process()
self.assertFilesEqual(obj.report_file_path, RESOURCES_DIR + "functional/xunit-report.xml")
示例9: setUp
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
示例10: TestSwagger2YAML
class TestSwagger2YAML(BZTestCase):
def setUp(self):
super(TestSwagger2YAML, self).setUp()
self.engine = EngineEmul()
def _get_swagger2yaml(self, path, file_name=None):
return Swagger2YAML(FakeOptions(file_name=file_name), RESOURCES_DIR + path)
def _get_tmp(self, prefix='test', suffix='.yml'):
return self.engine.create_artifact(prefix, suffix)
def test_convert(self):
self.maxDiff = None
source = RESOURCES_DIR + "/swagger/petstore.json"
result = self._get_tmp()
options = FakeOptions(file_name=result)
process(options, [source])
actual = yaml.load(open(result).read())
expected = yaml.load(open(RESOURCES_DIR + "/swagger/petstore-converted.yaml").read())
self.assertEqual(actual, expected)
示例11: TestConverter
class TestConverter(BZTestCase):
def setUp(self):
super(TestConverter, self).setUp()
self.engine = EngineEmul()
def _get_soapui2yaml(self, path, file_name=None, test_case=None):
return SoapUI2YAML(FakeOptions(file_name=file_name, test_case=test_case), __dir__() + path)
def _get_tmp(self, prefix='test', suffix='.yml'):
return self.engine.create_artifact(prefix, suffix)
def test_convert(self):
source = RESOURCES_DIR + "soapui/project.xml"
result = self._get_tmp()
options = FakeOptions(file_name=result, test_case="index")
process(options, [source])
actual = yaml.load(open(result).read())
expected = yaml.load(open(RESOURCES_DIR + "soapui/project.xml.yml").read())
self.assertEqual(actual, expected)
def test_flickr(self):
source = RESOURCES_DIR + "soapui/flickr-sample.xml"
result = self._get_tmp()
options = FakeOptions(file_name=result)
process(options, [source])
actual = yaml.load(open(result).read())
expected = yaml.load(open(RESOURCES_DIR + "soapui/flickr-sample.xml.yml").read())
self.assertEqual(actual, expected)
def test_egalaxy(self):
source = RESOURCES_DIR + "soapui/egalaxy.xml"
result = self._get_tmp()
options = FakeOptions(file_name=result)
process(options, [source])
actual = yaml.load(open(result).read())
expected = yaml.load(open(RESOURCES_DIR + "soapui/egalaxy.xml.yml").read())
self.assertEqual(actual, expected)
示例12: setUp
def setUp(self):
super(TestEngine, self).setUp()
self.obj = EngineEmul()
self.paths = local_paths_config()
示例13: TestEngine
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()
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_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
示例14: setUp
def setUp(self):
super(TestConverter, self).setUp()
self.engine = EngineEmul()
示例15: setUp
def setUp(self):
self.engine = EngineEmul()