Runtime environment

This topic outlines how to set particular parameters required by your application using JVM environment variables, project environment variables, or system properties.

JVM environment variables

If your project requires any particular JVM options to, these can be passed to Cover using the JVM_ARGS environment variable. This is useful if you need to pass the details of a user id, or which database to use, as properties to the JVM. The two examples below show passing a user_id with an authentication token:

set JVM_ARGS="-Duser_id=Sue -Duser_auth_token=1234"
dcover.bat create

The JVM_ARGS environment variable can also be used for memory management.

Project environment variables

Any environment variables that your project requires at runtime should be set in the environment in which you are running Cover. If this is not possible then the --environment KEY=VALUE command line option can be used to configure additional environment variables.

Note that if tests are created using environment variables you should ensure that those same environment variables are available to test execution. Therefore you may need to configure your build tool (Maven, Gradle) to supply your environment variables to your tests.

System properties

The -D or --define option allows the user to pass additional system properties to dcover for test creation and execution.

Any created tests may depend upon these user-specified system properties and may not execute successfully without them.

Therefore you will need to configure test execution in your build script to supply any user-specified system properties when executing those tests outside dcover.

For more details about build tool configuration with system properties, see the Maven and Gradle topics.

Last updated