本文整理汇总了Python中bzt.modules.reporting.JUnitXMLReporter.last_second方法的典型用法代码示例。如果您正苦于以下问题:Python JUnitXMLReporter.last_second方法的具体用法?Python JUnitXMLReporter.last_second怎么用?Python JUnitXMLReporter.last_second使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bzt.modules.reporting.JUnitXMLReporter
的用法示例。
在下文中一共展示了JUnitXMLReporter.last_second方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_xml_format_passfail
# 需要导入模块: from bzt.modules.reporting import JUnitXMLReporter [as 别名]
# 或者: from bzt.modules.reporting.JUnitXMLReporter import last_second [as 别名]
def test_xml_format_passfail(self):
obj = JUnitXMLReporter()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
pass_fail1 = PassFailStatus()
fc1_triggered = DataCriteria({'stop': True, 'label': 'Sample 1 Triggered', 'fail': True,
'timeframe': -1, 'threshold': '150ms', 'condition': '<', 'subject': 'avg-rt'},
pass_fail1)
fc1_not_triggered = DataCriteria({'stop': True, 'label': 'Sample 1 Not Triggered', 'fail': True,
'timeframe': -1, 'threshold': '300ms', 'condition': '>', 'subject': 'avg-rt'},
pass_fail1)
pass_fail2 = PassFailStatus()
fc2_triggered = DataCriteria({'stop': True, 'label': 'Sample 2 Triggered', 'fail': True, 'timeframe': -1,
'threshold': '150ms', 'condition': '<=', 'subject': 'avg-rt'}, pass_fail1)
fc2_not_triggered = DataCriteria({'stop': True, 'label': 'Sample 2 Not Triggered', 'fail': True,
'timeframe': -1, 'threshold': '300ms', 'condition': '=', 'subject': 'avg-rt'},
pass_fail1)
pass_fail1.criterias.append(fc1_triggered)
pass_fail1.criterias.append(fc1_not_triggered)
pass_fail2.criterias.append(fc2_triggered)
pass_fail2.criterias.append(fc2_not_triggered)
fc1_triggered.is_triggered = True
fc2_triggered.is_triggered = True
obj.engine.reporters.append(pass_fail1)
obj.engine.reporters.append(pass_fail2)
obj.engine.reporters.append(BlazeMeterUploader())
path_from_config = tempfile.mktemp(suffix='.xml', prefix='junit-xml_passfail', dir=obj.engine.artifacts_dir)
obj.parameters.merge({"filename": path_from_config, "data-source": "pass-fail"})
obj.prepare()
obj.last_second = DataPoint(0)
obj.post_process()
with open(obj.report_file_path, 'rb') as fds:
f_contents = fds.read()
xml_tree = etree.fromstring(f_contents)
self.assertEqual('testsuite', xml_tree.tag)
self.assertEqual(4, len(xml_tree.getchildren()))
self.assertEqual('testcase', xml_tree.getchildren()[0].tag)
self.assertEqual('error', xml_tree.getchildren()[0].getchildren()[0].tag)
self.assertEqual('error', xml_tree.getchildren()[2].getchildren()[0].tag)
示例2: test_report_criteria_without_label
# 需要导入模块: from bzt.modules.reporting import JUnitXMLReporter [as 别名]
# 或者: from bzt.modules.reporting.JUnitXMLReporter import last_second [as 别名]
def test_report_criteria_without_label(self):
obj = JUnitXMLReporter()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
pass_fail = PassFailStatus()
crit_cfg = BetterDict.from_dict({'stop': True, 'fail': True, 'timeframe': -1, 'threshold': '150ms',
'condition': '<', 'subject': 'avg-rt'})
criteria = DataCriterion(crit_cfg, pass_fail)
pass_fail.criteria.append(criteria)
criteria.is_triggered = True
obj.engine.reporters.append(pass_fail)
path_from_config = tempfile.mktemp(suffix='.xml', prefix='junit-xml_passfail', dir=obj.engine.artifacts_dir)
obj.parameters.merge({"filename": path_from_config, "data-source": "pass-fail"})
obj.prepare()
obj.last_second = DataPoint(0)
obj.post_process()
示例3: test_xml_format_passfail
# 需要导入模块: from bzt.modules.reporting import JUnitXMLReporter [as 别名]
# 或者: from bzt.modules.reporting.JUnitXMLReporter import last_second [as 别名]
def test_xml_format_passfail(self):
obj = JUnitXMLReporter()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
obj.engine.provisioning = CloudProvisioning()
obj.engine.provisioning.results_url = "http://test/report/123"
pass_fail1 = CriteriaProcessor([], None)
crit_cfg1 = BetterDict()
crit_cfg2 = BetterDict()
crit_cfg3 = BetterDict()
crit_cfg4 = BetterDict()
crit_cfg1.merge({
'stop': True, 'label': 'Sample 1 Triggered', 'fail': True,
'timeframe': -1, 'threshold': '150ms', 'condition': '<', 'subject': 'avg-rt'})
crit_cfg2.merge({
'stop': True, 'label': 'Sample 1 Not Triggered', 'fail': True,
'timeframe': -1, 'threshold': '300ms', 'condition': '>', 'subject': 'avg-rt'})
crit_cfg3.merge({
'stop': True, 'label': 'Sample 2 Triggered', 'fail': True, 'timeframe': -1,
'threshold': '150ms', 'condition': '<=', 'subject': 'avg-rt'})
crit_cfg4.merge({
'stop': True, 'label': 'Sample 2 Not Triggered', 'fail': True,
'timeframe': -1, 'threshold': '300ms', 'condition': '=', 'subject': 'avg-rt'})
fc1_triggered = DataCriterion(crit_cfg1, pass_fail1)
fc1_not_triggered = DataCriterion(crit_cfg2, pass_fail1)
pass_fail2 = CriteriaProcessor([], None)
fc2_triggered = DataCriterion(crit_cfg3, pass_fail1)
fc2_not_triggered = DataCriterion(crit_cfg4, pass_fail1)
pass_fail1.criteria.append(fc1_triggered)
pass_fail1.criteria.append(fc1_not_triggered)
pass_fail2.criteria.append(fc2_triggered)
pass_fail2.criteria.append(fc2_not_triggered)
fc1_triggered.is_triggered = True
fc2_triggered.is_triggered = True
pass_fail = PassFailStatus()
pass_fail.processors.append(pass_fail1)
pass_fail.processors.append(pass_fail2)
obj.engine.reporters.append(pass_fail)
obj.engine.reporters.append(BlazeMeterUploader())
path_from_config = tempfile.mktemp(suffix='.xml', prefix='junit-xml_passfail', dir=obj.engine.artifacts_dir)
obj.parameters.merge({"filename": path_from_config, "data-source": "pass-fail"})
obj.prepare()
obj.last_second = DataPoint(0)
obj.post_process()
with open(obj.report_file_path, 'rb') as fds:
f_contents = fds.read()
ROOT_LOGGER.info("File: %s", f_contents)
xml_tree = etree.fromstring(f_contents)
self.assertEqual('testsuites', xml_tree.tag)
suite = xml_tree.getchildren()[0]
self.assertEqual('testsuite', suite.tag)
test_cases = suite.getchildren()
self.assertEqual(4, len(test_cases))
self.assertEqual('testcase', test_cases[0].tag)
self.assertEqual('error', test_cases[0].getchildren()[1].tag)
self.assertEqual('error', test_cases[2].getchildren()[1].tag)
sys_out = test_cases[0].getchildren()[0]
self.assertEqual('system-out', sys_out.tag)
self.assertIn('BlazeMeter report link: http://test/report/123', sys_out.text)