PTL - a pretty test language


PTL is a sugary/pretty wrapper over tcltest, a typical looks like:

   Name: expr-1
   Description: Check that number + 0 equal to number
   Result: 6
   Test: {

It is currently being used for testing Wind/Diesel Systems at Powercorp [L1 ] in Darwin, NT, Australia by Phil Maker PJM. An implementation is on PTL: implementation and PTL: implementation -1.


The first question is why bother with a wrapper, just use tcltest; well:

  1. This little rubber duck does not want to write the tests. The moment I show them tcltest the users/engineers eyes glaze over and they look happy saying, "Well, we will just do the specification, Phil, and you can write the tests :-)." They seem to be happy enough with the prettified version above; must be something about too many -,{,} characters scaring them.
  2. The tests (well some at least) need to be written as part of the specifications which are formatted in LaTeX, and it would be nice if they looked pretty in plain text.
  3. Since it's just Tcl and tcltest we can do all those wonderful things such as writing our own control structures, generators, etc. One of the scary ideas was that we should write our own natural-looking test language/suite that would do what we want, the dreaded lollipop.

Beyond the sugar, the following things are required:

  1. Ability to ask/interact with a human being during test, e.g., to ask to open/close a switch or valve. PTL: please
  2. Ability to get a human being to check a result both during a test PTL: check and afterwards PTL: Ask:
  3. Generate some pretty reports which are just hacks to tcltest for now.
  4. And run using after provide some commands which read/write values from devices, control inverter load banks and do other magical things.
   # interactive test that asks the operator
   Name: nice-1
   Ask: is the number a nice number
   Test: { 
     f 100

These things are of course easy, it's just things like allowing for puts being aliased during a test so you have to use something else to get a message out during a test.


  1. Does anyone have any useful proc/methods/hooks for tcltest out there? PJM

Category Testing