This directory contains a tutorial for tcltest.
There are also Unit Tests for the fnest package and related programs.
Check if tcltest is installed
Normally tcltest is installed with Tcl, but the check is easy:
echo package require tcltest2 | tclsh
No output : good to go
Error message : can't find package tcltest - Check your installation.
tcltest - run a single test in a file, using -match
./fcgi.test -match fcgi-20
tcltest - troubleshooting
Solution to error when running <MY_SUBDIR>/all.tcl from parent directory:
From the CREATING TEST SUITES WITH TCLTEST section of the tcltest man page:
https://www.tcl.tk/man/tcl/TclCmd/tcltest.html#M122
Here is a sketch of a sample test suite main script: package require Tcl 8.6 package require tcltest 2.5 package require example ::tcltest::configure -testdir \ [file dirname [file normalize [info script]]] eval ::tcltest::configure $argv ::tcltest::runAllTests
Alternative:
package require tcltest 2.5
namespace import ::tcltest::*
set TCLTEST_DIR [file dirname [file normalize [info script]]]
configure -testdir $TCLTEST_DIR
runAllTests
Links
Man page: https://www.tcl.tk/man/tcl/TclCmd/tcltest.html
Tutorial:
- Part 1: Getting started with
tcltest - Part 2: Multi-Module Test Suite
- Part 3: Include and Exclude Tests
- Part 4: Constraints
- Part 5: Capture the Standard Output
- Part 6: Test for Error Conditions
- Part 7: Inexact Result Matching
- Part 8: Recursive Test Suites
- Part 9: Provides Exit Code
Other tutorials: