Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.

Register a cpp unit test, but not run it?

  • Daniel

    Daniel - 2013-01-14


    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!


  • Bitwise

    Bitwise - 2013-01-16

    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.


Log in to post a comment.