Here's an overview of the new framework. It's been designed for
simplicity and speed. Assuming everyone likes the design, I'll start
committing RSN.
Guile Testing Framework for GNU Classpath
GNU Classpath tests are written in Java. Guile is responsible for
executing the tests and organizing the results. Guile and Java
communicate through JNI. If JNI is unavailable, see the section on
modifying the framework to allow for an alternate means of
communication. [This has not been written. -PF]
All tests must implement gnu.test.Test. gnu.test.Test contains two
methods:
1. String getName()
2. Result test()
When getName() is called, your test should return the name of the
test. When test() is called, your test should be performed. Upon
completion of the test (either through success or failure), a Result
object is returned. test() should never throw an exception or error.
There are seven predefined result types, including the POSIX 1003.3
result codes. All result objects may optionally be constructed with a
single String argument specifying additional information about the
result.
gnu.test.Pass : Test passed and was excepted to pass.
gnu.test.XPass : Test passed but was expected to fail.
gnu.test.Fail : Test failed but was expected to pass.
gnu.test.XFail : Test failed and was expected to fail.
gnu.test.Unresolved : Test produced indeterminate results.
gnu.test.Untested : Test was not run -- a placeholder.
gnu.test.Unsupported : Test does not have the required support to run.
Example test:
import gnu.test.*;
public class StringCharAtZeroTest implements Test
{
public getName() {
return "java.lang.String.charAt(0)";
}
public Result test() {
char ch = "foobar".charAt(0);
if (ch == 'f')
return new Pass();
else
return new Fail("zero index of \"foobar\" is '" + ch + "'");
}
}
The testsuite contains a file known as "tests.to.run" which contains a
newline delimited list of all tests to be executed. Just add the
class name of the new test to the file and it'll be included in future
runs of the testsuite.
Running the testsuite:
guile-jvm -s test.scm tests.to.run
Classes are located via the environmental variable CLASSPATH.
Lots of magic happens, tests are run, results are spooled to log
files, and finally summary information is displayed.
--
Paul Fisher * [EMAIL PROTECTED]