-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test case grouping #320
Comments
It's easy to group test cases into groups. I did have a plan at one point to have named groups (where you associate a tag or set of tags with a name) and that name would appear as the suite name in the Junit report. I never followed through on that and, since nobody asked about it, eventually deprecated it. It would be possible to resurrect it, though. |
If you have a complicated tag spec that you use a lot, btw (e.g. specifying several tags, including some exclusions) I recently added the ability to define tag aliases using a macro. It's not (yet) documented, but you just write something like:
Then you can run all tests tagged, |
Thanks for the information. Will the tags appear in the junit test report? (Ah, I see you covered that - missed it on first reading.) If you're sure tags are the right way to go to gain structure to the test reports, then it would be great to have that feature resurrected. To my mind, tags are orthogonal to a more rigid hierarchical test-case organization, so having a GROUP() or SUITE() macro still seems more fitting, at least from my limited knowledge of this project. |
IIRC it used the tags specified as the group name. I think that's still the case - but I can't check right now - try it out |
For what it's worth I would love to have that test suite grouping. Especially when writing BDD-style tests it is very practical to allow grouping all tests for a specific module or class. |
@m-mcgowan: Over in issue #5 you said: "I'm finding tags a bit of a pain, and I often forget. For example, I just made unit tests for a PRNG, in random.cpp. Each test then has as a minimum one tag [random]. Would be great to simply wrap the whole lot in a big group."
The trouble with the |
This ticket is quite old - and seems at least partially addressed. Is anyone still dissatisfied with these options? (@m-mcgowan, @wichert)? |
The tagging mechanism is excellent for controlling which tests to run, but I am having problems creating adequately structured junit xml reports for display in Jenkins. The junit plugin in Jenkins is a little strange. It doesn't care about the hierarchy in the xml, instead it displays the test results in a hierarchy based on java-packages, which is forms by splitting the classname attribute of the element by ".". The Catch::JunitReporter would serve the needs of my project well if the classname attribute of the element was formed using the .<[#filename]>. We run the same test code compiled as 32-bit and 64-bit code and the with the included as above, it would be possible to run the test as "test-executable -n win32.x86 -# -r junit -o junit-report-x86.xml" and " test-executable -n win32.x64 -# -r junit -o junit-report-x64.xml" and get two xml reports that jenkins will group nicely by architecture (x86 and x64). |
I believe the last comment was addressed in the linked issue, so I am going to close this. |
If I may revive this issue, I would say tags are not groups, and the main advantage of grouping would be in displaying the reports, and finding the failing errors, while tags are meant for filtering. For example: Group(BackEnd){
Group(Database){
TEST_CASE(..., "[NeedsInternet, MySQL]")
}
Group(API){
TEST_CASE(...)
}
}
Group(FrontEnd){
TEST_CASE(...)
} On the backend it could be made that each top-level group is its own executable/cmake target, unless a custom implementation is requested. Benefits
|
Unless I've missed it, it doesn't seem possible to group test cases into larger structures.
With UnitTest++, you can group tests into suites:
It would be great to have this in Catch - it would make test organization possible (and simple). Nesting suites, or groups, would be a natural way to organize a large body of tests.
This would also make the junit reporter make more sense which presently creates a single
<testsuite>
element (with no name). WithSUITE()
support, it could output multiple suites, giving nicer organization in HTML test reports.Sweet!
The text was updated successfully, but these errors were encountered: