Xray-App / xray-junit-extensions

Enhanced JUnit 5 integration with Xray Test Management for Jira
Eclipse Public License 2.0
16 stars 8 forks source link

Is it possible to set a different Test key for each dynamic test iteration? #59

Open paulmwhite opened 3 weeks ago

paulmwhite commented 3 weeks ago

Given a dynamic test like the below I can't see how it's possible to use an annotation and have a unique key for each iteration:

class UnitTest {

    @Nested
    inner class Something {
        @TestFactory
        fun `something() successfully`(): List<DynamicTest> {
            fun test(
                something: String,
            ): DynamicTest {
                return DynamicTest.dynamicTest(
                    "something: $something",
                ) {
                    //    Test implementation
                }
            }

            return listOf(
                test(
                    "one"
                ),
                test(
                    "two"
                ),
            )
        }
    }
}

Is there any workaround or solution, perhaps a way to set the key in the test body?

Thanks

bitcoder commented 3 weeks ago

Can you have a look at #54 and the PR that came out of it; I think it might be possible (?). Right now I dont have the mental bandwith to look at this in more detail, but if it's possible it would be through that implementation as addressed in #55