I'm using Boost.Test for Unit testing and am currently running various mock servers in separate threads which get launched from within each test. In order to more accurately test my code the mock server's should really be in separate processes.
I was thinking about doing something along these lines:
MY_TEST()
if (fork() == 0) {
runMockServer(); // responds to test requests or times out, then returns
exit(0);
}
// Connect to MockServ and Run actual test here
END_TEST()
but I'm worried that this will screw up the testing framework.
Is this safe? Has anyone done something like this?
I'm using Boost 1.34.1 on Ubuntu 8.04 if that matters.