Qt Monkey is a tool to automate testing of Qt-based applications (widgets only). It automates creation/modification and running of the tests. Tests are written in Javascript (Qt supported dialect).
To write your tests, simply run your application (instrumented by Qt Monkey) and click on widget, input text, etc. As a result, a script in Javascript will be generated (see https://github.com/Dushistov/qt_monkey/blob/master/tests/test1.js for example).
After that you can add suitable asserts and run this script via command line or GUI tool.
Qt Monkey requires compiler with C++11 support and Qt 4.x or Qt 5.x.
First, download and build Qt Monkey:
git clone --recursive https://github.com/Dushistov/qt_monkey.git
cd qt_monkey
cmake -DQT_VARIANT="qt5" .
cmake --build .
Also you can use -DQT_VARIANT="qt4" for building with Qt 4.x. Then, integrate Qt Monkey agent into your application:
- Make sure that you link your application with qtmonkey_agent library
- Create object of class
qt_monkey_agent::Agent
in the main thread of your application:
qt_monkey_agent::Agent agent;
That's all. Now you can run qtmonkey_gui application and record or run your own scripts. See https://github.com/Dushistov/qt_monkey/blob/master/tests/test_app/main.cpp for the more complex usage example.
Qt Monkey consists of three parts: Qt Monkey's agent library (qtmonkey_agent), qtmonkey_app (tool that run test application and cooperates with agent) and qtmonkey_gui. qtmonkey_app and qtmonkey_gui use json as their preferred data marshalling language and communicate via stdin/stdout streams. Therefore you can easily replace qtmonkey_gui with a plugin for your favorite IDE.