Writing Unit tests for a dynamic Library Project


#1

Hello, 

I'm using the Introjucer to create a JUCE based dynamic library. I want to be able to unittest this and need to create some kind of executable project that will link the dynamic library and run my unit tests. Give than the project type is a top level setting in introjucer, I will have to create the unit-test targets outside of the original JUCE project. I'm open to using any kind of test framework including the UnitTestRunner in JUCE itself but would like the communities opinon on how best to do this.

 

Should I create another JUCE project to run the unit tests, if so how can I link the dynamic library project and make sure that the build dependencies in the Unit test project force a build of the dylib. If you recommend doing this outside of introjucer and JUCE, can anyone recomend a workflow that they are using along with some links or instructions on how to go about doing so ? I'm developing on the MAC but would like to use C++ libs that are as platform portable as possible.

 

Thanks

Kartik

 

 


#2

The simplest way would surely be to put the unit tests in your DLL and just make it export a global function "runUnitTests()" that can be invoked to run them?