I’m developing audio plugins using JUCE, and I’d like to do some unit testing, ideally using bandit if possible, though if it’s much simpler to get what I want using JUCE’s own unit test stuff I’m open to giving that a go.
I want to be able to do the following:
- Compile and run tests (and the classes they test) quickly for fast feedback
- Write and run the tests on any platform
- Retain the ability to modify and re-save my project in the Projucer without having to do anything custom each time (e.g. adding new build targets in Xcode)
I’m familiar enough with C++ as a language, but don’t have all that much experience building projects that are any more than just a few small files with no library dependencies.
I can basically see two possible approaches to this:
Taking OS X as an example, I could add a new “Test” build target to Xcode which could include bandit, JUCE, etc. I’d have to do the same for VS on Windows, and add stuff to the Linux Makefile too if I wanted true cross platform development. This seems like a pain. Also, I’m not even sure if it’s possible to prevent the Projucer from overwriting that stuff every time I change a setting in there and re-save. Is that possible? If not, it more or less rules out this approach for me.
Create small test program (similar to what’s described in Unit test fixture requirements?) and write a Makefile (maybe a Makefile per OS) just to build and run my tests. Hopefully I could keep this fairly small and simple, and not have to worry about the Projucer stomping on anything. This feels to me like it should be able to offer to possibility of faster feedback times through having more control over what I need to compile, though that may be a wrong assumption.
2 seems like a winner to me, but I’m having a hard time compiling and linking the right JUCE modules with my tests and my other classes (something similar to Xcode Test Target - Linker errors, missing headers). I can post some code and my Makefile and ask for some help on that, but before I spend more time on it I’d like to understand if this is even a sensible approach. If not, why not? What’s a better approach? What am I missing?
Links to any examples of any code that’s doing focused and fast BDD using JUCE would be most welcome.