Self-testing code
Appearance
Self-testing code is software which incorporates built-in tests (see test-first development).
In Java, to execute a unit test from the command line, a class can have methods like the following.
// Executing main
runs the unit test.
public static void main(String[] args) {
test();
}
static void test() {
assert foo == bar;
}
To invoke a full system test, a class can incorporate a method call.
public static void main(String[] args) { test(); TestSuite.test(); // invokes full system test }
See also
This article has not been added to any content categories. Please help out by adding categories to it so that it can be listed with similar articles, in addition to a stub category. (July 2007) |