Hello-

 

What is the best practice for embedding test cases into library (versus executable) projects?  I have successfully used the Boost.Test framework to build and create EXE targeted, testing specific (MSVS) projects.  However, much of what I need to unit-test is compiled into a Win32 DLLs, and I would much rather embed the test cases directly within that DLL project code (inside define blocks of course), rather than having to define a separate project to produce an EXE to execute the tests for each DLL.  When I say “I would rather”, it really means my manager demands it.  It appears that the boost.test MACROs nicely obfuscate the normal main()-ish entry point for the testing.  I have searched for information on overriding or extending the kick-off of whatever calls the init_unit_test_suite() so I could write my own custom entry points for testing the DLL as a post-build step, but have not found what I am looking for.

 

So, my question is this… Is there a provided framework for testing code within a DLL project?  And if not, is there a way to kick start the testing from a non-main method (say a custom DLL entry point), and would this strategy work within the confines of Boost.Test?  I believe that other well known unit testing framework (which shall remain nameless) supports such a thing, and I would suspect Boost.Test does also.

 

I apologize if this question is often asked or obviously documented elsewhere.

Thank you for the assistance.