Revision: 491d80c7615a
Branch: default
Author: Ilmari Kontulainen <[email protected]>
Date: Thu Oct 18 05:45:15 2012
Log: Fix empty attribute name in set element attribute bug
Update issue 1234
cc: [email protected]
Fixed issue where empty attribute name to set element attirubte keyword
caused malformed xml.
Tests included
http://code.google.com/p/robotframework/source/detail?r=491d80c7615a
Modified:
/atest/robot/standard_libraries/xml/set_element_information.txt
/atest/testdata/standard_libraries/xml/set_element_information.txt
/src/robot/libraries/XML.py
=======================================
--- /atest/robot/standard_libraries/xml/set_element_information.txt Wed Oct
17 14:01:06 2012
+++ /atest/robot/standard_libraries/xml/set_element_information.txt Thu Oct
18 05:45:15 2012
@@ -25,6 +25,9 @@
Set Element Attribute
Check Test Case ${TESTNAME}
+
+Set element Attribute should fail with empty name
+ Check Test Case ${TESTNAME}
Overwrite Element Attribute
Check Test Case ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/xml/set_element_information.txt Wed
Oct 17 14:01:06 2012
+++ /atest/testdata/standard_libraries/xml/set_element_information.txt Thu
Oct 18 05:45:15 2012
@@ -45,6 +45,11 @@
Set Element Attribute ${XML} attr value
Element Attribute Should Be ${XML} attr value
+Set element Attribute should fail with empty name
+ [Documentation] FAIL Attribute name can not be empty.
+ Set Element Attribute ${XML} ${EMPTY} value
+
+
Overwrite Element Attribute
Set Element Attribute ${XML} id new xpath=child
Element Attribute Should Be ${XML} id new xpath=child
=======================================
--- /src/robot/libraries/XML.py Thu Oct 18 04:23:10 2012
+++ /src/robot/libraries/XML.py Thu Oct 18 05:45:15 2012
@@ -812,6 +812,8 @@
New in Robot Framework 2.7.5.
"""
+ if not name:
+ raise RuntimeError('Attribute name can not be empty.')
source = self.get_element(source)
self.get_element(source, xpath).attrib[name] = value
return source