Configuration File |

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 ("compile se.ace")
>         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>`. For each test case class found getest will generate a new class inheriting from this former class and equipped with testing facilities. Furthermore 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 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 noice on the screen. The default value for the `compile` clause is `"geant compile"`, or `"geant compile_<compiler>"` where `<compiler>` stands for either `ise`, `se` or `ve` if getest has been invoked with the option `--` `ise`, `--` `se` or `--` `ve`.

## 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 EIFGEN/W_code; ./my_test"` when using the ISE Eiffel compiler for example.