-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
run test fixture from cli #190
Comments
Hi! when using Such test fixtures (which are normal test cases actually) can just as easily be put in a I could perhaps introduce a new tag decorator and add the fixture class as a tag (or prepend it to the name of the test - which would be a breaking change), but currently using test suites is an easier way and I would prefer keeping the framework simpler. Is using test suites enough for your needs? Let me know what you think. |
Hi Viktor, thanks for the quick response. I guess using the TEST_SUITE approach works without changing things. I'd guess I'd like to see the Fixture treated as a TEST_SUITE so then could filter automatically at the test suite level. From a traditional test strategy perspective, I see a Fixture akin to a test suite anyway. What would you say were the conceptual differences between a suite and a fixture? |
To be honest I mainly mimicked what Catch is doing (and perhaps other C++ testing frameworks). Here is one solution you could use: #undef DOCTEST_TEST_CASE_FIXTURE
#define DOCTEST_TEST_CASE_FIXTURE(c, ...) \
DOCTEST_IMPLEMENT_FIXTURE(DOCTEST_ANONYMOUS(_DOCTEST_ANON_CLASS_), c, \
DOCTEST_ANONYMOUS(_DOCTEST_ANON_FUNC_), \
__VA_ARGS__* doctest::test_suite(#c)) and now when you use You could put that code in a header called Let me know if this works for you. |
That looks great, I'll have a play and let you know. Update: that works perfectly! any chance getting it as an enhancement request? Thanks |
I missed your edit of your last post (no notification) so sorry for the late reply. I don't think that most people would see the fixture used as a test suite. I could add it and guard it with an I might advertise the ability to change the behavior of the macros more in the docs but for now I'm closing this issue - let me know if you need anything else :) |
Description
There does not appear any ability to run a test fixture (similar to the way test cases and test suites can be run) from the command line.
I appreciate that a test-case with subcase seems to be your preferred model but not having this capability negates any major benefit of having Fixtures.
Can it be done without prefixing all fixture test cases with an appropriate string for regex matching?
Maybe the fixture name could be pre-pended to the test case name string to allow regex test invocation?
The text was updated successfully, but these errors were encountered: