Skip to content

Junit output for test cases that take arguments #62

@stack

Description

@stack

I have a Swift Testing test similar to the following:

@Test("Cancellation is detected", arguments: [
    (false, false, true),
    (false, true,  true),
    (false, nil,   true),
    (true,  false, false),
    (true,  true,  true),
    (true,  nil,   false),
    (nil,   false, false),
    (nil,   true,  true),
    (nil,   nil,   false)
  ])
func cancellation(isActive: Bool?, isDeleted: Bool?, expected: Bool) throws {
    // ...
}

When a JUnit report is generated for these tests, we get a series of the same results with the same names.

<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>
<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>
<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>
<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>
<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>
<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>
<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>
<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>
<testcase name="cancellation(isActive:isDeleted:expected:)" time="0" classname="MyTests"/>

This is a little ambiguous. It would be nice to have some way to detect which one is which.

I had played with this before, and in the case that the test case contains just arguments, I turned the test case in to a test suite and made each argument a test case. I'm not sure if that's the proper way to go, but it seemed to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions