Modify ↓
Opened 13 years ago
Last modified 9 years ago
#710 new defect
"Test" Report should output "%d of %d test%s failed" error
Reported by: | wormyourhonor@… | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 0.6.1 |
Component: | Recipe commands | Version: | 0.6 |
Keywords: | Cc: | ||
Operating System: | BSD |
Description
Using the nose2bitten XSLT to generate a bitten format test report works well. However, unlike unittest or junit reports, bitten's test reports do not show a summary of failures.
Here's a proposed patch (apologies in advance, likely "doing it wrong"):
-
bitten/recipe.py
143 143 fileobj = file(filename, 'r') 144 144 try: 145 145 xml_elem = xmlio.Fragment() 146 tests = errors = 0 146 147 for child in xmlio.parse(fileobj).children(): 147 148 child_elem = xmlio.Element(child.name, **dict([ 148 149 (name, value) for name, value in child.attr.items() … … 152 153 [xmlio.Element(grandchild.name)[grandchild.gettext()] 153 154 for grandchild in child.children()] 154 155 ]) 156 if child_elem.name == 'test': 157 tests = tests + 1 158 if 'status' in child_elem.attr.keys(): 159 status = child_elem.attr['status'] 160 else: 161 status = [elem for elem in child_elem.children 162 if elem.name == 'status'] 163 if status: 164 status = status[0].children[0].strip().lower() 165 if status in ['failure', 'error']: 166 errors = errors + 1 167 if errors: 168 self.error('%d of %d test%s failed' % (errors, tests, 169 tests != 1 and 's' or '')) 155 170 self.output.append((Recipe.REPORT, category, None, xml_elem)) 156 171 finally: 157 172 fileobj.close()
Attachments (1)
Note: See
TracTickets for help on using
tickets.
verified functionality with this test report