Automated Tests
SignServer uses JUnit for automated testing and test cases exist in multiple projects:
Unit Tests
Unit tests are run when building with Maven, unless -DskipTests
is specified.
System Tests
System tests are placed in JAR files and can later be run with Ant by executing:
bin/ant systemtest:jars
Generally, tests are organized according to the following:
- Each new module can include its own Unit tests.
- Some components (i.e. Web Services) use their own test projects (
SignServer-Test-*WS
) in order to not include client-side code in their projects. - Legacy tests and system tests are placed in
SignServer-Test-System
.
Web Tests
SignServer also includes a WebTest module for automated testing of the web interface. For more information, see WebTest Module.
Platform Tests
The following command can be used to run only the platform verification tests:
ant systemtest:jars -Dsystemtest.jars.include=lib/SignServer-Test-Platform-*-tests.jar systemtest:report
The BasicSigningAdminWsTest assumes:
- There is a "p12" folder.
- The "p12" folder containing a keystore "truststore.jks" with the CA certificate that issued the TLS server certificate and using the password "changeit". If the server uses res/test/dss10/dss10_demo-tls.jks then the dssk10_truststore.jks can be used for this.
- The "p12" folder containing a keystore "client.p12" with password "foo123" and a key entry with certificate allowed by the truststore of the server. For instance if the server uses dss10_truststore.jks the sample keystore dss10_admin1.p12 can be used for this.
The BasicStartupAdminCliTest assumes:
- The test is running on the same server as the application server and APPSRV_HOME is configured.
Test Coverage with Clover
To run Clover, copy the Clover installation folder (or make a symlink to it) and store it as lib/ext/clover-dir
.
Note that if the project has been built previously, a dummy Clover folder will already exist with the name lib/ext/clover-dir
and the following must be run to remove it:
bin/ant clean clover.clean build deploy
bin/ant ant test:run
Stop the application server and then run the following to gather the report:
ant clover.xml clover.html
To disable Clover, even if it is installed, run Ant with -Dno.clover=true
.