Download "user manual"

Transcript
Unit Tests
7.2.2.1. HttpUnit Based Tests
To test features of the cartoclient, the HttpUnit [http://httpunit.sourceforge.net/]
software is used. It is written in Java, and there is no Php port. The http unit tests are
run if you have a JVM in you path.
For more information about running HttpUnit tests, see the tests/client/
httpunit/README file in the CartoWeb distribution.
7.2.2.2. Testing CartoWeb Plugins
Plugins are a main component in CartoWeb architecture. That's why there is support
to maintain common code used for testing plugins. As described in Section 7.2.1,
“General Information About Writing Tests” the tests for plugins have to mirror the
file hierarchy of the base application. That's why there are coreplugins and plugins
directories where test for core plugins and plugins are stored respectively.
Note
Tests are also available for projects. So, to test a plugin in a project, the path of the
test will be <cartoweb3>/<projectname>/tests/plugin/<pluginname>
Testing plugins is separated into two tasks:
1. Locally testing client, common or server classes. For plugin client classes, it
requires a CartoClient environment available, and identically a CartoServer
environment for testing server classes.
2. Remote plugin tests, throught the webservice API. This kind of tests are related to
the server plugins, that's why we chose to put them in the server folder of
plugins.
For the first point mentionned above, general Unit tests rules apply, as described in
Section 7.2.1, “General Information About Writing Tests”.
For the second point stated, a help class named client_CartoserverServiceTest
can be extended by the testing classes. In turn, client_CartoserverServiceTest
extends other classes which offer additional helpful methods. For the complete list of
available methods, please have a look at the generate API docs (as more may be
added in future). The main useful methods are createRequest() for initializing a
new request, getMap() for lanching the request.
Tip
260