Revision: b5d842bacbc9
Author: Janne Härkönen <[email protected]>
Date: Wed Apr 20 22:13:12 2011
Log: Serializing: serialize criticality of a test inside <status>
Added also an acceptance test that verifies the attribute by parsing
the XML.
Update issue 820
Staus: Done
http://code.google.com/p/robotframework/source/detail?r=b5d842bacbc9
Added:
/atest/robot/output/test_criticality.txt
Modified:
/src/robot/output/xmllogger.py
=======================================
--- /dev/null
+++ /atest/robot/output/test_criticality.txt Wed Apr 20 22:13:12 2011
@@ -0,0 +1,23 @@
+*** Settings ***
+Force Tags pybot jybot regression
+Resource atest_resource.txt
+Suite Setup Run some tests and parse XML
+
+*** Test Cases ***
+Test Criticality Should Be Serialized Inside Status Tag
+ Check Test Criticality in Output 0 yes
+ Check Test Criticality in Output 1 no
+
+*** Keywords ***
+Run some tests and parse XML
+ Run Tests --noncritical fail misc${/}pass_and_fail.html
+ ${SUITE}= Get Node ${OUTFILE} suite
+ Set Suite Variable ${SUITE}
+
+Check Test Criticality in Output
+ [Arguments] ${testindex} ${expected criticality}
+ ${test}= Set Variable ${suite.get_nodes('test')[${testindex}]}
+ Should Be Equal ${test.get_node('status').get_attr('critical')}
+ ... ${expected criticality}
+
+
=======================================
--- /src/robot/output/xmllogger.py Sun Feb 6 01:24:10 2011
+++ /src/robot/output/xmllogger.py Wed Apr 20 22:13:12 2011
@@ -95,7 +95,8 @@
def end_test(self, test):
self._write_list('tag', test.tags, 'tags')
- self._write_status(test, test.message)
+ self._write_status(test, test.message,
+ extra_attrs={'critical': test.critical})
self._writer.end('test')
def start_suite(self, suite):
@@ -214,7 +215,9 @@
if container is not None:
self._writer.end(container)
- def _write_status(self, item, message=None):
- self._writer.element('status', message, {'status': item.status,
- 'starttime':
item.starttime,
- 'endtime': item.endtime})
+ def _write_status(self, item, message=None, extra_attrs=None):
+ attrs = {'status': item.status, 'starttime': item.starttime,
+ 'endtime': item.endtime}
+ if extra_attrs:
+ attrs.update(extra_attrs)
+ self._writer.element('status', message, attrs)