3 new revisions:
Revision: 52d250c31734
Author: Pekka Klärck
Date: Thu Nov 3 13:59:05 2011
Log: I was wondering why these tests didn't fail. Well, the reason was
that...
http://code.google.com/p/robotframework/source/detail?r=52d250c31734
Revision: b8509b5323dd
Author: Pekka Klärck
Date: Thu Nov 3 16:34:06 2011
Log: Filtering with rebot: Error message when no test match. This
commit ma...
http://code.google.com/p/robotframework/source/detail?r=b8509b5323dd
Revision: daf1b9c25143
Author: Pekka Klärck
Date: Thu Nov 3 16:34:14 2011
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=daf1b9c25143
==============================================================================
Revision: 52d250c31734
Author: Pekka Klärck
Date: Thu Nov 3 13:59:05 2011
Log: I was wondering why these tests didn't fail. Well, the reason was
that the tests were buggy. Now they fail.
http://code.google.com/p/robotframework/source/detail?r=52d250c31734
Modified:
/atest/robot/tags/include_and_exclude_with_rebot.txt
=======================================
--- /atest/robot/tags/include_and_exclude_with_rebot.txt Mon Aug 29
13:23:11 2011
+++ /atest/robot/tags/include_and_exclude_with_rebot.txt Thu Nov 3
13:59:05 2011
@@ -137,7 +137,7 @@
Run And Check Error
[Arguments] ${params} ${filter_msg}
- Run Tests Without Processing Output ${params} ${ESCAPES} ${TESTFILE}
+ Run Rebot Without Processing Output ${params} ${ESCAPES} ${INPUT
FILE}
${stderr} = Get Stderr
Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Include And
Exclude' with ${filter_msg} contains no test cases.\n\n Try --help for
usage information.
File Should Not Exist ${OUTFILE}
==============================================================================
Revision: b8509b5323dd
Author: Pekka Klärck
Date: Thu Nov 3 16:34:06 2011
Log: Filtering with rebot: Error message when no test match. This
commit may even fix the build.
http://code.google.com/p/robotframework/source/detail?r=b8509b5323dd
Modified:
/atest/robot/rebot/filter_by_names.txt
/atest/robot/tags/include_and_exclude_with_rebot.txt
/src/robot/result/configurer.py
/utest/result/test_configurer.py
=======================================
--- /atest/robot/rebot/filter_by_names.txt Tue Nov 1 22:37:36 2011
+++ /atest/robot/rebot/filter_by_names.txt Thu Nov 3 16:34:06 2011
@@ -57,17 +57,17 @@
No Matching tests
Run Rebot Without Processing Output --test nonex ${INPUT FILE}
${stderr} = Get Stderr
- Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests &
Suites' contains no test cases named 'nonex'.${USAGE_TIP}
+ Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests &
Suites' contains no test named 'nonex'.${USAGE_TIP}
No Matching Suites
Run Rebot Without Processing Output --suite nonex -s n2 -s n3
${INPUT FILE}
${stderr} = Get Stderr
- Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests &
Suites' contains no test suites named 'nonex', 'n2' or 'n3'.${USAGE_TIP}
+ Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests &
Suites' contains no test in suites 'nonex', 'n2' or 'n3'.${USAGE_TIP}
No Matching Tests In Matching Suites
Run Rebot Without Processing Output --suite nonex --suite suites
--test first --test nonex --test STARone ${ESCAPES} ${INPUT FILE}
${stderr} = Get Stderr
- Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests &
Suites' contains no test cases 'first', 'nonex' or '*one' in suites 'nonex'
or 'suites'.${USAGE_TIP}
+ Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Many Tests &
Suites' contains no test named 'first', 'nonex' or '*one' in suites 'nonex'
or 'suites'.${USAGE_TIP}
Elapsed Time
[Documentation] Test setting start, end and elapsed times correctly
when filtering by tags
=======================================
--- /atest/robot/tags/include_and_exclude_with_rebot.txt Thu Nov 3
13:59:05 2011
+++ /atest/robot/tags/include_and_exclude_with_rebot.txt Thu Nov 3
16:34:06 2011
@@ -72,16 +72,16 @@
Non Matching Include
[Template] Run And Check Error
- --include nonex includes 'nonex'
- --include nonex -i nonex2 includes 'nonex' and 'nonex2'
+ --include nonex with tag 'nonex'
+ --include nonex -i nonex2 with tags 'nonex' or 'nonex2'
Non Matching Exclude
--exclude nonexisting -e nonex2 -e nonex3 @{ALL}
Non Matching Include And Exclude
[Template] Run And Check Error
- -i nonex -e nonex2 includes 'nonex' and excludes 'nonex2'
- --include nonex -i incl? -e STAR1 -e STAR2 -e STAR3 includes 'nonex'
and 'incl?' and excludes '*1', '*2' and '*3'
+ -i nonex -e nonex2 with tag 'nonex' and without tag 'nonex2'
+ --include nonex -i incl? -e STAR1 -e STAR2 -e STAR3 with tags 'nonex'
or 'incl?' and without tags '*1', '*2' or '*3'
Including With Robot And Including And Excluding With Rebot
[Setup] Create Output With Robot ${INPUT FILE} --include incl1
--exclude nonexisting ${TESTFILE}
@@ -139,5 +139,5 @@
[Arguments] ${params} ${filter_msg}
Run Rebot Without Processing Output ${params} ${ESCAPES} ${INPUT
FILE}
${stderr} = Get Stderr
- Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Include And
Exclude' with ${filter_msg} contains no test cases.\n\n Try --help for
usage information.
+ Should Be Equal ${stderr.strip()} [ ERROR ] Suite 'Include And
Exclude' contains no test ${filter_msg}.\n\n Try --help for usage
information.
File Should Not Exist ${OUTFILE}
=======================================
--- /src/robot/result/configurer.py Thu Nov 3 09:16:05 2011
+++ /src/robot/result/configurer.py Thu Nov 3 16:34:06 2011
@@ -13,6 +13,7 @@
# limitations under the License.
from robot import utils
+from robot.errors import DataError
class SuiteConfigurer(object):
@@ -49,6 +50,8 @@
self._set_suite_attributes(suite)
suite.filter(self.include_suites, self.include_tests,
self.include_tags, self.exclude_tags)
+ if not suite.test_count:
+ self._raise_no_matching_tests_error(suite.name)
suite.set_tags(self.add_tags, self.remove_tags)
suite.remove_keywords(self.remove_keywords)
suite.filter_messages(self.log_level)
@@ -76,3 +79,28 @@
return None
return utils.secs_to_timestamp(secs, millis=True)
+ def _raise_no_matching_tests_error(self, suite):
+ msg = '%s %s' % (self._get_test_selector_msgs(),
+ self._get_suite_selector_msg())
+ raise DataError("Suite '%s' contains no test %s." % (suite,
msg.strip()))
+
+ def _get_test_selector_msgs(self):
+ parts = []
+ for explanation, selector in [('with tags', self.include_tags),
+ ('without tags', self.exclude_tags),
+ ('named', self.include_tests)]:
+ if selector:
+ parts.append(self._format_selector_msg(explanation,
selector))
+ return utils.seq2str(parts, quote='')
+
+ def _format_selector_msg(self, explanation, selector):
+ if isinstance(selector, basestring):
+ selector = [selector]
+ if len(selector) == 1 and explanation[-1] == 's':
+ explanation = explanation[:-1]
+ return '%s %s' % (explanation, utils.seq2str(selector, lastsep='
or '))
+
+ def _get_suite_selector_msg(self):
+ if not self.include_suites:
+ return ''
+ return self._format_selector_msg('in suites', self.include_suites)
=======================================
--- /utest/result/test_configurer.py Thu Nov 3 06:05:49 2011
+++ /utest/result/test_configurer.py Thu Nov 3 16:34:06 2011
@@ -1,7 +1,8 @@
from itertools import chain
import unittest
-from robot.utils.asserts import assert_equal, assert_true
-
+from robot.utils.asserts import assert_equal, assert_raises_with_msg
+
+from robot.errors import DataError
from robot.result.model import TestSuite, TestCase
from robot.result.configurer import SuiteConfigurer
@@ -10,6 +11,7 @@
def setUp(self):
self.suite = TestSuite(name='Suite', metadata={'A
A': '1', 'bb': '1'})
+ self.suite.tests.create(name='Make suite non-empty')
def test_name_and_doc(self):
SuiteConfigurer(name='New Name', doc='New
Doc').configure(self.suite)
@@ -54,7 +56,7 @@
assert_equal(list(self.suite.suites[0].tests[0].tags), [])
-class TestFilteringByTags(unittest.TestCase):
+class TestFiltering(unittest.TestCase):
def setUp(self):
self.suite = TestSuite(name='root')
@@ -78,6 +80,24 @@
assert_equal(list(self.suite.tests), [])
assert_equal([t.name for t in self.suite.suites[0].tests], ['n1'])
+ def test_no_matching_tests_with_one_selector_each(self):
+ configurer = SuiteConfigurer(include_tags='i', exclude_tags='e',
+ include_suites='s', include_tests='t')
+ assert_raises_with_msg(DataError,
+ "Suite 'root' contains no test with
tag 'i', "
+ "without tag 'e' and named 't' in
suite 's'.",
+ configurer.configure, self.suite)
+
+ def test_no_matching_tests_with_multiple_selectors(self):
+ configurer = SuiteConfigurer(include_tags=['i1', 'i2'],
+ exclude_tags=['e1', 'e2'],
+ include_suites=['s1', 's2', 's3'],
+ include_tests=['t1', 't2'])
+ assert_raises_with_msg(DataError,
+ "Suite 'root' contains no test with
tags 'i1' or 'i2', "
+ "without tags 'e1' or 'e2' and named 't1'
or 't2' "
+ "in suites 's1', 's2' or 's3'.",
+ configurer.configure, self.suite)
class TestRemoveKeywords(unittest.TestCase):
==============================================================================
Revision: daf1b9c25143
Author: Pekka Klärck
Date: Thu Nov 3 16:34:14 2011
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=daf1b9c25143