- test_status = 'Passed'
- if any("PERFTEST_LONG" in tag for tag in test.tags):
- throughput = test.message.split(' ')[1]
- throughput_units = test.message.split(' ')[2]
- elif any("PERFTEST_SHORT" in tag for tag in test.tags):
- for keyword in test.keywords:
- for assign in keyword.assign:
- if assign == '${rate}':
- temp = re.findall(r"(\d*\.\d+|\d+)([A-Za-z]*)",
- keyword.args[0])
- throughput = temp[0][0]
- throughput_units = temp[0][1]
-
- for keyword in test.keywords:
- for assign in keyword.assign:
- if assign == '${framesize}':
- framesize = keyword.args[0]
- if 'worker threads' in keyword.name:
- workers = keyword.name.split('\'')[1]
- workers_per_nic = keyword.name.split('\'')[3]
-
- self.out.append({'testCase': {
- 'testId': test_id,
- 'testStatus': test_status,
- 'workerThreads': workers,
- 'workerThreadsPerNic': workers_per_nic,
- 'testTags': [tag for tag in test.tags],
- 'l2FrameSize': {'value': framesize,
- 'units': 'Bytes'},
- 'throughput': {'value': throughput,
- 'units': throughput_units},
- 'vDevice': {'version': self.vDeviceVersion}}})
-
-
-def parse_tests(xml_file, vDeviceVersion):
- """Parser result of robot output file and return.
-
- :param xml_file: Output.xml from robot run.
- :param vDeviceVersion: vDevice version.
- :type xml_file: file
- :type vDeviceVersion: str
-
- :return: JSON formatted output.
- :rtype: dict
- """
+ tags = []
+ for tag in test.tags:
+ tags.append(tag)
+ test_elem = ET.SubElement(self.root,
+ test.parent.name.replace(" ", ""))
+ test_elem.attrib['name'] = test.parent.name
+ test_elem.attrib['framesize'] = str(re.search(\
+ self.tc_regexp, test.name).group(2))
+ test_elem.attrib['workerthreads'] = str(re.search(\
+ self.tc_regexp, test.name).group(3))
+ test_elem.attrib['workerspernic'] = str(re.search(\
+ self.tc_regexp, test.name).group(7))
+ test_elem.attrib['tags'] = ', '.join(tags)
+ test_elem.text = str(re.search(\
+ self.rate_regexp, test.message).group(1))
+
+ def end_test(self, test):
+ """Called when test ends.