Added by jgarnett, last edited by jgarnett on Apr 04, 2007  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

Maven complicates things on the logging front, as it does a lot of redirection.

Maven 2
cd $GEOTOOLS_HOME/gt/module/main
mvn test

By default:

  • the logs from testing end up in target/test-reports or target/surefire-reports sub-directory of each module
  • There should be XML and text files for the results of each test

Be sure to check both, as one of the wrinkles of maven makes it so the output isn't always exactly the same.

Logging (Maven 1)

To have maven display the logging as it tests instead of just writing to files, set the maven.junit.usefile property to false.

To set a property, you can either:

  • pass it in from the command line with the -D flag
    maven -D maven.junit.usefile=false
  • set it in the build.properties file
    just add the line: maven.junit.usefile=false
  • Another helpful testing hint
    In order to run only one test (replace with the test case class you want to run):
Maven 2
// send output to file (as is normally done in a build)
maven -Dtest=Rendering2DTest test

If you are having problems with logging output levels be sure to read the logging section.

Setting a proxy server for running tests (Maven 1)

If you are behind a firewall, you should have configured maven to use a proxy server.
In order to run tests which need to connect to the internet, be sure that the proxy address and port are being passed as command-line arguments to the virtual machine in the following line of the build.properties file:

maven.junit.jvmargs=-Xmx512M -Dhttp.proxyHost=${maven.proxy.host} -Dhttp.proxyPort=${maven.proxy.port}

Online Testing

Many tests require an online resource to run such as a remote server. These tests are excluded from the default build as often these online resources are not available and as a result case tests to fail. The naming convention for these tests is to name them as OnlineTest. Examples:

  • PostgisDataStoreAPIOnlineTest.java
  • WMS1_0_0_OnlineTest.java

To execute online tests during a build, the online profiles is used:

mvn test -P online

Stress Testing

Stress tests can roughly be defined as tests that dont add much test coverage to a module, and take a extended amount of time to run. These tests are excluded from the default build as they are time consuming. The naming convention for these tests is to name them as StressTest. Examples:

  • GMLParserStressTest.java
  • WFSIonicStressTest.java

To execute stress tests during a build, the stress profiles is used:

mvn test -P stress