ANN: ADEPT (A Declarative, Eval()-based Program Tester)

Phil Pfeiffer
6 Jul 2003 20:20:54 -0700

ADEPT--"A Declarative, Eval-based Program Tester"--is an open source
unit testing tool that allows users to define test cases as tuples--

    # reworking of unittest example from Python unittest doc, 
    # minus initializers and finalizers

    getTest =\
         ( "check default size", eqValue((50,50)), 
           Widget("The Widget").size )
    testWidget = Widget("The widget") 
    setTest =\
         ( "check resize", eqValue((100,150)), "testWidget.size()", 
            testWidget.resize, (100,150) ) 
    testSuite =\
         (("get actions", (getTest,)), ("set actions", (setTest,)))

--and then execute, label, log, and check the tests' results:

    # widgetLogger labels tests, and stores labels and test results
    >>> suite =\
        [("get actions",(getTest,)), ("set actions",(setTest,))]
    >>> widgetLogger = TestLogger()
    >>> doTestSuite(suite, widgetLogger)
    # assumption here: all tests succeeded, hence, no advisories
    >>> widgetLogger.failureCount()
    >>> widgetLogger.successCount()
    >>> widgetLogger.failures()
    # cases could be stored to a list and sorted, if required
    >>> widgetLogger.successes()
    ((2, 1), (1, 1))
    >>> map(widgetLogger.getBanner, widgetLogger.successes)
    ('2.1. set actions: check Widget.resize(100,150)',
     '1.1. get actions: check Widget default size')

The getTest and setTest tuples shown here typify what ADEPT calls "get
actions" and "set actions" tests: checks for a callable object's
returned results and effects, respectively.

*.  The getTest tuple, when evaluated as a "get actions" test, directs
ADEPT to evaluate eqValue((50,50))(Widget("The widget").size()), and
record success iff this expression evaluates to 1 (true).

*.  The setTest tuple, when evaluated as a "set actions" test, directs
ADEPT to execute testWidget.resize(100,150), then record success iff
the expression eqValue((100,150))(testWidget.size()) evaluates to 1.

I wrote ADEPT as a tool for creating succinct, self-documenting test
cases for a large utility that I've been working on since
March--3,000+ test cases, with about 3/4 of the way to go.  I'm
releasing ADEPT because I've appreciated having it, and would like to
get people's impressions of ADEPT--along with suggestions for

ADEPT is at 
This first release includes the following:

-.  a 5 pp. HTML overview of ADEPT's functionality, features, and 
    limitations (

-., ADEPT's source code: 
      about 950 lines of Python, 
      with about 1,000 lines of banners, comments and whitespace

-.  adept.txt, the ADEPT user manual:
      about 40 pp. of text (60 lines x 80 columns), organized as
      -.  an introduction, plus sections that describe
      -.  ADEPT's nine types of tests:  
            get actions, set actions, get+set actions, null actions, 
            error actions, get prop actions, set prop actions, 
            get prop error actions, set prop error actions
          --with comments on strategies for using each kind of test, 
            and a special section on repr string testing.
      -.  ADEPT test indexing.
      -.  additional ADEPT features, including nested test suite 
          execution and the use of AND/OR-tree-like objects to apply 
          multiple predicates to a single test.
      -.  ADEPT's design--including notes on how to add test types, 
          and comments on the tool's limitations.

-., a program that illustrates the operation of the
    examples in the ADEPT manual.

-., a 782-test-case-long validation suite for 
    ADEPT, written in ADEPT.

Phil Pfeiffer/East TN State U. |Kindness in thought leads to wisdom.
Dept. of CIS /P.O. Box 70711   |Kindness in speech leads to eloquence.
Johnson City, TN. 37614-1266   |Kindness in action leads to love (423) 439-5355   |                           -- Lao-Tsu