Developers/System Tests

From Dyna
Jump to: navigation, search


How to write a test case

Store your test and run it

Say you have foo.dyna and the corresponding C++ driver code foo.cpp. You want to use them to make a test case.

Now there are two things you have to do:

  • store them in a subdirectory of your choice under dyna/test/. You can take one of the existing ones, like misc/, or create your own one. It can be a deeply nested subdirectory if you want. The following description assumes that you choose the directory dyna/test/misc.
  • create a file dyna/test/misc/ It should have nothing but the following content:
NAME = misc/
include Makefile

The relative path misc/ serves as name of your test.

Now, change up to the dyna/test/ directory and run your test from there using the following command:

make -f misc/ run

Create expectation files and add test to CVS

If it runs as you intended (that might include a normal execution, but also any kind of intended failure that you wanted to test) you have to create the files that describe which stdin/stderr/exit code values etc are expected from this test:

./ misc/

It might say "Nothing to do for all" which is okay. The expectation files are now created.

Finally add it to the CVS repository with the following command, using as arguments the files you originally created. The Makefile and all expectation files are automatically added, too.

./ misc/foo.cpp misc/foo.dyna

That's it!

The test will always be run with make test from the dyna root directory, and be listed in the weekly build e-mail. You can also run it yourself from the dyna/test directory with

 ./ -t misc/

P.S.: You can also write fancier makefiles if you want to test something specific in the pipeline, do not have a C++ driver program, your driver program runs with certain arguments etc. For this purpose, have a look in one of the existing *.mk files under dyna/test/.

P.P.S.: The .mk extension is optional in almost all cases: you can leave it out in the NAME variable in and in the argument for, and

Personal tools