OOF: Finite Element Analysis of Microstructures

gtklogger

[Introduction] [Download and Install]
[Documentation] [Example]
[Changes]


Introduction

gtklogger is a Python module for recording (capturing) and replaying a session of a program with a graphical user interface written with PyGTK. It was developed as part of OOF2, a program for computing the properties of materials with complicated microstructures, but it can be used with any PyGTK program. gtklogger is somewhat similar in spirit to PyUseCase, but the implementation is very different.

gtklogger enables a test suite to be written for the user interface of a PyGTK program. A PyGTK program that imports gtklogger and has been suitably modified can record a user session in a log file. Tests can be added to the log file, and the file can be replayed by the program. If the file plays to completion and passes the tests, the program is working correctly (or, at least, not known to fail).

The modifications to a program that are required by gtklogger are not onerous, and do not interfere with normal operation of the program. They are thoroughly explained in the documentation and illustrated in the example.


Download and Install

Please note the following Disclaimer and Copyright notice:

This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance. However, to facilitate maintenance we ask that before distributing modified versions of this software, you first contact the authors at oof_manager@list.nist.gov.

  1. Click here to download gtklogger version 1.1 (22 KB).
  2. The downloaded package is a compressed tar archive. If your browser didn't unpack it for you, unpack it like this:
    % tar -xzf gtklogger-1.1.tar.gz
    This will create a directory called "gtklogger-1.1"
  3. cd to that directory.
  4. Install gtklogger by typing:
    % python setup.py install
    to install it in the standard location for python packages (you will need root privileges), or
    % python setup.py install --prefix=otherdir 
    to install it in otherdir. You will need to have write permission in otherdir and will need to place otherdir/lib/python2.x/site-packages in your PYTHONPATH (for an appropriate value of 2.x).

Documentation The documentation for gtklogger is available as a pdf file (166 KB). There is also extensive documentation in the source code and in the accompanying README file.

Example

A simple PyGTK program called gtkloggerdemo.py demonstrates how to use gtklogger. The program files contain a multitude of comments describing how the original program was modified. It can be downloaded as a gzipped tar file here (6 KB). Unpack it with

% tar -xzf gtkloggerdemo.tar.gz
To run the program without logging, simply run
% cd gtkloggerdemo
% python gtkloggerdemo.py
To record a session into a file called logfile, instead type
% python gtkloggerdemo.py --record=logfile
To replay a recorded session from logfile, type
% python gtkloggerdemo.py --replay=logfile
To re-record a session from logfile, type
% python gtkloggerdemo.py --rerecord=logfile


Changes
1.1 ComboBoxes are now logged by content, not row number, if possible. This means that adding new entries to a ComboBox won't invalidate old test scripts.
1.0 Initial release.