Configuration File PreviousNext

The configuration file is what helps getest to run properly. It contains information about the classes and features to be used to run the test suite, the Eiffel compiler to use, etc. The configuration filename is typically passed on the command-line to getest:

getest filename

Other ways to specify the configuration filename are described in the command-line options section.

Configuration Syntax

Following is a typical configuration file. Comments follow Eiffel style conventions and have no effect on the configuration's semantics.

test

    my_test

default

    class ("TEST_[A-Z0-9_]*")
    feature ("test_[a-z0-9_]*")
    prefix ("X")
    testgen ("TESTGEN")
    compile ("gec ge.xace")
    execute ("my_test")

cluster

    test_dir:     "$GOBO/test/my_test"
    other_tests:  "$GOBO/test/my_test/other"

end

The various clauses of the configuration file are used during the three phases of the execution of getest: preparing the test (generating the test classes), compiling the test program and finally running it.

Preparing Test Cases

The section test specifies the name of the test suite. In this example it is called my_test. This name is used as the class name of the root class of the generated test program. This root class is generated by getest and its creation procedure is called make. In order to generate the classes necessary to run the test, getest parses the files with a suffix .e in the directories specified in the cluster section. The default behavior is to parse the current directory. When it finds an Eiffel class, getest checks whether its name matches the regular expression specified in the class clause of the default section. If it does then getest interprets this class as a test case class. The default regular expression for test case class names is "TEST_.*", in other words class names with the prefix TEST_. This clause can be overriden by getest's command-line option --class=<regexp>. The new way of writing test cases is to make sure that the class declares make_default inherited from TS_TEST_CASE as creation procedure. For backward compatibility, for each found test case class that appears to be deferred getest will generate a new class inheriting from this former class with make_default as creation procedure. Each test case class defines a series of individual test procedures identified by feature names matching the regular expression specified in the feature clause of the default section. The default regular expression for the feature names is "test_.*", in other words feature names with the prefix test_. This clause can be overriden by getest's command-line option --feature=<regexp>. Note that since Eiffel is a case-insensitive language, regular expressions specified in the configuration file are also case-insensitive.

We already saw that getest generates the root class of the test suite program with the name specified in the test section. The new classes generated after the test case classes (when deferred, as explained above) will have names derived from these former classes by adding the prefix specified in the prefix clause of the default section. For example if a test case class is named TEST_FOO, then the generated class will be named XTEST_FOO. The default value for the prefix is "X". All new classes are generated in the current directory by default. The behavior can be changed by specifying another directory name in the testgen clause of the default section. Note that getest will try to create this directory if it does not exist yet.

Compiling Test Cases

Getest can be used with all Eiffel compilers supported by the Gobo Eiffel Project. Therefore the clause compile of the default section is used to specify the command-line instructions of the Eiffel compiler chosen to run the test. This clause can be overriden by getest's command-line option --compile=<command>. It can be either a direct call to the Eiffel compiler executable, a call to a script or use a Makefile and geant build file. It can also redirect its output to a temporary file to avoid too much noise on the screen. The default value for the compile clause is "geant compile", or "geant compile_<compiler>" where <compiler> stands for either ge, ise or se if getest has been invoked with the option --ge, --ise or --se.

Running Test Cases

After the generated test suite program has been compiled, getest executes it using the command specified in the execute clause of the default section. By default the value of the execute clause is "./my_test [-D name=value]*" (or ".\my_test.exe [-D name=value]*" under Windows), where my_test is the name of the test suite specified in the test section and [-D name=value]* are the variables defined on the command-line. But it can easily be changed to "cd EIFGENs/my_test/W_code; ./my_test" when using the ISE Eiffel compiler for example.


Copyright 2001-2008, Eric Bezault
mailto:
ericb@gobosoft.com
http:
//www.gobosoft.com
Last Updated: 13 February 2008

HomeTocPreviousNext