gfoidl / trx2junit

Transforms XML from trx-Testresults to JUnit-Testresults / trx to JUnit XML and the other way round
MIT License
70 stars 17 forks source link

Jenkins-Junit not finding tests in test results history #102

Closed hiddenshadow21 closed 2 years ago

hiddenshadow21 commented 2 years ago

Problem

Jenkins show empty build history list for tests.

Trx2Junit creates tag <testcase/> with attributes name=FullyQualifiedTestName and classname=FullyQualifiedClassName. This leads to double usage of namespace in test result name and somehow breaks Jenkins from finding build with given test in history.

image

Solution I found

Do not use fully qualified name in <testcase> name attribute.

Expected

Trx2Junit creates tag <testcase/> with attributes name=TestName and classname=FullyQualifiedClassName.

gfoidl commented 2 years ago

@hiddenshadow21 thanks for the analysis.

Just a question: what test-framework do you use? XUnit? In the test-data I see the behavior you described. It's for XUnit, but not for NUnit and MSTest.

Will provide a fix then.

gfoidl commented 2 years ago

E.g. it's https://github.com/gfoidl/trx2junit/blob/50432b342c3219948ba49a0d30481c884afce80e/tests/trx2junit.Core.Tests/data/trx/nunit.trx#L21 (NUnit) vs https://github.com/gfoidl/trx2junit/blob/50432b342c3219948ba49a0d30481c884afce80e/tests/trx2junit.Core.Tests/data/trx/xunit.trx#L24 (XUnit). Look at className and name attributes.

So the test-runners itself write that info, trx2junit just uses these values and emits the jUnit.

Nevertheless this should be fixed up (here).

hiddenshadow21 commented 2 years ago

Yes, I'm using XUnit.

gfoidl commented 2 years ago

@hiddenshadow21 new release with that fix is out.

Thanks for reporting that issue!