Documentation for 3.9.1
Other versions: trunk  3.27  3.26  3.25  3.24  3.23  3.22  3.21  3.20  3.19  3.18  Older...

Automatic Failure Interpretation in TextTest

Introduction
There are situations when it saves a fair bit of time to inform TextTest about what your system is likely to log and what it means. This means that TextTest can find such patterns automatically and instead of just saying “differences in output” can provide you a much more succinct description of what went wrong. TextTest can also automatically try to collect information about what happened from the system: for example core files that have been dumped on UNIX. This document aims to give a guide to how TextTest can interpret failures at a higher level than file differences.
Collecting Core Files (UNIX)
This will just happen. Each test is run with a unique temporary directory as the current working directory. This means that TextTest will pick up any core file written there and try to extract the stack trace from it. If it succeeds, it will report the test as having “CRASHED” and display the stack trace in the “Text Info” window.
Since version 3.7, it does this by using an external script “interpretcore.py” which outputs stack traces given core files. It has been tested on quite a few flavours of UNIX : HPUX-11, powerpc, Sparc Solaris and Linux RHEL3, RHEL4 and seems to be quite portable (much more so than the old code that was part of TextTest until version 3.6) This script is plugged in by default via the default value of the “collate_script” entry on UNIX.
It is provided as standard with TextTest, but can clearly also be used externally to TextTest. It works by using the standard debugger 'gdb'. If it fails to find the stack trace for any reason the test will still be reported as “CRASHED” but the reason for failure will be given in the “Text Info” window instead.
Known Bugs : associating logged text patterns with a summary description
(Note that the “internal error” mechanism used in TextTest 3.7 and earlier is now removed. The known bugs mechanism now supports everything needed. For migration help, see the migration notes in the download)
It can be useful to associate a succinct problem description with the appearance of certain logged text. For example, your application may well report “Internal Error!!!” when something bad happens. In this case you could tell TextTest about this so it can describe such a test failure as an Internal Error and save you the trouble of reading the log file.
Another common usage, as the title hints, is for known bugs in the system under test. This may be needed because the bug appears only intermittently, or because time has not yet been found to fix it even though its presence is known. In either case, telling TextTest about it can prevent lots of people examining lots of failed tests in order to discover the same issue again.
The easiest way to do this is by using the dialog in the static GUI. Select the test or testsuite where the bug should apply (for example, if it applies everywhere, select the root test suite) and go to the Bugs tab.



Here we imagine that when our application logs “after <n> seconds” this implies it has gone into a delay that isn't appropriate. So we fill in the Bugs tab appropriately with the text to match, and some description information, a full text to give and a short description. This creates a special file “
knownbugs.<app>
” in the test or suite's directory, which has a format that is easy to edit in a normal editor.
If we then run the test and it produces the indicated text, we then get a nice summary instead of the usual complete file differences. Note it has used our “brief description” given above in the Details column of the test tree view, while the full description appears in the Text Info window at the bottom right.



Extracting information from bug systems (e.g. Bugzilla)
If you have a bug-tracking system with a command-line interface, you can probably get it to talk to TextTest without very much effort. Instead of providing textual descriptions you can then just provide the bug ID from the bug system and TextTest will extract the (current) information for you. It will try to determine whether the bug has been fixed (closed in the bugsystem) and if so it will be reported as “internal error” rather than as “known bug”, as it is expected the bug text would not continue to occur if the bug had been closed.
If you use bugzilla to track your bugs, there is a plugin already written and bundled with TextTest. For this to work, you also need to install the “bugcli” program. This is essentially a CGI script that runs on the bugzilla server and provides information about bugs via system calls rather than as usual via the browser.
If you don't, or want to use something other than “bugcli”, copy the “bugzilla.py” module from the TextTest source and change it to provide the relevant methods for your bug system. By providing the name of the module in the bug system field when reporting the bug, it will load this module and extract the relevant information.


Last updated: 05 October 2012