Is there any recommened Tools/testing framework available to test JUCE GUI? I couldn’t find more information related to this.
What aspects of the GUI do you want to test?
I’ve not come across a good solution for injecting mouse and keyboard events directly, but it’s relatively straightforward to check the overall visibility of any components at any time. You can also take screenshots of components and test individual pixels.
Button also has a triggerClick() method which you can use to simulate mouse clicks on them.
Unfortunately, I don’t think other widgets provide similar methods to simulate interactions.
Perhaps, if feasible, a better approach could be to have a generic way (free functions?) to simulate gestures on a given
Component, by injecting
MouseEvents on them.
void triggerClick (Component& c); void triggerDrag (Component& c, Point <int> displacement);
Each of those functions may also be parametrized with more stuff like duration of the gesture, modifier keys, etc.
For triggerClick to work, we need an instance of the button which we would like to click
Getting the instance of button seems to be difficult…
Still, if you saw Ableton’s lecture I’m not sure how much automated UI tests are worth at least those days. especially with plug-ins where your entire threading and callbacks can be so different between hosts.
I am interested to see what can be done. Currently user-based testing following a script takes of the order of 8 hours to complete for an application I am working with. So having a mechanism that can at least set up each test condition for a human user to evaluate would significantly reduce this time.
I am wondering if a recording mechanism could be set up via MessageManager::dispatchNextMessageOnSystemQueue whereby events could be recorded during a session and played back.
- Timer events need filtering out as the app. will be creating them itself and we do not want them to count twice.
- Window handles will change between sessions - so a means is needed to convert window handles during the recording session to window handles during the replay session.
Has anyone considered this or a similar approach? A JUCE-centric coded UI testing framework would be good to have in the toolkit.