本文整理汇总了Python中bzt.modules.reporting.FinalStatus.engine方法的典型用法代码示例。如果您正苦于以下问题:Python FinalStatus.engine方法的具体用法?Python FinalStatus.engine怎么用?Python FinalStatus.engine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bzt.modules.reporting.FinalStatus
的用法示例。
在下文中一共展示了FinalStatus.engine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_log_messages_samples_count
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_samples_count(self):
obj = FinalStatus()
obj.engine = EngineEmul
obj.parameters = BetterDict()
obj.log = logger_mock()
obj.parameters.merge({"failed-labels": False, "percentiles": False, "summary": True, "test-duration": False})
datapoint = DataPoint(None, None)
cumul_data = KPISet.from_dict(
{KPISet.AVG_CONN_TIME: 7.890211417203362e-06,
KPISet.RESP_TIMES: Counter(
{0.0: 32160, 0.001: 24919, 0.002: 1049, 0.003: 630, 0.004: 224, 0.005: 125,
0.006: 73, 0.007: 46, 0.008: 32, 0.009: 20, 0.011: 8, 0.01: 8, 0.017: 3,
0.016: 3, 0.014: 3, 0.013: 3, 0.04: 2, 0.012: 2, 0.079: 1, 0.081: 1,
0.019: 1, 0.015: 1}),
KPISet.ERRORS: [{'msg': 'Forbidden', 'cnt': 7373, 'type': 0,
'urls': Counter({'http://192.168.25.8/': 7373}), KPISet.RESP_CODES: '403'}],
KPISet.STDEV_RESP_TIME: 0.04947974228872108,
KPISet.AVG_LATENCY: 0.0002825639815220692,
KPISet.RESP_CODES: Counter({'304': 29656, '403': 29656, '200': 2}),
KPISet.PERCENTILES: defaultdict(None, {'95.0': 0.001, '0.0': 0.0, '99.9': 0.008, '90.0': 0.001,
'100.0': 0.081, '99.0': 0.003, '50.0': 0.0}),
KPISet.SUCCESSES: 29658,
KPISet.SAMPLE_COUNT: 59314,
KPISet.CONCURRENCY: 0,
KPISet.AVG_RESP_TIME: 0.0005440536804127192,
KPISet.FAILURES: 29656})
datapoint[DataPoint.CUMULATIVE][""] = cumul_data
obj.last_sec = datapoint
obj.post_process()
self.assertEqual("Samples count: 59314, 50.00% failures\n", obj.log.info_buf.getvalue())
示例2: test_log_messages_percentiles
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_percentiles(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict.from_dict({"failed-labels": False, "percentiles": True, "summary": False,
"test-duration": False, "summary-labels": False})
self.sniff_log(obj.log)
obj.startup()
obj.shutdown()
obj.aggregated_second(self.__get_datapoint())
obj.post_process()
target_output = ("Average times: total 0.001, latency 0.000, connect 0.000\n"
"Percentiles:\n"
"+---------------+---------------+\n"
"| Percentile, % | Resp. Time, s |\n"
"+---------------+---------------+\n"
"| 0.0 | 0.0 |\n"
"| 50.0 | 0.0 |\n"
"| 90.0 | 0.001 |\n"
"| 95.0 | 0.001 |\n"
"| 99.0 | 0.003 |\n"
"| 99.9 | 0.008 |\n"
"| 100.0 | 0.081 |\n"
"+---------------+---------------+\n"
)
self.assertEqual(target_output, self.log_recorder.info_buff.getvalue())
示例3: test_log_messages_samples_count
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_samples_count(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict.from_dict({"failed-labels": False, "percentiles": False, "summary": True,
"test-duration": False, "summary-labels": False})
self.sniff_log(obj.log)
obj.aggregated_second(self.__get_datapoint())
obj.startup()
obj.shutdown()
obj.post_process()
self.assertEqual("Samples count: 59314, 50.00% failures\n", self.log_recorder.info_buff.getvalue())
示例4: test_log_messages_failed_labels
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_failed_labels(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
log_recorder = RecordingHandler()
obj.log.addHandler(log_recorder)
obj.parameters.merge({"failed-labels": True, "percentiles": False, "summary": False, "test-duration": False})
obj.aggregated_second(self.__get_datapoint())
obj.post_process()
self.assertIn("29656 failed samples: http://192.168.1.1/anotherquery\n", log_recorder.info_buff.getvalue())
obj.log.removeHandler(log_recorder)
示例5: test_log_messages_samples_count
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_samples_count(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
log_recorder = RecordingHandler()
obj.log.addHandler(log_recorder)
obj.parameters.merge({"failed-labels": False, "percentiles": False, "summary": True, "test-duration": False})
obj.aggregated_second(self.__get_datapoint())
obj.post_process()
self.assertEqual("Samples count: 59314, 50.00% failures\n", log_recorder.info_buff.getvalue())
obj.log.removeHandler(log_recorder)
示例6: test_log_messages_failed_labels
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_failed_labels(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict.from_dict({"failed-labels": True, "percentiles": False, "summary": False,
"test-duration": False})
self.sniff_log(obj.log)
obj.startup()
obj.shutdown()
obj.aggregated_second(self.__get_datapoint())
obj.post_process()
self.assertIn("29656 failed samples: http://192.168.1.1/anotherquery\n", self.log_recorder.info_buff.getvalue())
示例7: test_long_kpi
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_long_kpi(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict.from_dict({"dump-xml": obj.engine.create_artifact("status", ".xml")})
datapoint = random_datapoint(time.time())
datapoint[datapoint.CUMULATIVE][""]["stdev_rt"] = long(0)
obj.aggregated_second(datapoint)
obj.startup()
obj.shutdown()
obj.post_process()
示例8: test_dump
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_dump(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
log_recorder = RecordingHandler()
obj.log.addHandler(log_recorder)
obj.parameters.merge({
"dump-xml": obj.engine.create_artifact("status", ".xml"),
"dump-csv": obj.engine.create_artifact("status", ".csv")
})
obj.aggregated_second(random_datapoint(time.time()))
obj.post_process()
self.assertIn("XML", log_recorder.info_buff.getvalue())
示例9: test_log_messages_duration
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_duration(self):
"""
Test duration report
:return:
"""
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
self.sniff_log(obj.log)
obj.prepare()
obj.startup()
obj.shutdown()
obj.start_time -= 120005
obj.post_process()
self.assertEqual("Test duration: 1 day, 9:20:05\n", self.log_recorder.info_buff.getvalue())
示例10: test_log_messages_duration
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_duration(self):
"""
Test duration report
:return:
"""
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
log_recorder = RecordingHandler()
obj.log.addHandler(log_recorder)
obj.prepare()
obj.start_time -= 120005
obj.post_process()
self.assertEqual("Test duration: 1 day, 9:20:05\n", log_recorder.info_buff.getvalue())
obj.log.removeHandler(log_recorder)
示例11: test_dump
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_dump(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict.from_dict({
"dump-xml": obj.engine.create_artifact("status", ".xml"),
"dump-csv": obj.engine.create_artifact("status", ".csv")
})
self.sniff_log(obj.log)
obj.aggregated_second(random_datapoint(time.time()))
obj.startup()
obj.shutdown()
obj.post_process()
self.assertIn("XML", self.log_recorder.info_buff.getvalue())
示例12: test_func_report_all_no_stacktrace
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_func_report_all_no_stacktrace(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict.from_dict({"report-tests": "all", "print-stacktrace": False})
self.sniff_log(obj.log)
obj.prepare()
obj.startup()
obj.shutdown()
obj.aggregated_results(*self.__get_func_tree())
obj.post_process()
info_log = self.log_recorder.info_buff.getvalue()
self.assertIn("Total: 3 tests", info_log)
self.assertIn("Test TestClass.case1 - PASSED", info_log)
self.assertIn("Test TestClass.case2 - FAILED", info_log)
self.assertIn("Test TestClass.case3 - BROKEN", info_log)
self.assertNotIn("stacktrace2", info_log)
self.assertNotIn("stacktrace3", info_log)
示例13: test_func_report
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_func_report(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
self.sniff_log(obj.log)
obj.prepare()
obj.startup()
obj.shutdown()
obj.aggregated_results(*self.__get_func_tree())
obj.post_process()
info_log = self.log_recorder.info_buff.getvalue()
warn_log = self.log_recorder.warn_buff.getvalue()
self.assertIn("Total: 3 tests", info_log)
self.assertIn("Test TestClass.case2 failed: something broke", warn_log)
self.assertIn("stacktrace2", warn_log)
self.assertIn("Test TestClass.case3 failed: something is badly broken", warn_log)
self.assertIn("stacktrace3", warn_log)
示例14: test_log_messages_duration
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_log_messages_duration(self):
"""
Test duration report
:return:
"""
executor_obj = JMeterExecutor()
executor_obj.engine = EngineEmul()
executor_obj.engine.provisioning = Provisioning()
executor_obj.engine.provisioning.executors.append(executor_obj)
executor_obj.start_time = time.time()
executor_obj.end_time = executor_obj.start_time + 120005
obj = FinalStatus()
obj.parameters = BetterDict()
obj.engine = executor_obj.engine
obj.log = logger_mock()
obj.post_process()
self.assertEqual("Test duration: 1 day, 9:20:05\n", obj.log.info_buf.getvalue())
示例15: test_xml_report_test_duration
# 需要导入模块: from bzt.modules.reporting import FinalStatus [as 别名]
# 或者: from bzt.modules.reporting.FinalStatus import engine [as 别名]
def test_xml_report_test_duration(self):
obj = FinalStatus()
obj.engine = EngineEmul()
xml_report = obj.engine.create_artifact("status", ".xml")
obj.parameters = BetterDict.from_dict({
"dump-xml": xml_report,
})
obj.startup()
obj.aggregated_second(self.__get_datapoint(ts=90))
obj.aggregated_second(self.__get_datapoint(ts=100))
obj.shutdown()
obj.post_process()
self.assertTrue(os.path.exists(xml_report))
with open(xml_report) as fds:
report_content = fds.read()
self.assertIn('<TestDuration>10.0</TestDuration>', report_content)