Is there a way to register a cpp unit test, but not run it? The reason being we might not wan to run it initially, but only upon some conditions or to the developer's interest in running it.
Any help is appreciated!
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, but you can neuter a test in several ways. Here are a few:
- use "#ifdef _DEBUG" or similar to only enable a test in certain conditions
- check for an environment variable setting on the test machine and skip certain portions of the test if the variable is defined
- write the test but comment it out
Note that the test header and implementation can be defined but a test will not be run if it is not mentioned in the CPPUNIT_TEST() line. You can write tests and disable them by commenting out this one line.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Is there a way to register a cpp unit test, but not run it? The reason being we might not wan to run it initially, but only upon some conditions or to the developer's interest in running it.
Any help is appreciated!
Thanks!
No, but you can neuter a test in several ways. Here are a few:
- use "#ifdef _DEBUG" or similar to only enable a test in certain conditions
- check for an environment variable setting on the test machine and skip certain portions of the test if the variable is defined
- write the test but comment it out
Note that the test header and implementation can be defined but a test will not be run if it is not mentioned in the CPPUNIT_TEST() line. You can write tests and disable them by commenting out this one line.