Skip to content
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

suggestion: onlyTest #92

Open
jarikomppa opened this issue Oct 7, 2013 · 4 comments
Open

suggestion: onlyTest #92

jarikomppa opened this issue Oct 7, 2013 · 4 comments
Milestone

Comments

@jarikomppa
Copy link

Typical use cases are either to run all tests, or to run a single test (when debugging, or building a new test). Disabling all other tests manually is time-consuming and error-prone.

I suggest the addition of onlyTest function prefix; when found, only that test should be run. This functionality should(tm) be relatively easy to add.

For example:

void testFoo() { ...
void testBar() { ...
void testBaz() { ...

would run all three tests, while

void testFoo() { ...
void onlytestBar() { ...
void testBaz() { ...

would only run the Bar test. If more than one "onlyTest" prefixed function is hit, only the first one needs to be run.

@whart222
Copy link
Member

Is this functionality not handled through the commandline? If you want to just run one test, then you can use the command-line syntax to specify the test that you want to run.

@jarikomppa
Copy link
Author

It may be (I haven't found such a commandline option), but the way cxxtest is integrated to my current workflow makes it impractical to adjust commandline options back and forth.

Additionally, the cxxtest manual has long discussion on how tests are discovered and what kinds of commenting out works and what doesnt (4.6.2. Commenting Out Tests), meaning someone has given this thought before.

The solution I propose should be easy to implement and use. The only practical alternative is to do a search-and-replace with "void test" pattern to disable all tests, then enable one.

@whart222
Copy link
Member

Ah, I see the use case. Let me see what I can do.

@jarikomppa
Copy link
Author

fyi: worked around this by adding to the start of every test:

#ifdef DISABLE_TESTS
    TS_FAIL("Disabled");
    return;
#endif 

After that, just making the one test one is interested if #if 0//def lets one run just one test. (The rest still fail, making sure that you don't forget the disable on and think everything succeeds).

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

No branches or pull requests

2 participants