ClarionTest
DCL to CML changes under way
We've copied the DCL docs to this new location and are still in the process of scrubbing the pages and fixing all the text and links. If you notice anything amiss feel free to please post a comment at the bottom of the page. Thanks!
The CML includes binaries and source code for ClarionTest, an automated test runner loosely patterned after .NET unit testing tools like nUnit.
You create your tests as procedures inside a special DLL, then you point ClarionTest at your test DLL. ClarionTest loads up your DLL, locates all the test procedures, and then gives you the option of running some or all of those tests.
ClarionTest components include:
- The ClarionTest.exe test running utility
- A global template which must be added to each test .APP you create.
- A set of procedures to facilitate unit testing, including:
- AssertThat
- SetUnitTestFailed (usually only used if AssertThat isn't applicable)
- IsEqualTo (usually used as a parameter to AssertThat)
- IsNotEqualto (usually used as a parameter to AssertThat)
- A test procedure template
- A group procedure template
Running tests
There are several ways to execute unit tests. One is to have ClarionTest execute them automatically after each build. To do that you add a post-build command to the project:
ClarionTest.exe appname.dll /run
You may need to specify the absolute or relative path to ClarionTest for this to work. The /run parameter tells ClarionTest to execute all the tests immediately.
When I first created ClarionTest I used the /run approach almost exclusively. But lately I've gone away from that technique in favor of leaving ClarionTest running and letting it monitor the directory for DLL changes. That way I can select individual tests and have just those tests re-run every time I make a change.
Other info
For an example of how to use ClarionTest see The Problem with Embeds, Part 3: Testing the TXA Parser.
For an explanation of how to create test apps seeCreating a ClarionTest test DLL.