Edgewall Software
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

     
    143143            fileobj = file(filename, 'r')
    144144            try:
    145145                xml_elem = xmlio.Fragment()
     146                tests = errors = 0
    146147                for child in xmlio.parse(fileobj).children():
    147148                    child_elem = xmlio.Element(child.name, **dict([
    148149                        (name, value) for name, value in child.attr.items()
     
    152153                        [xmlio.Element(grandchild.name)[grandchild.gettext()]
    153154                        for grandchild in child.children()]
    154155                    ])
     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 ''))
    155170                self.output.append((Recipe.REPORT, category, None, xml_elem))
    156171            finally:
    157172                fileobj.close()

Attachments (1)

test-report.xml (1.7 KB) - added by wormyourhonor@… 13 years ago.
verified functionality with this test report

Download all attachments as: .zip

Change History (1)

Changed 13 years ago by wormyourhonor@…

verified functionality with this test report

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.