Development Log

  • GNAT Pro | GPS
    Nov 22nd, 2006

    PyGTK: A testing solution for GPS

    The GNAT Programming Studio, AdaCore's IDE, has been enhanced to allow python scripts that use PyGTK's interface to the GTK+ toolkit to interact with it.

    GPS architecture allows the user to interact with the GUI by means of scripts written in either the simple GPS script language or in python. Current versions of GPS offer the possibility, for example, to open a new source editor and move the cursor to the end of the buffer by writing:

    • ed = GPS.EditorBuffer.get (GPS.File ("src.adb"))
    • ed.current_view().goto (ed.end_of_buffer())

    What PyGTK brings is the ability to simulate user-level actions such as mouse clicks or key strokes, to manipulate complex widgets such as GTK's TextView and TreeView, to activate contexual menus, etc.

    This is a revolution as far as GPS testing is concerned because it allows most actions that previously required human interaction to be completely automated. For example, let's assume an action opens a dialog containing an OK button. Simulating a mouse click on it is as simple writing:

    • ok_button.clicked()

    PyGTK allows automatic testing of everything including the most complex GUI aspects such as focus issues, signal handling, etc.