SampleApplication.zip ( Please update the boost include and lib paths in project settings. )
Tweeking startup code
- Supported OS: Windows and Unix - compatible OS
- Tested on boost 1.47
c:\Naveen\tmp>UnitTestApp.exe --dist_tc=5The above command will start one parent UnitTestApp.exe and 5 child UnitTestApp.exe , each executing one test case at a time. Here is how it looks in process explorer.
Once a child application finishes the unit test case assigned to it, the child process exit by itself and another child application is spooled by the parent to execute the next TC. Please note that this option is incompatible with --run_test option. if --run_test is specified, --dist_tc option will be ignored.
Under the Hood
- When application starts, it traverse though all test case in the application and create a list of test cases.
- For each test case in the list, invoke child process with an additional --run_test option specifying the test case name.
- Redirect the console output of child process back to the parent application and print it.
FilesThere are 3 files in this source
- unit_test_main_parallel.hpp - Main header file that you need to include.
- unit_test_main_unix.ipp - unix specific code.
- unit_test_main_win.ipp - windows specific code.
Since Windows doesn't support POSIX API's, I had to write separate implementation for windows OS's. The unit_test_main_parallel.hpp will choose one of the .ipp file depending the platform in which it is getting compiled.