当前位置: 首页>>代码示例>>Python>>正文


Python summary.SummaryReporter类代码示例

本文整理汇总了Python中behave.reporter.summary.SummaryReporter的典型用法代码示例。如果您正苦于以下问题:Python SummaryReporter类的具体用法?Python SummaryReporter怎么用?Python SummaryReporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SummaryReporter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_feature_status_is_collected_and_reported

    def test_feature_status_is_collected_and_reported(self, format_summary,
                                                      stdout):
        # pylint: disable=W0621
        #   W0621   Redefining name ... from outer scope (format_summary)
        features = [Mock(), Mock(), Mock(), Mock(), Mock()]
        features[0].duration = 1.9
        features[0].status = 'passed'
        features[0].__iter__ = Mock(return_value=iter([]))
        features[1].duration = 2.7
        features[1].status = 'failed'
        features[1].__iter__ = Mock(return_value=iter([]))
        features[2].duration = 3.5
        features[2].status = 'skipped'
        features[2].__iter__ = Mock(return_value=iter([]))
        features[3].duration = 4.3
        features[3].status = 'passed'
        features[3].__iter__ = Mock(return_value=iter([]))
        features[4].duration = 5.1
        features[4].status = None
        features[4].__iter__ = Mock(return_value=iter([]))

        config = Mock()
        reporter = SummaryReporter(config)

        [reporter.feature(f) for f in features]
        reporter.end()

        expected = {
            'passed': 2,
            'failed': 1,
            'skipped': 2,
            'untested': 0,
        }

        eq_(format_summary.call_args_list[0][0], ('feature', expected))
开发者ID:biznixcn,项目名称:behave,代码行数:35,代码来源:test_summary.py

示例2: test_feature_status_is_collected_and_reported

    def test_feature_status_is_collected_and_reported(self, format_summary,
                                                      stdout):
        features = [Mock(), Mock(), Mock(), Mock(), Mock()]
        features[0].duration = 1.9
        features[0].status = Status.passed
        features[0].__iter__ = Mock(return_value=iter([]))
        features[1].duration = 2.7
        features[1].status = Status.failed
        features[1].__iter__ = Mock(return_value=iter([]))
        features[2].duration = 3.5
        features[2].status = Status.skipped
        features[2].__iter__ = Mock(return_value=iter([]))
        features[3].duration = 4.3
        features[3].status = Status.passed
        features[3].__iter__ = Mock(return_value=iter([]))
        features[4].duration = 5.1
        features[4].status = Status.untested
        features[4].__iter__ = Mock(return_value=iter([]))

        config = Mock()
        reporter = SummaryReporter(config)

        [reporter.feature(f) for f in features]
        reporter.end()

        expected = {
            Status.passed.name: 2,
            Status.failed.name: 1,
            Status.skipped.name: 1,
            Status.untested.name: 1,
        }

        eq_(format_summary.call_args_list[0][0], ('feature', expected))
开发者ID:Abdoctor,项目名称:behave,代码行数:33,代码来源:test_summary.py

示例3: test_duration_is_totalled_up_and_outputted

    def test_duration_is_totalled_up_and_outputted(self, stdout):
        features = [Mock(), Mock(), Mock(), Mock()]
        features[0].duration = 1.9
        features[0].status = 'passed'
        features[0].__iter__ = Mock(return_value=iter([]))
        features[1].duration = 2.7
        features[1].status = 'passed'
        features[1].__iter__ = Mock(return_value=iter([]))
        features[2].duration = 3.5
        features[2].status = 'passed'
        features[2].__iter__ = Mock(return_value=iter([]))
        features[3].duration = 4.3
        features[3].status = 'passed'
        features[3].__iter__ = Mock(return_value=iter([]))

        config = Mock()
        reporter = SummaryReporter(config)

        [reporter.feature(f) for f in features]
        eq_(round(reporter.duration, 3), 12.400)

        reporter.end()
        output = stdout.write.call_args_list[-1][0][0]
        minutes = int(reporter.duration / 60)
        seconds = reporter.duration % 60

        assert '%dm' % (minutes,) in output
        assert '%02.1f' % (seconds,) in output
开发者ID:biznixcn,项目名称:behave,代码行数:28,代码来源:test_summary.py

示例4: test_scenario_status_is_collected_and_reported

    def test_scenario_status_is_collected_and_reported(self, format_summary,
                                                       stdout):
        feature = Mock()
        scenarios = [Mock(), Mock(), Mock(), Mock(), Mock()]
        scenarios[0].status = 'failed'
        scenarios[0].__iter__ = Mock(return_value=iter([]))
        scenarios[1].status = 'failed'
        scenarios[1].__iter__ = Mock(return_value=iter([]))
        scenarios[2].status = 'skipped'
        scenarios[2].__iter__ = Mock(return_value=iter([]))
        scenarios[3].status = 'passed'
        scenarios[3].__iter__ = Mock(return_value=iter([]))
        scenarios[4].status = None
        scenarios[4].__iter__ = Mock(return_value=iter([]))
        feature.status = 'failed'
        feature.duration = 12.3
        feature.__iter__ = Mock(return_value=iter(scenarios))

        config = Mock()
        reporter = SummaryReporter(config)

        reporter.feature(feature)
        reporter.end()

        expected = {
            'passed': 1,
            'failed': 2,
            'skipped': 2,
            'untested': 0,
        }

        eq_(format_summary.call_args_list[1][0], ('scenario', expected))
开发者ID:biznixcn,项目名称:behave,代码行数:32,代码来源:test_summary.py

示例5: test_scenario_status_is_collected_and_reported

    def test_scenario_status_is_collected_and_reported(self, format_summary,
                                                       stdout):
        feature = Mock()
        scenarios = [Mock(), Mock(), Mock(), Mock(), Mock()]
        scenarios[0].status = Status.failed
        scenarios[0].__iter__ = Mock(return_value=iter([]))
        scenarios[1].status = Status.failed
        scenarios[1].__iter__ = Mock(return_value=iter([]))
        scenarios[2].status = Status.skipped
        scenarios[2].__iter__ = Mock(return_value=iter([]))
        scenarios[3].status = Status.passed
        scenarios[3].__iter__ = Mock(return_value=iter([]))
        scenarios[4].status = Status.untested
        scenarios[4].__iter__ = Mock(return_value=iter([]))
        feature.status = Status.failed
        feature.duration = 12.3
        feature.__iter__ = Mock(return_value=iter(scenarios))

        config = Mock()
        sys.stdout.encoding = "UTF-8"
        reporter = SummaryReporter(config)

        reporter.feature(feature)
        reporter.end()

        expected = {
            Status.passed.name: 1,
            Status.failed.name: 2,
            Status.skipped.name: 1,
            Status.untested.name: 1,
        }

        eq_(format_summary.call_args_list[1][0], ('scenario', expected))
开发者ID:bittner,项目名称:behave,代码行数:33,代码来源:test_summary.py

示例6: test_scenario_outline_status_is_collected_and_reported

    def test_scenario_outline_status_is_collected_and_reported(self, stdout,
                                                               format_summary):
        feature = Mock()
        scenarios = [ ScenarioOutline(u"<string>", 0, u"scenario_outline", u"name"),
                      Mock(), Mock(), Mock() ]
        subscenarios = [ Mock(), Mock(), Mock(), Mock() ]
        subscenarios[0].status = Status.passed
        subscenarios[0].__iter__ = Mock(return_value=iter([]))
        subscenarios[1].status = Status.failed
        subscenarios[1].__iter__ = Mock(return_value=iter([]))
        subscenarios[2].status = Status.failed
        subscenarios[2].__iter__ = Mock(return_value=iter([]))
        subscenarios[3].status = Status.skipped
        subscenarios[3].__iter__ = Mock(return_value=iter([]))
        scenarios[0]._scenarios = subscenarios
        scenarios[1].status = Status.failed
        scenarios[1].__iter__ = Mock(return_value=iter([]))
        scenarios[2].status = Status.skipped
        scenarios[2].__iter__ = Mock(return_value=iter([]))
        scenarios[3].status = Status.passed
        scenarios[3].__iter__ = Mock(return_value=iter([]))
        feature.status = Status.failed
        feature.duration = 12.4
        feature.__iter__ = Mock(return_value=iter(scenarios))

        config = Mock()
        sys.stdout.encoding = "UTF-8"
        reporter = SummaryReporter(config)

        reporter.feature(feature)
        reporter.end()

        expected = {
            "all": 7,
            Status.passed.name: 2,
            Status.failed.name: 3,
            Status.skipped.name: 2,
            Status.untested.name: 0,
        }
        scenario_index = 1  # -- HINT: Index for scenarios if no Rules are used.
        expected_parts = ("scenario", expected)
        assert format_summary.call_args_list[scenario_index][0] == expected_parts
开发者ID:behave,项目名称:behave,代码行数:42,代码来源:test_summary.py

示例7: test_scenario_outline_status_is_collected_and_reported

    def test_scenario_outline_status_is_collected_and_reported(self, stdout,
                                                               format_summary):
        # FIX: issue40
        # ENSURE: ScenarioOutline's scenarios are walked and collected.
        feature = Mock()
        scenarios = [ ScenarioOutline(u"<string>", 0, u"scenario_outline", u"name"),
                      Mock(), Mock(), Mock() ]
        subscenarios = [ Mock(), Mock(), Mock(), Mock() ]
        subscenarios[0].status = 'passed'
        subscenarios[0].__iter__ = Mock(return_value=iter([]))
        subscenarios[1].status = 'failed'
        subscenarios[1].__iter__ = Mock(return_value=iter([]))
        subscenarios[2].status = 'failed'
        subscenarios[2].__iter__ = Mock(return_value=iter([]))
        subscenarios[3].status = 'skipped'
        subscenarios[3].__iter__ = Mock(return_value=iter([]))
        scenarios[0]._scenarios = subscenarios
        scenarios[1].status = 'failed'
        scenarios[1].__iter__ = Mock(return_value=iter([]))
        scenarios[2].status = 'skipped'
        scenarios[2].__iter__ = Mock(return_value=iter([]))
        scenarios[3].status = 'passed'
        scenarios[3].__iter__ = Mock(return_value=iter([]))
        feature.status = 'failed'
        feature.duration = 12.4
        feature.__iter__ = Mock(return_value=iter(scenarios))

        config = Mock()
        reporter = SummaryReporter(config)

        reporter.feature(feature)
        reporter.end()

        expected = {
            'passed': 2,
            'failed': 3,
            'skipped': 2,
            'untested': 0,
            }

        eq_(format_summary.call_args_list[1][0], ('scenario', expected))
开发者ID:biznixcn,项目名称:behave,代码行数:41,代码来源:test_summary.py

示例8: test_step_status_is_collected_and_reported

    def test_step_status_is_collected_and_reported(self, format_summary,
                                                   stdout):
        feature = Mock()
        scenario = Mock()
        steps = [Mock(), Mock(), Mock(), Mock(), Mock()]
        steps[0].status = Status.failed
        steps[0].__iter__ = Mock(return_value=iter([]))
        steps[1].status = Status.passed
        steps[1].__iter__ = Mock(return_value=iter([]))
        steps[2].status = Status.passed
        steps[2].__iter__ = Mock(return_value=iter([]))
        steps[3].status = Status.skipped
        steps[4].__iter__ = Mock(return_value=iter([]))
        steps[4].status = Status.undefined
        steps[4].__iter__ = Mock(return_value=iter([]))
        feature.status = Status.failed
        feature.duration = 12.3
        feature.__iter__ = Mock(return_value=iter([scenario]))
        scenario.status = Status.failed
        scenario.__iter__ = Mock(return_value=iter(steps))

        config = Mock()
        sys.stdout.encoding = "UTF-8"
        reporter = SummaryReporter(config)

        reporter.feature(feature)
        reporter.end()

        expected = {
            "all": 5,
            Status.passed.name: 2,
            Status.failed.name: 1,
            Status.skipped.name: 1,
            Status.untested.name: 0,
            Status.undefined.name: 1,
        }

        step_index = 2  # HINT: Index for steps if not rules are used.
        expected_parts = ("step", expected)
        assert format_summary.call_args_list[step_index][0] == expected_parts
开发者ID:behave,项目名称:behave,代码行数:40,代码来源:test_summary.py

示例9: test_scenario_outline_status_is_collected_and_reported

    def test_scenario_outline_status_is_collected_and_reported(self, stdout,
                                                               format_summary):
        feature = Mock()
        scenarios = [ ScenarioOutline(u"<string>", 0, u"scenario_outline", u"name"),
                      Mock(), Mock(), Mock() ]
        subscenarios = [ Mock(), Mock(), Mock(), Mock() ]
        subscenarios[0].status = Status.passed
        subscenarios[0].__iter__ = Mock(return_value=iter([]))
        subscenarios[1].status = Status.failed
        subscenarios[1].__iter__ = Mock(return_value=iter([]))
        subscenarios[2].status = Status.failed
        subscenarios[2].__iter__ = Mock(return_value=iter([]))
        subscenarios[3].status = Status.skipped
        subscenarios[3].__iter__ = Mock(return_value=iter([]))
        scenarios[0]._scenarios = subscenarios
        scenarios[1].status = Status.failed
        scenarios[1].__iter__ = Mock(return_value=iter([]))
        scenarios[2].status = Status.skipped
        scenarios[2].__iter__ = Mock(return_value=iter([]))
        scenarios[3].status = Status.passed
        scenarios[3].__iter__ = Mock(return_value=iter([]))
        feature.status = Status.failed
        feature.duration = 12.4
        feature.__iter__ = Mock(return_value=iter(scenarios))

        config = Mock()
        sys.stdout.encoding = "UTF-8"
        reporter = SummaryReporter(config)

        reporter.feature(feature)
        reporter.end()

        expected = {
            Status.passed.name: 2,
            Status.failed.name: 3,
            Status.skipped.name: 2,
            Status.untested.name: 0,
            }

        eq_(format_summary.call_args_list[1][0], ('scenario', expected))
开发者ID:bittner,项目名称:behave,代码行数:40,代码来源:test_summary.py

示例10: test_step_status_is_collected_and_reported

    def test_step_status_is_collected_and_reported(self, format_summary,
                                                   stderr):
        # pylint: disable=W0621
        #   W0621   Redefining name ... from outer scope (format_summary)
        feature = Mock()
        scenario = Mock()
        steps = [Mock(), Mock(), Mock(), Mock(), Mock()]
        steps[0].status = 'failed'
        steps[0].__iter__ = Mock(return_value=iter([]))
        steps[1].status = 'undefined'
        steps[1].__iter__ = Mock(return_value=iter([]))
        steps[2].status = 'passed'
        steps[2].__iter__ = Mock(return_value=iter([]))
        steps[3].status = 'passed'
        steps[3].__iter__ = Mock(return_value=iter([]))
        steps[4].status = None
        steps[4].__iter__ = Mock(return_value=iter([]))
        feature.status = 'failed'
        feature.duration = 12.3
        feature.__iter__ = Mock(return_value=iter([scenario]))
        scenario.status = 'failed'
        scenario.__iter__ = Mock(return_value=iter(steps))

        config = Mock()
        reporter = SummaryReporter(config)

        reporter.feature(feature)
        reporter.end()

        expected = {
            'passed': 2,
            'failed': 1,
            'skipped': 1,
            'untested': 0,
            'undefined': 1,
        }

        eq_(format_summary.call_args_list[2][0], ('step', expected))
开发者ID:hangtwenty,项目名称:behave,代码行数:38,代码来源:test_summary.py


注:本文中的behave.reporter.summary.SummaryReporter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。