Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adds option to allow prefixing the class name in an xunit report #968

Merged
merged 2 commits into from
Nov 28, 2015

Conversation

joscha
Copy link
Contributor

@joscha joscha commented Nov 12, 2015

In a matrixed build environment (for example running tests with tox) and producing multiple xunit reports, a report crawler (for example from Bamboo) can not distinguish between results in different environments, because the class name is always the same.
In order to allow distinguishing between failures in different environments, this PR adds an option --xunit-prefix-with-testsuite-name to the nose-xunit plugin.

A test result looking like this with --with-xunit:

<testcase classname="tests.x.y" name="somename" time="0.000">

becomes:

<testcase classname="nosetests.tests.x.y" name="somename" time="0.000">

with --with-xunit --xunit-prefix-with-testsuite-name
or:

<testcase classname="foo.tests.x.y" name="somename" time="0.000">

with --with-xunit --xunit-testsuite-name=foo --xunit-prefix-with-testsuite-name.

Side note: It works in a similar manner as the useBrowserName option in the karma-junit-reporter.

Fixes #402

@dirk-thomas
Copy link

This patch implement a very valuable and long requested feature (#402).

I have the same problem that Jenkins only shows the classname but with multiple packages being tested it is unclear to which each of them belongs. The job already uses --xunit-testsuite-name=... but Jenkins does not utilize the testsuite name attribute. This new option would solve that.

self.configure([
"--with-xunit",
"--xunit-file=%s" % self.xmlfile,
"--xunit-prefix-with-testsuite-name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good with one exception: I expected to see a test that uses xunit-testsuite-name to change the prefix. Do you mind adding such a test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought adding the default would be enough. Additional test is in ab198aa

@joscha joscha force-pushed the add-prefix-parameter branch from 0214d2e to ab198aa Compare November 28, 2015 13:13
@joscha
Copy link
Contributor Author

joscha commented Nov 28, 2015

@jszakmeister I added the additional test in ab198aa and rebased to master

@jszakmeister
Copy link
Contributor

Great! Thanks!

jszakmeister added a commit that referenced this pull request Nov 28, 2015
Adds option to allow prefixing the class name in an xunit report
@jszakmeister jszakmeister merged commit 6d3768e into nose-devs:master Nov 28, 2015
@joscha joscha deleted the add-prefix-parameter branch November 28, 2015 13:30
@joscha
Copy link
Contributor Author

joscha commented Nov 28, 2015

Thanks for integrating!

@dirk-thomas
Copy link

Great! Can I assume that this will be released in 1.3.8 at some point in the future?

@jszakmeister
Copy link
Contributor

Hopefully. I'm not making any promises--I'm stepping down as maintainer soon.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow user-specified prefix for all test names in XML report
3 participants