I spent the day playing with ways of writing automated tests for UI components, and integrations of UI components.
In the process I also wrote a clone of the Bootstrap Alerts window, a bunch of little utility classes and most usefully a embedded FontAwesome setup for JUCE (this is probably the most useful bit!).
The stuff is on:
Pick it to pieces please! (I have probably missed some useful technique...)
- Automated UI tests are more useful than I thought. I picked up bugs as I was modifying the code just today.
- Labelling of components with ComponentIDs makes it easy to identify basic behaviours.
- It might be useful to navigate the component tree and use dynamic_cast to access otherwise 'private' subcomponents for testing. I've not tried this yet.
- PopupMenu is a pain to test unless you careful expose a handlePopupMenu selection function.
Also, small tweaks to JUCE would help:
- It'd be great if the JUCER could also create a _Tests.cpp file when creating other types of source file.
- It'd be great if the JUCER could create plain text files for other programming languages, scripts and so on.
- And a small thing: The assertion in the UnitTest class is on the wrong line. If something (horrible) could be done with macros to make the assertion actually happen in the UnitTest that would be great. It may not be a problem when your tests are usually passing - but when you've got lots of them and they break often it's a pain to have to hit the call stack each time...
Next up - automated audio tests ;-)