當前位置: 首頁>>代碼示例>>Python>>正文


Python PassFailStatus.check方法代碼示例

本文整理匯總了Python中bzt.modules.passfail.PassFailStatus.check方法的典型用法代碼示例。如果您正苦於以下問題:Python PassFailStatus.check方法的具體用法?Python PassFailStatus.check怎麽用?Python PassFailStatus.check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bzt.modules.passfail.PassFailStatus的用法示例。


在下文中一共展示了PassFailStatus.check方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_within

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_within(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": [
            "fail>10% within 5s",
            "fail>1000 within 5s",
            "avg-rt>100ms within 10s",
        ]}
        obj.prepare()

        start_time = time.time()
        for _n in range(0, 20):
            point = random_datapoint(start_time)
            obj.aggregated_second(point)
            if _n % 2 == 0:
                try:
                    obj.check()
                except KeyboardInterrupt:
                    pass

            try:
                obj.check()
            except KeyboardInterrupt:
                pass
            start_time += 1
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:27,代碼來源:test_passFailStatus.py

示例2: test_stop_counting_criteria

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_stop_counting_criteria(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": ["avg-rt>10ms for 2s, continue as failed"]}
        obj.prepare()
        obj.get_widget()
        start_time = time.time()

        for _n in range(0, 10):
            point = random_datapoint(start_time)
            point[DataPoint.CURRENT]['']["avg_rt"] = 1.0
            obj.aggregated_second(point)
            obj.check()
            start_time += 1

        self.assertEqual(obj.widget.text_widget.text, "Failed: avg-rt>10ms for 10 sec\n")

        for _n in range(0, 10):
            point = random_datapoint(start_time)
            point[DataPoint.CURRENT]['']["avg_rt"] = 0.01
            obj.aggregated_second(point)
            obj.check()
            start_time += 1

        self.assertEqual(obj.widget.text_widget.text, "")
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:27,代碼來源:test_passFailStatus.py

示例3: test_prepare2

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_prepare2(self):
        obj = PassFailStatus()
        obj.parameters = {"criterias": ["avg-rt>10ms, continue as non-failed"]}
        obj.prepare()
        self.assertGreater(len(obj.criterias), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            obj.aggregated_second(point)
            obj.check()

        obj.post_process()
開發者ID:Yingmin-Li,項目名稱:taurus,代碼行數:14,代碼來源:test_passFailStatus.py

示例4: test_within

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_within(self):
        obj = PassFailStatus()
        obj.parameters = {"criterias": [
            "fail>10% within 5s",
            "fail>1000 within 5s",
            "avg-rt>100ms within 10s",
        ]}
        obj.prepare()

        start_time = time.time()
        for _n in range(0, 20):
            point = random_datapoint(start_time)
            obj.aggregated_second(point)
            if _n % 2 == 0:
                obj.check()
            obj.check()
            start_time += 1
開發者ID:Yingmin-Li,項目名稱:taurus,代碼行數:19,代碼來源:test_passFailStatus.py

示例5: test_prepare3

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_prepare3(self):
        obj = PassFailStatus()
        obj.parameters = {"criterias": ["avg-rt>10ms for 3s, continue as failed"]}
        obj.prepare()
        self.assertGreater(len(obj.criterias), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            point[DataPoint.CURRENT][''][KPISet.AVG_RESP_TIME] = 1
            obj.aggregated_second(point)
            obj.check()

        try:
            obj.post_process()
            self.fail()
        except AutomatedShutdown:
            pass
開發者ID:Yingmin-Li,項目名稱:taurus,代碼行數:19,代碼來源:test_passFailStatus.py

示例6: test_ashort_data

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_ashort_data(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()

        crit_cfg = DataCriterion.string_to_config("failures>0%, stop as failed")
        obj.criteria.append(DataCriterion(crit_cfg, obj))

        point = DataPoint(0)
        point[DataPoint.CUMULATIVE] = {}
        point[DataPoint.CUMULATIVE][''] = {}
        point[DataPoint.CUMULATIVE][''][KPISet.FAILURES] = 100 * 16
        point[DataPoint.CUMULATIVE][''][KPISet.SAMPLE_COUNT] = 100 * 16

        obj.check()
        obj.shutdown()
        obj.aggregated_second(point)
        self.assertRaises(AutomatedShutdown, obj.post_process)
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:19,代碼來源:test_passFailStatus.py

示例7: test_percentiles_track

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_percentiles_track(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": ["p90>0ms"]}
        obj.prepare()
        self.assertGreater(len(obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            obj.aggregated_second(point)
            obj.check()

        obj.shutdown()
        try:
            obj.post_process()
            self.fail()
        except AutomatedShutdown:
            pass
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:20,代碼來源:test_passFailStatus.py

示例8: test_cumulative_criteria_post_process

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_cumulative_criteria_post_process(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": [
            "p90>0ms, continue as failed",
            "avg-rt>0ms, continue as failed",
        ]}
        obj.prepare()
        self.assertEquals(len(obj.criteria), 2)

        for n in range(0, 10):
            point = random_datapoint(n)
            obj.aggregated_second(point)
            obj.check()

        obj.shutdown()
        self.assertRaises(AutomatedShutdown, obj.post_process)
        for crit in obj.criteria:
            self.assertTrue(crit.is_triggered)
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:21,代碼來源:test_passFailStatus.py

示例9: test_prepare

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_prepare(self):
        obj = PassFailStatus()
        config = json.loads(open(__dir__() + "/../json/passfail.json").read())
        obj.parameters = config['reporting'][0]
        obj.prepare()
        self.assertGreater(len(obj.criterias), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            logging.info("%s: %s", n, point)
            obj.aggregated_second(point)
            try:
                obj.check()
            except AutomatedShutdown:
                pass

        try:
            obj.post_process()
        except AutomatedShutdown:
            pass
開發者ID:Yingmin-Li,項目名稱:taurus,代碼行數:22,代碼來源:test_passFailStatus.py

示例10: test_prepare_label_issue

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
    def test_prepare_label_issue(self):
        # https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/codename-taurus/PWjU7xVucZ0/WkjUAbE1EwAJ
        obj = PassFailStatus()
        obj.parameters = {"criterias": ["avg-rt of spaced label>10ms"]}
        obj.prepare()
        self.assertGreater(len(obj.criterias), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            point[DataPoint.CUMULATIVE]['spaced label'] = point[DataPoint.CUMULATIVE]['']
            point[DataPoint.CURRENT]['spaced label'] = point[DataPoint.CURRENT]['']
            obj.aggregated_second(point)
            obj.check()

        obj.shutdown()

        try:
            obj.post_process()
            self.fail()
        except AutomatedShutdown:
            pass
開發者ID:kobi1023,項目名稱:taurus,代碼行數:23,代碼來源:test_passFailStatus.py

示例11: TestPassFailStatus

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import check [as 別名]
class TestPassFailStatus(BZTestCase):
    def setUp(self):
        super(TestPassFailStatus, self).setUp()
        self.obj = PassFailStatus()
        self.obj.engine = EngineEmul()

    def configure(self, params):
        self.obj.parameters.merge(params)

    def test_prepare(self):
        config = json.loads(open(RESOURCES_DIR + "json/passfail.json").read())
        self.configure(config['reporting'][0])
        self.obj.prepare()
        self.assertGreater(len(self.obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            logging.info("%s: %s", n, point)
            self.obj.aggregated_second(point)
            try:
                self.obj.check()
            except AutomatedShutdown:
                pass

        try:
            self.obj.post_process()
        except AutomatedShutdown:
            pass

    def test_prepare2(self):
        self.configure({"criteria": ["avg-rt>10ms, continue as non-failed"]})
        self.obj.prepare()
        self.assertGreater(len(self.obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            self.obj.aggregated_second(point)
            self.obj.check()

        self.obj.post_process()

    def test_prepare3(self):
        self.configure({"criteria": ["avg-rt>10ms for 3s, continue as failed"]})
        self.obj.prepare()
        self.assertGreater(len(self.obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            point[DataPoint.CURRENT][''][KPISet.AVG_RESP_TIME] = 1
            self.obj.aggregated_second(point)
            self.obj.check()

        self.assertRaises(AutomatedShutdown, self.obj.post_process)

    def test_widget(self):
        self.configure({"criteria": ["avg-rt>10ms for 2s, continue as failed"]})
        self.obj.prepare()
        self.obj.get_widget()
        start_time = time.time()

        for _n in range(0, 10):
            point = random_datapoint(start_time + _n)
            point[DataPoint.CURRENT]['']["avg_rt"] = 1.0
            self.obj.aggregated_second(point)
            self.obj.check()

        self.assertEqual(self.obj.widget.text_widget.text, "Failed: avg-rt>10ms for 10 sec\n")

    def test_within(self):
        self.configure({
            "criteria": [
                "fail>10% within 5s",
                "fail>1000 within 5s",
                "avg-rt>100ms within 10s",
            ]})
        self.obj.prepare()

        start_time = time.time()
        for _n in range(0, 20):
            point = random_datapoint(start_time)
            self.obj.aggregated_second(point)
            if _n % 2 == 0:
                try:
                    self.obj.check()
                except KeyboardInterrupt:
                    pass

            try:
                self.obj.check()
            except KeyboardInterrupt:
                pass
            start_time += 1

    def test_prepare_label_issue(self):
        # https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/codename-taurus/PWjU7xVucZ0/WkjUAbE1EwAJ
        self.configure({"criteria": ["avg-rt of spaced label>10ms"]})
        self.obj.prepare()
        self.assertGreater(len(self.obj.criteria), 0)

        for n in range(0, 10):
#.........這裏部分代碼省略.........
開發者ID:keithmork,項目名稱:taurus,代碼行數:103,代碼來源:test_passFailStatus.py


注:本文中的bzt.modules.passfail.PassFailStatus.check方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。