Home

This project is dedicated to utilities to make Agile Software Engineering, in particular Test Driven Development easier in Tcl.  It has evolved into TIP-452.  This repository shall remain until the TIP is accepted and shipped.

Please do not use the code in this repository, but rather that in the tip's branch.

If you intend to use this in a Tcl version prior to the TIP being accepted and shipped, then t he contents of the  TestSeam.tcl file should be placed in your init.tcl file

The  following commands are added to the tcl test package:

  • ::tcltest::testSetup - Defines which procedures/commands are stubbed out  and how they should behave for each invocation. This should  only be called once per test.
  • :: tcltest::addStub - Adds a procedures/commands  to the list that are stubbed out.
  • :: tcltest::saveVars - Saves the values of variables to be restored later. This should  only be called once per test.
  • :: tcltest::addVars - Add a variable to the list of variables to be restored later
  • :: tcltest::callCount - Returns a dictionary sorted list of the stubbed out  procedures and how many times they were called.
  • :: tcltest::testCleanup - Restores saved variables and stubbed out procedures.
  • :: tcltest::sortedArrayData - Return the values of an array as a list of key value  pairs sorted by the keys.
  • :: tcltest::callProc - Call the real implementation of a stubbed out procedure.
  • :: tcltest::seam - Test seam definition and injection (aka enabling)
  • ::tcltest::testObject - This command creates an instance of an object, runs the specified test against it and then destroys the object.  The syntax is:
 ::tcltest::testObject  name description class ?-options...?

It supports all options of::tcltest::test plus those listed below:
    • -arguments creationArgumentList -- arguments to pass in when creating the object 
    • -constructor script -- override the class constructor with the 
    • -destructor script --  override the class destructor with the 
    • -objectVar variableName -- name to hold the created object, defaults to "cut"
    • -stubs stubDefList -- a list of "instance" methods (those defined in the class) to be "replaced" by the contained definition.  Each element of stubDefList is a duple with the following format:
      • methodName methodBody -- The methodBody will be executed when ever methodName is called instead of the "real" definition.

Supporting Class

::tcltest::object - Class to provide useful object testing utilities

Synopsis

Description

Exported Static Methods

Exported Instance Methods

Acknowledgements

Thanks to Sean Woods for providing major help with the object based extensions.
Thanks to Noumena Corporation for encouragement and for supporting the Tcl community.