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
It can alternatively be specified by the environment variable $GETEST_CONFIG:
setenv GETEST_CONFIG filename getest
(setenv is the way to set environment variables with C-shell, please use the command provided by your favorite shell or operating system.) There are also some shorthands such as:
getest --hact getest --ise getest --se getest --ve
which are equivalent to:
getest getest.hact getest getest.ise getest getest.se getest getest.ve
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 -no_split -no_style_warning MY_TEST") 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.
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_. 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_. 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 not create this directory if it does not exist. So one has to make sure that this directory exists before executing getest.
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. It can be either a direct call to the Eiffel compiler executable, a call to a script or use a Makefile. 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 "compile MY_TEST", where MY_TEST is the root class of the test suite generated by getest. This instruction invokes the SmallEiffel compiler.
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", where my_test is the name of the test suite specified in the test section. But it can easily be changed to "cd EIFGEN/W_code; ./my_test" when using the ISE Eiffel compiler for example.
Copyright © 2001, Eric
Bezault mailto:ericb@gobosoft.com http://www.gobosoft.com Last Updated: 15 April 2001 |
![]() ![]() ![]() ![]() |