README_TESTS.md 1.7 KB
Newer Older
František Haas's avatar
František Haas committed
1 2 3 4
Overview
========

Tests are implemented using JUnit. There are classic unit tests that are
Lubomir Bulej's avatar
Lubomir Bulej committed
5 6
located in the `ch.usi.dag.disl.test.junit` package and complex tests in the
`ch.usi.dag.disl.test.suite` package that invoke all parts of the framework
František Haas's avatar
František Haas committed
7 8
(client, server, ...) and verify computed results.

9
All tests are executed by running
10

Lubomir Bulej's avatar
Lubomir Bulej committed
11
```
12
$ ant test
Lubomir Bulej's avatar
Lubomir Bulej committed
13
```
František Haas's avatar
František Haas committed
14

15

Lubomir Bulej's avatar
Lubomir Bulej committed
16 17
Properties given on the Ant command line starting with `-Ddisl.`,
`-Ddislserver.`, and `-Ddislreserver.` are passed to the test.
18 19 20 21 22


To use the tests for debuging purposes during development, a single test
suite (for example, "after") can be executed by running

Lubomir Bulej's avatar
Lubomir Bulej committed
23
```
24
$ ant test -Dtest.name=after
Lubomir Bulej's avatar
Lubomir Bulej committed
25
```
František Haas's avatar
František Haas committed
26

27

Lubomir Bulej's avatar
Lubomir Bulej committed
28
To save the outputs produced by the test suites, add `-Dtest.verbose=true`
29
to the Ant command line.
František Haas's avatar
František Haas committed
30

31 32
The tests can be also run directly from the command line. To obtain the
command lines used by the test runner to execute the individual JVMs, add
Lubomir Bulej's avatar
Lubomir Bulej committed
33
`-Dtest.debug=true` to the Ant command line.
František Haas's avatar
František Haas committed
34

35 36 37 38

Implementation
==============

39
Implementation is a bit tricky in few aspects.
40 41

Firstly, building of suite test apps and instrumentations is handled by a
Lubomir Bulej's avatar
Lubomir Bulej committed
42 43
scripted target that lists all directories in a `ch.usi.dag.disl.test.suite`
package, and produces `app` and `inst` jars for each suite.
44

45
Secondly, when running the instances of client and server using Process API,
František Haas's avatar
František Haas committed
46
never forget to clear environment variables as inherited classpath could cause
47
serious trouble.
48

49
The manifest file in the instrumentation jars for each suite will contain an
Lubomir Bulej's avatar
Lubomir Bulej committed
50
attribute, `DiSL-Classes`, listing binary names of classes that are used for
51 52 53
snippet expansion. The comma-separated list of classes is generated
automatically by the build system based on snippet-related annotations used in
the instrumentation classes.