Adds an optional test name
This change adds an (optional) name to a TestFixture.
This allows you to create a TestFixture as such:
MyTest() : tpunit::TestFixture(BEFORE_CLASS(MyTest::setup),
TEST(MyTest::testMyThing),
AFTER_CLASS(StripeTest::tearDown)) {
NAME(MyTest);
}
And then later on invoke your test by doing:
set<string> include, exclude;
include.insert("MyTest");
tpunit::Tests::run(include, exclude);
This makes it easy to conditionally separate groups of tests and allows for, for instance, the following:
if (each_build) {
set<string> include, exclude;
exclude.insert("SlowTest");
tpunit::Tests::run(include, exlude);
}
else if (nightly_comprehensive) {
// Just run everything.
tpunit::Tests::run();
}
Unnamed tests will still be run when include is left empty.
@tylerkaraszewski: Thanks for the pull request! @flodnv put in a similar feature request (issue #6). I think there is some overlap in the functionality. Does the feedback there make sense for you? Specifically the ability to include/exclude specific tests.
@flodnv: LMK if you have thoughts as well.
@tpounds Thanks for the feedback. I've updated the PR to support both including and excluding lists of tests, and updated main to take these arguments on the command line. You can test by building main and running with the options --include=TPUnitPPTest and --exclude=TPUnitPPTest.
I tried to keep the required includes to a minimum, but this change does depend on <set> and <string>, but presumably those are pretty universally available.
Awesome @tylerkaraszewski, thanks much!
👍
@tpounds Any further feedback on this?
@tpounds I get this probably isn't a huge priority for you, but we'd prefer to be able to use the master branch here rather than our own fork for this, if you have no problems merging it.