Library with widgets for Gtk+ widget tests
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Library with widgets for Gtk+ widget tests

Using in your Project

In order to use GtkTester in your project you should add unit tests support, using GLib Test suite is a good idea. May you want to check at GXml project to find how in Vala.

Is not limited Vala projects

Vala provides a set of C API you can use, but is your choice.

Setup your test case

First create an instance of your widget and an instance of Gtkt.WindowTester, then set your widget to "widget" property in tester window.

At this momment you can call (), Gtkt.WindowTester will be initialized and showing your widget as a child. After 1 second, window will be destroyed automatically. It is useful to find if your widget is initialized correctly and can be attached to other containers.

Setup basic interactive tests

Once you have make initial setup of your widget, this includes to any stuff like load files and make any calculation to be set to your widget, may you want to interact with it and check if is responding according your expectetions.

Make sure your widget have public API you can use to setup it or get data to check against.

Set Gtkt.WindowTester.waiting_for_event = true, then (), your test window will be shown until you close it manually or testcases are finished. This will help you to check manually if information shown correspond with the one you set by your widget's API.

Testing signals

run() method is automatically called when WindowTester is shown, running() signal is emitted at this time. This method calls next_test() to setup your test case information, like title and description, set them using add_test().

Once setup is finished, you can connect a handler to initialize() signal, then you can setup your test case, make sure you use current_ntest property to know test number to setup. Once finished may you want to call check() signal, then in there and test number, check conditions in your widget.


WindowTester will have access only to public API in your widget, so add them in order to check (by assertions may be), if currect information or actions are taken.