Locked History Actions

ServiceTesting

Service testing

This page describes how one can test newly setup services with the TEAM engine and the deegree test generator tools.

1. Getting the TEAM engine via svn

One can get the OWS4 branch of the TEAM engine for example via svn co https://teamengine.svn.sourceforge.net/svnroot/teamengine/branches/ows4. It has some documentation included, if you use ant, you can edit the build.properties.example (and rename it to build.properties), run ant and use the bin/test.sh script (or test.bat) to run the engine.

2. Getting required deegree parts

Apart from the deegree core from base you need the test subproject "testengine" (for example from test/trunk).

People using ant can just edit the testengine/build.xml to point to the deegree base directory and run ant to build a testengine.jar in testengine/dist.

People using eclipse add the base project to the build path, and build the .jar themselves (for example from the bin directory where eclipse stores the classfiles).

3. Running the scripts

To run the scripts you use a command line like:

java -cp ../../base/dist/deegree2.jar:dist/testengine.jar:... <classname>

(where the <classname> varies as follows)

Please note that you need to add some .jar files from the libraries that deegree uses. In the bin directory Windows users can find, use and edit the test.bat to suit their needs (they create a lib directory that contains the .jars right next to the bin directory).

Libraries that have to be included in the classpath at a minimum are

  • log4j/log4j-1.2.9.jar
  • xml/jaxen-1.1-beta-8.jar
  • java3d/vecmath.jar
  • jts/jts-1.8.jar
  • jai/jai_core.jar
  • the deegree2.jar itself
  • the dist/testengine.jar

4. Generating WMS or WFS tests

The WMS/WFS test generating classes are org.deegree.tools.test.wms(wfs).TestGenerator. If you run the program as described above, it will output a description of the command line options for you.

To run the generated tests, you can use the TEAM engine like follows:

bin/test.sh -source=/home/user/mytestdir/

with mytestdir being the directory where the tests were generated.

The WMS tests are quite comprehensive, while the WFS tests are barely scratching the surface.

The WMS tests are capable of the following:

  • only GetMap requests are currently tested

  • requests are sent via GET for key value pair requests and POST for SLD XML requests
  • single-layer requests and requests with 1 - 10 layers are sent
  • many different combinations of width/height/layer names/styles etc. are generated
  • correct error messages for unknown CRS, styles, layer names etc. are tested
  • invalid bounding boxes, bboxes outside the bbox of the layer and bboxes resulting in an outside scale are tested, bboxes are randomized
  • SLD XML requests are sent with UserStyles, but only with simple PointSymbolizers

5. Generating custom tests

org.deegree.tools.test.generic.TestGenerator is a tool that generates test scripts from user supplied XML requests and XPath expressions or expected response documents. The second option enable you to create several hundrets or thousands of tests without typing each test expression manually. You can run the tool several times, it will integrate the different scripts into one.

The program expects at least three parameters:

java -classpath ... org.deegree.tools.test.generic.TestGenerator

-s <serviceurl>: The base URL of the service to send the requests to.

-d <dir>: The directory where to store the tests. If a main.xml exists, the tests will be appended to the existing ones.

<file(s)|directorie(s)>: A list of files and/or directories seperated by blanks containing requests (and maybe responses to them) to perform.

If you choose to pass one or more files (requests) to the program for each file you will be asked to enter an xPath expression that validates the result to the request. If you pass one or more directories the program will read all files having extension '.xml' from the directories and their sub-directories. Here we have to differentiate between two cases:

  1. If a file is read from a directory or one of its sub-directories there exists another file with the same name but having postfix '_response' before its extension (e.g. getfeature1.xml and getfeature1_response.xml). In this case the program will interpret the second document as a valid result to the request contained in the first one and extracts all possible (direct) xPath expressions to the documents leaves for creating test expressions.
  2. If a file is read from a directory or one of its sub-directories having non assigend response document the program will ask you to enter an xPath expression to validate the response to the request contained in the document.

Both approaches can be mixed. Example:

java -classpath ... org.deegree.tools.test.generic.!TestGenerator -s http://localhost:8080/deegree-wfs/services -d e:/teamengine/tests e:/teampengine/getfeature.xml e:/teampengine/requests

Requests shall be performed against the service available at http://localhost:8080/deegree-wfs/services. The generated tests results will be stored at e:/teamengine/tests. The user will be asked to enter an xPath expression as test condition for request stored in e:/teamengine/getfeature.xml; in addition all xml-files stored in e:/teamengine/requests will be read and depending if response docuements are assigned or not xPath expressions will be generated automatical or not.


CategoryDeegree2