4 new revisions:
Revision: d9a289db9fd0
Author: Pekka Klärck
Date: Tue Jul 3 05:11:34 2012
Log: atest/genrunner.py: don't write un-necessary empty line to end
http://code.google.com/p/robotframework/source/detail?r=d9a289db9fd0
Revision: 7969d32dfda8
Author: Pekka Klärck
Date: Tue Jul 3 05:14:27 2012
Log: XML lib: test fixes
http://code.google.com/p/robotframework/source/detail?r=7969d32dfda8
Revision: 12d559213f21
Author: Pekka Klärck
Date: Tue Jul 3 05:17:13 2012
Log: XML lib: Added runners for acceptance tests. All pass with Python
2.7 ...
http://code.google.com/p/robotframework/source/detail?r=12d559213f21
Revision: 36c4372ffd09
Author: Pekka Klärck
Date: Tue Jul 3 13:01:19 2012
Log: XML lib: Make tests requiring ET 1.3 non-critical if interpreter
< 2.7...
http://code.google.com/p/robotframework/source/detail?r=36c4372ffd09
==============================================================================
Revision: d9a289db9fd0
Author: Pekka Klärck
Date: Tue Jul 3 05:11:34 2012
Log: atest/genrunner.py: don't write un-necessary empty line to end
http://code.google.com/p/robotframework/source/detail?r=d9a289db9fd0
Modified:
/atest/genrunner.py
=======================================
--- /atest/genrunner.py Tue Dec 20 14:14:00 2011
+++ /atest/genrunner.py Tue Jul 3 05:11:34 2012
@@ -43,6 +43,8 @@
""" % locals())
for test in TESTS:
- output.write(test + '\n Check Test Case ${TESTNAME}\n\n')
+ output.write(test + '\n Check Test Case ${TESTNAME}\n')
+ if test is not TESTS[-1]:
+ output.write('\n')
print OUTPATH
==============================================================================
Revision: 7969d32dfda8
Author: Pekka Klärck
Date: Tue Jul 3 05:14:27 2012
Log: XML lib: test fixes
http://code.google.com/p/robotframework/source/detail?r=7969d32dfda8
Modified:
/atest/testdata/standard_libraries/xml/xpath.txt
=======================================
--- /atest/testdata/standard_libraries/xml/xpath.txt Mon Jul 2 08:40:09
2012
+++ /atest/testdata/standard_libraries/xml/xpath.txt Tue Jul 3 05:14:27
2012
@@ -45,7 +45,7 @@
child[@id="xxx"] not-found
'[tag]'
- [Documentation] FAIL No element matching '.[nonex]' found.
+ [Documentation] FAIL No element matching 'child[nonex]' found.
*[grandchild] child
child[nonex] not-found
@@ -63,7 +63,8 @@
täg/chïld chïld xml=<rööt><täg><chïld/></täg></rööt>
More complex non-ASCII xpath
- .//chïld chïld xml=<rööt><täg><chïld/></täg></rööt>
+ [Documentation] FAIL Multiple elements (2) matching './/chïld'
found.
+ .//chïld chïld xml=<rööt><chïld/><täg><chïld/></täg></rööt>
*** Keywords ***
==============================================================================
Revision: 12d559213f21
Author: Pekka Klärck
Date: Tue Jul 3 05:17:13 2012
Log: XML lib: Added runners for acceptance tests. All pass with Python
2.7 (i.e. ET 1.3) but some xpath tests fail with earlier versions and needs
to be made non-critical with them.
http://code.google.com/p/robotframework/source/detail?r=12d559213f21
Added:
/atest/robot/standard_libraries/xml/element_attribute.txt
/atest/robot/standard_libraries/xml/element_text.txt
/atest/robot/standard_libraries/xml/elements_should_be_equal.txt
/atest/robot/standard_libraries/xml/elements_should_match.txt
/atest/robot/standard_libraries/xml/get_elements.txt
/atest/robot/standard_libraries/xml/parsing.txt
/atest/robot/standard_libraries/xml/to_string.txt
/atest/robot/standard_libraries/xml/xpath.txt
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/xml/element_attribute.txt Tue Jul 3
05:17:13 2012
@@ -0,0 +1,45 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/xml/element_attribute.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+
+Get attribute of current element
+ Check Test Case ${TESTNAME}
+
+Get attribute of child element
+ Check Test Case ${TESTNAME}
+
+Getting non-existing attribute returns None
+ Check Test Case ${TESTNAME}
+
+Default value is used when attribute does not exist
+ Check Test Case ${TESTNAME}
+
+Get element attributes
+ Check Test Case ${TESTNAME}
+
+Modifying returned attributes does not affect original element
+ Check Test Case ${TESTNAME}
+
+Element attribute should be
+ Check Test Case ${TESTNAME}
+
+Element attribute should be when no attribute exists
+ Check Test Case ${TESTNAME}
+
+Element attribute should be with custom error message
+ Check Test Case ${TESTNAME}
+
+Element attribute should match
+ Check Test Case ${TESTNAME}
+
+Element attribute should match when no attribute exists
+ Check Test Case ${TESTNAME}
+
+Element attribute should match with custom error message
+ Check Test Case ${TESTNAME}
+
+Non-ASCII
+ Check Test Case ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/xml/element_text.txt Tue Jul 3
05:17:13 2012
@@ -0,0 +1,51 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/xml/element_text.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+
+Get text of current element
+ Check Test Case ${TESTNAME}
+
+Get text of child element
+ Check Test Case ${TESTNAME}
+
+Get text of element with no text
+ Check Test Case ${TESTNAME}
+
+Get text with whitespace
+ Check Test Case ${TESTNAME}
+
+Get text with whitespace normalized
+ Check Test Case ${TESTNAME}
+
+Get text of element containing children
+ Check Test Case ${TESTNAME}
+
+Get texts of elements
+ Check Test Case ${TESTNAME}
+
+Get texts of elements whitespace normalized
+ Check Test Case ${TESTNAME}
+
+Element text should be
+ Check Test Case ${TESTNAME}
+
+Element text should match
+ Check Test Case ${TESTNAME}
+
+Element text should be with whitespace normalized
+ Check Test Case ${TESTNAME}
+
+Element text should match with whitespace normalized
+ Check Test Case ${TESTNAME}
+
+Element text should be failing with custom message
+ Check Test Case ${TESTNAME}
+
+Element text should match failing with custom message
+ Check Test Case ${TESTNAME}
+
+Non-ASCII
+ Check Test Case ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/xml/elements_should_be_equal.txt Tue
Jul 3 05:17:13 2012
@@ -0,0 +1,36 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/xml/elements_should_be_equal.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+
+Elements should be equal
+ Check Test Case ${TESTNAME}
+
+Different tag names
+ Check Test Case ${TESTNAME}
+
+Different attributes
+ Check Test Case ${TESTNAME}
+
+Different texts
+ Check Test Case ${TESTNAME}
+
+Different tail texts
+ Check Test Case ${TESTNAME}
+
+Different number of children
+ Check Test Case ${TESTNAME}
+
+Differences in children
+ Check Test Case ${TESTNAME}
+
+Differences in children with same name
+ Check Test Case ${TESTNAME}
+
+Differences in children with non-ASCII path
+ Check Test Case ${TESTNAME}
+
+Normalize whitespace
+ Check Test Case ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/xml/elements_should_match.txt Tue Jul
3 05:17:13 2012
@@ -0,0 +1,33 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/xml/elements_should_match.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+
+Elements should match
+ Check Test Case ${TESTNAME}
+
+Different tag names
+ Check Test Case ${TESTNAME}
+
+Different attributes
+ Check Test Case ${TESTNAME}
+
+Different texts
+ Check Test Case ${TESTNAME}
+
+Different tail texts
+ Check Test Case ${TESTNAME}
+
+Differences in children
+ Check Test Case ${TESTNAME}
+
+Differences in children with same name
+ Check Test Case ${TESTNAME}
+
+Differences in children with non-ASCII path
+ Check Test Case ${TESTNAME}
+
+Normalize whitespace
+ Check Test Case ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/xml/get_elements.txt Tue Jul 3
05:17:13 2012
@@ -0,0 +1,30 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/xml/get_elements.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+
+Get element from parent element
+ Check Test Case ${TESTNAME}
+
+Get element from xml file
+ Check Test Case ${TESTNAME}
+
+Get element from xml string
+ Check Test Case ${TESTNAME}
+
+Get element fails when multiple elements match
+ Check Test Case ${TESTNAME}
+
+Get element fails when no elements match
+ Check Test Case ${TESTNAME}
+
+Get elements
+ Check Test Case ${TESTNAME}
+
+Get elements returns empty list when no elements match
+ Check Test Case ${TESTNAME}
+
+Non-ASCII
+ Check Test Case ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/xml/parsing.txt Tue Jul 3 05:17:13 2012
@@ -0,0 +1,21 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/xml/parsing.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+
+Parse file
+ Check Test Case ${TESTNAME}
+
+Parse string
+ Check Test Case ${TESTNAME}
+
+Parse invalid file
+ Check Test Case ${TESTNAME}
+
+Parse invalid string
+ Check Test Case ${TESTNAME}
+
+Parse non-existing file
+ Check Test Case ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/xml/to_string.txt Tue Jul 3 05:17:13
2012
@@ -0,0 +1,15 @@
+*** Settings ***
+Suite Setup Run Tests --loglevel debug
standard_libraries/xml/to_string.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+
+Element to string
+ Check Test Case ${TESTNAME}
+
+Log element
+ ${tc}= Check Test Case ${TESTNAME}
+ Check Log Message ${tc.kws[0].msgs[0]} <root>\n\t<täg
attr="hyvä">sisältö</täg>\n</root>
+ Check Log Message ${tc.kws[2].msgs[0]} <root><tag a="1"
c="3">päivää</tag></root> DEBUG
+ Check Log Message ${tc.kws[3].msgs[0]} <test
name="root">*</test> pattern=yes
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/xml/xpath.txt Tue Jul 3 05:17:13 2012
@@ -0,0 +1,45 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY} standard_libraries/xml/xpath.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+
+Tag
+ Check Test Case ${TESTNAME}
+
+Path
+ Check Test Case ${TESTNAME}
+
+'*'
+ Check Test Case ${TESTNAME}
+
+'.'
+ Check Test Case ${TESTNAME}
+
+'//'
+ Check Test Case ${TESTNAME}
+
+'//' returning multiple elements
+ Check Test Case ${TESTNAME}
+
+'[@attrib]'
+ Check Test Case ${TESTNAME}
+
+'[@attrib="value"]'
+ Check Test Case ${TESTNAME}
+
+'[tag]'
+ Check Test Case ${TESTNAME}
+
+'[position]'
+ Check Test Case ${TESTNAME}
+
+Stacked predicates
+ Check Test Case ${TESTNAME}
+
+Non-ASCII tag names
+ Check Test Case ${TESTNAME}
+
+More complex non-ASCII xpath
+ Check Test Case ${TESTNAME}
==============================================================================
Revision: 36c4372ffd09
Author: Pekka Klärck
Date: Tue Jul 3 13:01:19 2012
Log: XML lib: Make tests requiring ET 1.3 non-critical if interpreter
< 2.7. Also test warning about non-ASCII xpaths with those versions.
http://code.google.com/p/robotframework/source/detail?r=36c4372ffd09
Modified:
/atest/robot/standard_libraries/xml/xpath.txt
/atest/testdata/standard_libraries/xml/xpath.txt
/src/robot/libraries/XML.py
=======================================
--- /atest/robot/standard_libraries/xml/xpath.txt Tue Jul 3 05:17:13 2012
+++ /atest/robot/standard_libraries/xml/xpath.txt Tue Jul 3 13:01:19 2012
@@ -1,5 +1,6 @@
*** Settings ***
Suite Setup Run Tests ${EMPTY} standard_libraries/xml/xpath.txt
+Test Setup Make Tests Requiring Python 2.7 Non-Critical If
Requirement Not Met
Force Tags regression pybot jybot
Resource atest_resource.txt
@@ -24,22 +25,44 @@
Check Test Case ${TESTNAME}
'[@attrib]'
+ [Tags] 2.7+
Check Test Case ${TESTNAME}
'[@attrib="value"]'
+ [Tags] 2.7+
Check Test Case ${TESTNAME}
'[tag]'
+ [Tags] 2.7+
Check Test Case ${TESTNAME}
'[position]'
+ [Tags] 2.7+
Check Test Case ${TESTNAME}
Stacked predicates
+ [Tags] 2.7+
Check Test Case ${TESTNAME}
Non-ASCII tag names
Check Test Case ${TESTNAME}
More complex non-ASCII xpath
+ [Tags] 2.7+
Check Test Case ${TESTNAME}
+
+Warning when using more complex non-ASCII xpath with interpreter < 2.7
+ Run Keyword If '${SUITE.doc}' < '2.7' Verify Non-ASCII xpath
error
+
+*** Keywords ***
+Make Tests Requiring Python 2.7 Non-Critical If Requirement Not Met
+ Run Keyword If '2.7+' in @{TEST TAGS} and '${SUITE.doc}' < '2.7'
+ ... Remove Tags regression
+
+Verify Non-ASCII xpath error
+ ${tc}= Get Test Case More complex non-ASCII xpath
+ ${msg}= Catenate
+ ... XPATHs containing non-ASCII characters and other than tag names
+ ... do not always work with Python/Jython versions prior to 2.7.
+ ... Verify results manually and consider upgrading to 2.7.
+ Check Log Message ${tc.kws[0].kws[0].msgs[0]} ${msg} WARN
=======================================
--- /atest/testdata/standard_libraries/xml/xpath.txt Tue Jul 3 05:14:27
2012
+++ /atest/testdata/standard_libraries/xml/xpath.txt Tue Jul 3 13:01:19
2012
@@ -5,6 +5,7 @@
... expressions with non-ASCII characters require ET 1.3
... (i.e. interpreter version 2.7) or newer.
Resource resource.txt
+Suite Setup Add Interpreter Version to Suite Documentation
Test Template Get element by xpath
@@ -73,3 +74,7 @@
${element}= Get Element ${xml} ${xpath}
Should Be Equal ${element.tag} ${tag}
Run Keyword If '''${text}''' != 'IGNORE' Should Be Equal
${element.text} ${text}
+
+Add Interpreter Version to Suite Documentation
+ ${version}= Evaluate sys.version[:3] modules=sys
+ Set Suite Documentation ${version}
=======================================
--- /src/robot/libraries/XML.py Mon Jul 2 15:51:25 2012
+++ /src/robot/libraries/XML.py Tue Jul 3 13:01:19 2012
@@ -68,9 +68,9 @@
except UnicodeError:
if not xpath.replace('/', '').isalnum():
logger.warn('XPATHs containing non-ASCII characters
and '
- 'other than tag names do not always work
on '
- 'Python/Jython earlier than 2.7. Verify
results '
- 'manually and consider upgrading to 2.7.')
+ 'other than tag names do not always work
with '
+ 'Python/Jython versions prior to 2.7.
Verify '
+ 'results manually and consider upgrading
to 2.7.')
return xpath
def get_element_text(self, source, xpath='.',
normalize_whitespace=False):