Best Python code snippet using slash
statistics.py
Source:statistics.py
1# Copyright 2008-2015 Nokia Networks2# Copyright 2016- Robot Framework Foundation3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15from .totalstatistics import TotalStatisticsBuilder16from .suitestatistics import SuiteStatisticsBuilder17from .tagstatistics import TagStatisticsBuilder18from .visitor import SuiteVisitor19class Statistics(object):20 """Container for total, suite and tag statistics.21 Accepted parameters have the same semantics as the matching command line22 options.23 """24 def __init__(self, suite, suite_stat_level=-1, tag_stat_include=None,25 tag_stat_exclude=None, tag_stat_combine=None, tag_doc=None,26 tag_stat_link=None):27 total_builder = TotalStatisticsBuilder()28 suite_builder = SuiteStatisticsBuilder(suite_stat_level)29 tag_builder = TagStatisticsBuilder(suite.criticality, tag_stat_include,30 tag_stat_exclude, tag_stat_combine,31 tag_doc, tag_stat_link)32 suite.visit(StatisticsBuilder(total_builder, suite_builder, tag_builder))33 #: Instance of :class:`~robot.model.totalstatistics.TotalStatistics`.34 self.total = total_builder.stats35 #: Instance of :class:`~robot.model.suitestatistics.SuiteStatistics`.36 self.suite = suite_builder.stats37 #: Instance of :class:`~robot.model.tagstatistics.TagStatistics`.38 self.tags = tag_builder.stats39 def visit(self, visitor):40 visitor.visit_statistics(self)41class StatisticsBuilder(SuiteVisitor):42 def __init__(self, total_builder, suite_builder, tag_builder):43 self._total_builder = total_builder44 self._suite_builder = suite_builder45 self._tag_builder = tag_builder46 def start_suite(self, suite):47 self._suite_builder.start_suite(suite)48 def end_suite(self, suite):49 self._suite_builder.end_suite()50 def visit_test(self, test):51 self._total_builder.add_test(test)52 self._suite_builder.add_test(test)53 self._tag_builder.add_test(test)54 def visit_keyword(self, kw):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!