4Suite™ API Documentation

# ► Module Ft.Lib.TestSuite.Tester

Provides the Tester class, which is the hub for all testing.

    Copyright 2004 Fourthought, Inc. (USA).
    Detailed license and copyright information: http://4suite.org/COPYRIGHT
    Project home, documentation, distributions: http://4suite.org/

Classes: TestItem, Tester |  |  |  | Functions: extract_stack, format_stack |  |  |  | Globals: SHOW_GROUPS, SHOW_TESTS, VERBOSE_DEBUG, VERBOSE_ERROR, VERBOSE_MSG, VERBOSE_OFF, VERBOSE_WARN

## Classes

class TestItem

  ### Methods

  __init__(self, title)
  __repr__(self)
  debug(self, msg)
  error(self, msg)
  finish(self)
  message(self, msg)
  warning(self, msg)
class Tester

  ### Methods

  __init__(self, stopOnError=1, useColor=1, verbose=4, stream=<open file '<stdout>', mode 'w' at 0xb7d98068>)
  compare(self, expected, actual, msg=None, func=<built-in function cmp>, diff=0, stackLevel=1, funcArgs={})
    Uses func to compare the expected result with actual result of a regression test.

        diff is ignored.

        msg is an optional custom message to print if the
        comparison tests positive (i.e. the results differ).

        func is the comparison function to use, and must be a
        function that returns the same as the built-in cmp().

        stackLevel affects exception reporting.

        funcArgs is an optional dictionary of keyword arguments that
        will be passed to the comparison function, if the dictionary
        is not empty.

  compareIn(self, expected, actual, msg=None, stackLevel=1)
    Test that 'actual' is in 'expected'
  debug(self, msg)
    debug-level messages
  error(self, msg, traceLimit=1, stackLevel=1)
    error conditions
  exception(self, msg)
    system is unusable
  groupDone(self)
  message(self, msg)
    informational
  report(self)
  startGroup(self, title)
  startTest(self, title)
  testDone(self)
  testException(self, func, args, etype, value={}, stackLevel=1, kwargs={})
  warning(self, msg)
    warning conditions
  writeline(self, level, msg)

  ### Members

  BROWN = '\x1b[33m'
  GRAY = '\x1b[1;30m'
  GREEN = '\x1b[1;32m'
  NORMAL = '\x1b[0m'
  RED = '\x1b[1;31m'
  WHITE = '\x1b[1;37m'
  YELLOW = '\x1b[1;33m'
  double_sep = '========================================================================'
  single_sep = '------------------------------------------------------------------------'

## Functions

extract_stack(frame=None, limit=None)
format_stack(frame=None, limit=None)
  Shorthand for 'format_list(extract_stack(f, limit))'.

## Globals

SHOW_GROUPS = 1
SHOW_TESTS = 3
VERBOSE_DEBUG = 4
VERBOSE_ERROR = 1
VERBOSE_MSG = 3
VERBOSE_OFF = 0
VERBOSE_WARN = 2