Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
This is now an archive web site.
Some is still relevant as at February 2026 but some is purely of historic interest.


Lisa and I (Graham) are now fully retired from IT training.We have made many friends over 30 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Apache, Linux and Solaris/SunOS too. Our training notes are out of date, but with upward compatability some examples remain operational and relevant. You are welcome to make use of them "as seen", at your own risk. We now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We remain active, enjoying the times that we are retired but still healthy enough in mind and body to do things!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Test framework for TCL - Tcltest - some examples (written 2015-03-11)

Tcl ships with the tcltest test suite / harness - and standard advice for coding is to write lots of tests and check with them every time you run your code.

There's a (new) first example [here] - loading in Tcltest and defining 3 tests:

  package require tcltest
  
  tcltest::test 001 {Hello test world} {
    expr 7 * 9
  } 63
  
  tcltest::test 002 {A test that will fail} {
    expr 7 * 10
  } 64
  
  tcltest::test 003 {Alternative formatting} \
    -body { expr 7 * 10 } \
    -result {70}


Other examples ...
Using setup and cleanup blocks - [here]
Running all the tests in a dirctory [here]
Running only if certain constraints are met [here]
(written 2015-03-11)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Q456 - Object Orientation and General technical topics - Test Driven Development and Behaviour Driven Development
  [4326] Learning to program - comments, documentation and test code - (2014-11-22)
  [4336] Test Driven Development - a first example of principle in C - (2014-12-01)
  [4346] A behaviour driven example of writing a Java program - (2014-12-09)
  [4374] Test driven development, and class design, from first principles (using C++) - (2014-12-30)
  [4380] Behaviour Driven Development / Ruby and Cucumber - (2015-01-02)
  [4387] Regression Testing my website - Cucumber and Watir - (2015-01-07)
  [4542] The principle of mocking - and the Python Mock package - (2015-10-17)
  [4634] Regression testing - via a very short C testing framework - (2016-01-29)
  [4652] Testing new algorithms in PHP - (2016-02-20)

T249 - Tcl/Tk - The Tcltest Package

Back to
Objects in Tcl - iTcl - updated first steps example
Previous and next
or
Horse's mouth home
Forward to
A new Tcl/tk example - a window to show system status
Some other Articles
Reading from a URL, and reading Json, from your Tcl script
Using Object Oriented Tcl and the Tk toolkit together - real life example
Managing the window size (and layout) in Tcl/Tk
A new Tcl/tk example - a window to show system status
Test framework for TCL - Tcltest - some examples
Objects in Tcl - iTcl - updated first steps example
Working out distance between places, using OS grid references and a program in Tcl
Everything is a string - even a list
Tcl variable names - no real limits!
Binary data handling - Python and Perl
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. So much so, and it's so long ago that we are retired

Link to Ezine home page (for reading).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2026: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: +44 (0)1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net

PAGE: https://www.wellho.info//mouthwork/4457_Test-framework-for-TCL-Tcltest-some-examples.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb