Skip to content

Only failed subtests show up in XML output #210

@pikim

Description

@pikim

I'm trying to use xmlrunner in conjunction with subtests. In general it works, but if all subtests pass the XML output says tests="1", although I'm having more subtests than 1. On the other hand the XML output says tests="2" if 2 subtests fail, although there is still only one testcase. Is this the expected behaviour or am I doing anything wrong?

A minimum test code to reproduce could look like:

import unittest

class ut_test(unittest.TestCase):
    values = [True, False, True, False]

    def test_True(self):
        for i, val in enumerate(ut_test.values):
            with self.subTest(i=i):
                self.assertTrue(val)

if __name__ == "__main__":
    import xmlrunner

    with open("unittest.xml", 'wb') as output:
        unittest.main(
            testRunner=xmlrunner.XMLTestRunner(output=output),
            failfast=False, buffer=False, catchbreak=False, exit=False)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions