gb.test

该组件实现了一个用于单元测试和测试驱动编程的框架。

有了这个组件,您可以在测试驱动的情况下开发软件(先编写测试,然后编写程序功能),并且您能够确保在重构时代码的期望结果保持不变。

测试输出为 TAP 以便与任何 Tap consumer 一起显示、分析或查看。由于每个输出的末尾都有一个摘要,最后一行有字符串 "PASSED" 或 "FAILED" ,因此您甚至可以查看控制台输出来决定测试是否成功。

作者 Christof Thalhofer, Tobias Boege, Benoît Minisini.

说明
Assert This module extends the Assert instruction, which checks that Expression is TRUE, and if the Expression is FALSE, an uncatchable "Assertion failed" error is raised, the PRINT or ERROR instruction is executed, and the program stops immediately.
Test The class Test is the central class which orchestrates the execution of tests and also gives a couple of tools to manipulate running tests.
TestAssertion This class represents an "ok" or "not ok" line in TAP. It is generated by TapPrinter and TapParser.
TestCommand The class TestCommand stores the names of a testmodule and optional tests to be executed. It also contains methods to translate testcommands to string and vice versa.
TestRunner Lists tests, Run tests, parse output and collect statistics.
TestStats

For a brief description look at Gambas 单元测试