I'm using cppunit for the unit tests of my project.
And I m wondering if the cppunit launch each unit test in a new fork() system call because:
I defined a global variable and then I tried to change the global variable in the unit test and change that has no affect in the parent process but unfortunally I found that global variable is changed.
So by default cppunit does not support launching unit test with fork(). And I m wondering if there is macros in cppunit that could initiate unit test with fork() ?
My tests are defined in the following way:
class MYTest : public CppUnit::TestCase {
CPPUNIT_TEST_SUITE( MYTest );
CPPUNIT_TEST( getRetryValueTest );
CPPUNIT_TEST( getRetryValueTest2 );
CPPUNIT_TEST_SUITE_END();
public:
virtual void setUp();
void getRetryValueTest();
void getRetryValueTest2();
};
Cppunit does not use fork to separate tests. However tests in the same suite are separate objects so each test has its own set of variables and are therefore independent from each other and can't influence each other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With