本文整理匯總了Python中robot.model.tagstatistics.TagStatisticsBuilder.add_test方法的典型用法代碼示例。如果您正苦於以下問題:Python TagStatisticsBuilder.add_test方法的具體用法?Python TagStatisticsBuilder.add_test怎麽用?Python TagStatisticsBuilder.add_test使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類robot.model.tagstatistics.TagStatisticsBuilder
的用法示例。
在下文中一共展示了TagStatisticsBuilder.add_test方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_exclude
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_exclude(self):
for excl, tags in self._incl_excl_data:
builder = TagStatisticsBuilder(excluded=excl)
builder.add_test(TestCase(status='PASS', tags=tags))
matcher = MultiMatcher(excl)
expected = [tag for tag in tags if not matcher.match(tag)]
assert_equal([s.name for s in builder.stats], sorted(expected))
示例2: test_tags_equal_to_critical_or_non_critical_pattern_are_not_removed
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_tags_equal_to_critical_or_non_critical_pattern_are_not_removed(self):
builder = TagStatisticsBuilder(Criticality('sORry'))
builder.add_test(TestCase(tags=['sorry']))
builder.add_test(TestCase(tags=['s OR ry']))
assert_equal([(s.name, s.info, s.total) for s in builder.stats],
[('s OR ry', 'critical', 0),
('sorry', '', 2)])
示例3: test_pattern
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_pattern(self):
builder = TagStatisticsBuilder(docs=[('t?', '*doc*')])
builder.add_test(TestCase(tags=['t1', 'T2']))
builder.add_test(TestCase(tags=['_t__1_', 'T 3']))
self._verify_stats(builder.stats.tags['t1'], '*doc*', 2)
self._verify_stats(builder.stats.tags['t2'], '*doc*', 1)
self._verify_stats(builder.stats.tags['t3'], '*doc*', 1)
示例4: test_combine
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_combine(self):
# This is more like an acceptance test than a unit test ...
for comb_tags, tests_tags, crit_tags in [
(['t1&t2'], [['t1','t2','t3'],['t1','t3']], []),
(['1&2&3'], [['1','2','3'],['1','2','3','4']], ['1','2']),
(['1&2','1&3'], [['1','2','3'],['1','3'],['1']], ['1']),
(['t*'], [['t1','x','y'],['tee','z'],['t']], ['x']),
(['t?&s'], [['t1','s'],['tt','s','u'],['tee','s'],['s']], []),
(['t*&s','*'], [['s','t','u'],['tee','s'],[],['x']], []),
(['tNOTs'], [['t','u'],['t','s']], []),
(['tNOTs','t&s','tNOTsNOTu', 't&sNOTu'],
[['t','u'],['t','s'],['s','t','u'],['t'],['t','v']], ['t']),
(['nonex'], [['t1'],['t1,t2'],[]], [])
]:
# 1) Create tag stats
builder = TagStatisticsBuilder(Criticality(crit_tags),
combined=[(t, '') for t in comb_tags])
all_tags = []
for tags in tests_tags:
builder.add_test(TestCase(status='PASS', tags=tags),)
all_tags.extend(tags)
# 2) Actual values
names = [stat.name for stat in builder.stats]
# 3) Expected values
exp_crit = []; exp_noncr = []
for tag in Tags(all_tags):
if tag in crit_tags:
exp_crit.append(tag)
else:
exp_noncr.append(tag)
exp_names = exp_crit + sorted(comb_tags) + exp_noncr
# 4) Verify names (match counts were already verified)
assert_equal(names, exp_names)
示例5: test_combine_with_same_name_as_existing_tag
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_combine_with_same_name_as_existing_tag(self):
builder = TagStatisticsBuilder(combined=[('x*', 'name')])
builder.add_test(TestCase(tags=['name', 'another']))
assert_equal([(s.name, s.combined) for s in builder.stats],
[('name', 'x*'),
('another', None),
('name', None)])
示例6: test_include
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_include(self):
for incl, tags in self._incl_excl_data:
builder = TagStatisticsBuilder(Criticality(), incl, [])
builder.add_test(TestCase(status='PASS', tags=tags))
matcher = MultiMatcher(incl, match_if_no_patterns=True)
expected = [tag for tag in tags if matcher.match(tag)]
assert_equal([s.name for s in builder.stats], sorted(expected))
示例7: test_exclude
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_exclude(self):
for excl, tags in self._incl_excl_data:
builder = TagStatisticsBuilder(Criticality(), [], excl)
builder.add_test(TestCase(status='PASS', tags=tags))
expected = [tag for tag in tags
if not any(utils.matches(tag, e) for e in excl)]
assert_equals([s.name for s in builder.stats], sorted(expected))
示例8: test_sorting
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_sorting(self):
builder = TagStatisticsBuilder(Criticality(['c2', 'c1'], ['n*']),
combined=[('c*', ''), ('xxx', 'a title')])
builder.add_test(TestCase(tags=['c1', 'c2', 't1']))
builder.add_test(TestCase(tags=['c1', 'n2', 't2']))
builder.add_test(TestCase(tags=['n1', 'n2', 't1', 't3']))
assert_equal([(s.name, s.info, s.total) for s in builder.stats],
[('c1', 'critical', 2), ('c2', 'critical', 1),
('n1', 'non-critical', 1), ('n2', 'non-critical', 2),
('a title', 'combined', 0), ('c*', 'combined', 2),
('t1', '', 2), ('t2', '', 1), ('t3', '', 1)])
示例9: test_include_and_exclude
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_include_and_exclude(self):
for incl, excl, tags, exp in [
([], [], ['t0','t1','t2'], ['t0','t1','t2']),
(['t1'], ['t2'], ['t0','t1','t2'], ['t1']),
(['t?'], ['t2'], ['t0','t1','t2','x'], ['t0','t1']),
(['t?'], ['*2'], ['t0','t1','t2','x2'], ['t0','t1']),
(['t1','t2'], ['t2'], ['t0','t1','t2'], ['t1']),
(['t1','t2','t3','not'], ['t2','t0'],
['t0','t1','t2','t3','x'], ['t1','t3'] )
]:
builder = TagStatisticsBuilder(included=incl, excluded=excl)
builder.add_test(TestCase(status='PASS', tags=tags))
assert_equal([s.name for s in builder.stats], exp),
示例10: test_critical_and_combined
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_critical_and_combined(self):
builder = TagStatisticsBuilder(Criticality('crit', 'nonc'),
combined=[('non*',)],
docs=[('crit', 'critical doc'),
('non?', 'not so critical doc')])
crit, nonc, comb = builder.stats
self._verify_stats(crit, 'critical doc', 0, critical=True)
self._verify_stats(nonc, 'not so critical doc', 0, non_critical=True)
self._verify_stats(comb, 'not so critical doc', 0, combined='non*')
builder.add_test(TestCase(tags=['xxx', 'crit']))
builder.add_test(TestCase(tags=['Crit', 'NoNo', 'NoNc']))
crit, nonc, comb, nono, xxx = builder.stats
self._verify_stats(crit, 'critical doc', 2, critical=True)
self._verify_stats(nonc, 'not so critical doc', 1, non_critical=True)
self._verify_stats(comb, 'not so critical doc', 1, combined='non*')
self._verify_stats(nono, 'not so critical doc', 1)
self._verify_stats(xxx, '', 1)
示例11: test_iter
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_iter(self):
builder = TagStatisticsBuilder()
assert_equal(list(builder.stats), [])
builder.add_test(TestCase())
assert_equal(list(builder.stats), [])
builder.add_test(TestCase(tags=['a']))
assert_equal(len(list(builder.stats)), 1)
builder.add_test(TestCase(tags=['A', 'B']))
assert_equal(len(list(builder.stats)), 2)
示例12: test_tags_equal_to_critical_or_non_critical_are_removed_in_iter
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_tags_equal_to_critical_or_non_critical_are_removed_in_iter(self):
builder = TagStatisticsBuilder(Criticality('smoke', 'not-ready'),
combined=[('xxx',)])
builder.add_test(TestCase(tags=['smoke']))
builder.add_test(TestCase(tags=['SMOKE', 'not-ready', 'xxx']))
builder.add_test(TestCase(tags=['_ _ S M O K E _ _', 'X_X_X', 'YYY']))
assert_equal([(s.name, s.info, s.total) for s in builder.stats],
[('smoke', 'critical', 3),
('not-ready', 'non-critical', 1),
('xxx', 'combined', 2),
('xxx', '', 2),
('YYY', '', 1)])
示例13: _verify_combined_statistics
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def _verify_combined_statistics(self, comb_tags, test_tags, expected_count):
builder = TagStatisticsBuilder(combined=[(comb_tags, 'name')])
builder.add_test(TestCase(tags=test_tags))
assert_equal([s.total for s in builder.stats if s.combined], [expected_count])
示例14: test_multiple_matches
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_multiple_matches(self):
builder = TagStatisticsBuilder(docs=[('t_1', 'd1'), ('t?', 'd2')])
builder.add_test(TestCase(tags=['t1', 't_2']))
self._verify_stats(builder.stats.tags['t1'], 'd1 & d2', 1)
self._verify_stats(builder.stats.tags['t2'], 'd2', 1)
示例15: test_simple
# 需要導入模塊: from robot.model.tagstatistics import TagStatisticsBuilder [as 別名]
# 或者: from robot.model.tagstatistics.TagStatisticsBuilder import add_test [as 別名]
def test_simple(self):
builder = TagStatisticsBuilder(docs=[('t1', 'doc')])
builder.add_test(TestCase(tags=['t1', 't2']))
builder.add_test(TestCase(tags=['T 1']))
builder.add_test(TestCase(tags=['T_1'], status='PASS'))
self._verify_stats(builder.stats.tags['t1'], 'doc', 2, 1)