What is TextTest?¶
TextTest is a tool for automated testing of programs written in almost any programming language. It can be used for unit testing, but is more often used for functional testing of larger pieces of code.
When to use TextTest¶
TextTest is often used to test:
- Batch systems (long running programs with a command line interface)
- Legacy systems (Approval testing works especially well when the system is already built)
- Rich Client applications (in combination with a GUI-recording tool, StoryText)
- Components in a Service-Based architecture
- Command line programs and scripts (in combination with CaptureMock)
At present TextTest is rarely used to test web applications, there is limited support for this.
How it works¶
TextTest can test a program written in any programming language, so long as it can be executed from the command line.
Tests are defined in a directory structure:
+- Test Suite Name +- config.<app> +- testsuite.<app> | +- A Test Case Name | +- options.<app> | +- stdout.<app> | +- stderr.<app> | +- A Second Test Case Name | +- options.<app> | +- stdout.<app> | +- stderr.<app>
In this root test suite folder, there is a config file, a test suite file, and some test case folders. The name of the test case folder is used as the name of the test case. Test case folders contain files which are given as input to the system under test, and “golden master” files containing the approved (expected) output.
TextTest uses an “Approval Testing” approach, which means that when you run a test, it will compare the actual output of your program agains the saved “Golden Master” files in the test case folder. If there is a difference in the output, the test fails. TextTest gives you the opportunity to update the “Golden Master” when this happens.
All files that relate to a particular tested application share the same file suffix. You configure the value of <app> when you first create a test suite.