3 new revisions:
Revision: 7e48b0a51753
Author: Pekka Klärck
Date: Mon Dec 19 13:51:44 2011
Log: unused imports, better todo
http://code.google.com/p/robotframework/source/detail?r=7e48b0a51753
Revision: 78b84872b912
Author: Pekka Klärck
Date: Mon Dec 19 14:28:56 2011
Log: added default value to ease unit testing
http://code.google.com/p/robotframework/source/detail?r=78b84872b912
Revision: 19d3bb388326
Author: Pekka Klärck
Date: Mon Dec 19 14:33:50 2011
Log: Tests and one fix for handling underscores in tag name with
--tagdoc...
http://code.google.com/p/robotframework/source/detail?r=19d3bb388326
==============================================================================
Revision: 7e48b0a51753
Author: Pekka Klärck
Date: Mon Dec 19 13:51:44 2011
Log: unused imports, better todo
http://code.google.com/p/robotframework/source/detail?r=7e48b0a51753
Modified:
/utest/model/test_statistics.py
/utest/model/test_tagstatistics.py
=======================================
--- /utest/model/test_statistics.py Fri Nov 18 14:26:09 2011
+++ /utest/model/test_statistics.py Mon Dec 19 13:51:44 2011
@@ -78,7 +78,7 @@
assert_equals(len(s2.suites), 0)
def test_tags(self):
- # Tag stats are tested more thoroughly in their own suite.
+ # Tag stats are tested more thoroughly in test_tagstatistics.py
tags = self.statistics.tags
verify_stat(tags.tags['smoke'], 'smoke', 2, 2, True, False)
verify_stat(tags.tags['t1'], 't1', 3, 2, False, False)
=======================================
--- /utest/model/test_tagstatistics.py Fri Nov 18 13:36:14 2011
+++ /utest/model/test_tagstatistics.py Mon Dec 19 13:51:44 2011
@@ -2,9 +2,8 @@
from robot.model import Criticality
from robot.utils.asserts import assert_equals, assert_none
-from robot.model.statistics import Statistics
from robot.model.tagstatistics import TagStatisticsBuilder, TagStatLink
-from robot.result import TestSuite, TestCase
+from robot.result import TestCase
from robot import utils
==============================================================================
Revision: 78b84872b912
Author: Pekka Klärck
Date: Mon Dec 19 14:28:56 2011
Log: added default value to ease unit testing
http://code.google.com/p/robotframework/source/detail?r=78b84872b912
Modified:
/src/robot/model/tagstatistics.py
=======================================
--- /src/robot/model/tagstatistics.py Fri Nov 18 13:36:14 2011
+++ /src/robot/model/tagstatistics.py Mon Dec 19 14:28:56 2011
@@ -15,8 +15,10 @@
import re
from robot import utils
+
from .tags import TagPatterns
from .stats import TagStat, CombinedTagStat
+from .criticality import Criticality
class TagStatistics(object):
@@ -34,8 +36,8 @@
class TagStatisticsBuilder(object):
- def __init__(self, criticality, included=None, excluded=None,
combined=None,
- docs=None, links=None):
+ def __init__(self, criticality=None, included=None, excluded=None,
+ combined=None, docs=None, links=None):
self._included = TagPatterns(included)
self._excluded = TagPatterns(excluded)
self._info = TagStatInfo(criticality, docs, links)
@@ -65,8 +67,8 @@
class TagStatInfo(object):
- def __init__(self, criticality, docs=None, links=None):
- self._criticality = criticality
+ def __init__(self, criticality=None, docs=None, links=None):
+ self._criticality = criticality or Criticality()
self._docs = [TagStatDoc(*doc) for doc in docs or []]
self._links = [TagStatLink(*link) for link in links or []]
==============================================================================
Revision: 19d3bb388326
Author: Pekka Klärck
Date: Mon Dec 19 14:33:50 2011
Log: Tests and one fix for handling underscores in tag name with
--tagdoc
Update issue 986
Status: Done
Owner: pekka.klarck
This had already been mostly fixed as part of refactoring how statistics
are handled when creating logs/reports. Only aspect that was broken was
that information wasn't written correctly to XML when running tests.
In addition to fixing the last broken aspect I added both acceptance and
unit level tests for this functionality. The extra `it` in User Guide
documentation was also fixed.
I consider this issue done.
http://code.google.com/p/robotframework/source/detail?r=19d3bb388326
Modified:
/atest/robot/tags/tag_doc.txt
/atest/robot/tags/tag_doc_with_rebot.txt
/atest/testdata/misc/normal.html
/doc/userguide/src/ExecutingTestCases/OutputFiles.txt
/src/robot/common/statistics.py
/utest/model/test_tagstatistics.py
=======================================
--- /atest/robot/tags/tag_doc.txt Mon Nov 28 01:52:15 2011
+++ /atest/robot/tags/tag_doc.txt Mon Dec 19 14:33:50 2011
@@ -14,7 +14,7 @@
1 d1 Doc for many tags
Tag Doc With Multiple Matches
- 2 d2 Doc for many tags & More doc
+ 2 d_2 Doc for many tags & More doc
Tag Doc With Formatting
4 t1 http://some.url *bold*
@@ -28,8 +28,8 @@
Run Tests With Tag Docs
${opts} = Catenate
... --tagdoc f1:Some_documentation
- ... --tagdoc t1:http://some.url_*bold*
- ... --tagdoc d?:Doc_for_many_tags
+ ... --tagdoc t_1:http://some.url_*bold*
+ ... --tagdoc _d_?_:Doc_for_many_tags
... --tagdoc D2:More_doc
... --tagstatcombine d*:DX
Run Tests ${opts} misc/normal.html
=======================================
--- /atest/robot/tags/tag_doc_with_rebot.txt Mon Nov 28 01:52:15 2011
+++ /atest/robot/tags/tag_doc_with_rebot.txt Mon Dec 19 14:33:50 2011
@@ -14,7 +14,7 @@
1 d1 Doc for many rebot tags
Tag Doc With Multiple Matches
- 2 d2 Doc for many rebot tags & More doc
+ 2 d_2 Doc for many rebot tags & More doc
Tag Doc With Formatting
4 t1 http://some.url *bold*
@@ -29,8 +29,8 @@
Run Tests Without Processing Output ${EMPTY} misc/normal.html
${opts} = Catenate
... --tagdoc f1:Some_documentation_for_rebot
- ... --tagdoc t1:http://some.url_*bold*
- ... --tagdoc d?:Doc_for_many_rebot_tags
+ ... --tagdoc t_1:http://some.url_*bold*
+ ... --tagdoc _d_?_:Doc_for_many_rebot_tags
... --tagdoc D2:More_doc
... --tagstatcombine d*:DX
Run Rebot ${opts} ${OUTFILE}
=======================================
--- /atest/testdata/misc/normal.html Tue Dec 28 06:42:40 2010
+++ /atest/testdata/misc/normal.html Mon Dec 19 14:33:50 2011
@@ -3,8 +3,8 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="RIDE" />
-<meta name="rf-template" content="False" />
+<meta name="generator" content="RIDE" />
+<meta name="rf-template" content="False" />
<style type="text/css">
html {
font-family: Arial,Helvetica,sans-serif;
@@ -62,7 +62,7 @@
<tr>
<td class="name">Default Tags</td>
<td>d1</td>
-<td>d2</td>
+<td>d_2</td>
<td></td>
<td></td>
</tr>
=======================================
--- /doc/userguide/src/ExecutingTestCases/OutputFiles.txt Wed Nov 2
02:38:15 2011
+++ /doc/userguide/src/ExecutingTestCases/OutputFiles.txt Mon Dec 19
14:33:50 2011
@@ -403,7 +403,7 @@
:opt:`tag:doc`. :opt:`tag` is the name of the tag to assign the
documentation to, and it can also be a `simple pattern`_ matching
multiple tags. :opt:`doc` is the assigned documentation. Underscores
-in it the documentation are automatically converted to spaces and it
+in the documentation are automatically converted to spaces and it
can also contain `HTML formatting`_.
The given documentation is shown with matching tags in the :name:`Test
=======================================
--- /src/robot/common/statistics.py Thu Dec 1 03:51:03 2011
+++ /src/robot/common/statistics.py Mon Dec 19 14:33:50 2011
@@ -277,7 +277,7 @@
self._pattern = pattern
def matches(self, tag):
- return utils.matches(tag, self._pattern)
+ return utils.matches(tag, self._pattern, ignore=['_'])
class TagStatLink:
=======================================
--- /utest/model/test_tagstatistics.py Mon Dec 19 13:51:44 2011
+++ /utest/model/test_tagstatistics.py Mon Dec 19 14:33:50 2011
@@ -174,6 +174,35 @@
('t1', '', 2), ('t2', '', 1), ('t3', '', 1)])
+class TestTagStatDoc(unittest.TestCase):
+
+ 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)
+
+ 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)
+
+ 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)
+
+ def _verify_stats(self, stat, doc, failed, passed=0):
+ assert_equals(stat.doc, doc)
+ assert_equals(stat.failed, failed)
+ assert_equals(stat.passed, passed)
+
+
class TestTagStatLink(unittest.TestCase):
def test_valid_string_is_parsed_correctly(self):