You can run tests with custom configuration. The configuration can be specified in settings.json
using the key java.test.config
.
It's recommended to save the test configuration as workspace settings. To open workspace settings, run command
Preferences: Open Workspace Settings (JSON)
.
Here is an example of the configuration schema:
"java.test.config": [ { "name": "myConfiguration", "workingDirectory": "${workspaceFolder}", "vmargs": [ "-Xmx512M" ], "env": { "key": "value" }, }, { // Another configuration item... }, ... ]
Note: The commands
Run With Configuration
andDebug With Configuration
are removed from version0.14.0
. The extension will let you select the configuration if it detects there are customized configuration available.
The value of java.test.config
is an object or an object array, each object is a configuration item, which may have the following properties:
args
Specify the command line arguments which will be passed to the test runner [] 0.14.0 classPaths
The classpaths defined in this setting will be appended to the resolved classpaths [] 0.33.0 coverage
The configurations for test coverage {} 0.41.0 coverage.appendResult
Whether the coverage result is appended. true 0.41.0 env
Specify the extra environment variables when running the tests {} 0.14.0 envFile
Specify the absolute path to a file containing environment variable definitions {} 0.33.0 filters
Specify the test filters {} 0.37.0 filters.tags
Specify the tags to be included or excluded. Tags having !
as the prefix will be excluded. Note: This setting only takes effect when testKind
is set to junit
[] 0.37.0 javaExec
The path to java executable to use. For example: C:\Program Files\jdk\bin\java.exe
. If unset project JDK's java executable is used. "" 0.40.0 modulePaths
The modulepaths defined in this setting will be appended to the resolved modulepaths [] 0.33.0 name
Specify the name of the configuration item "" 0.14.0 postDebugTask
Specify the label of a task specified in tasks.json (in the workspace's .vscode folder). The task will be launched at the very end of testing. "" 0.39.0 preLaunchTask
Specify the label of a task specified in tasks.json (in the workspace's .vscode folder). The task will be launched before the start of testing "" 0.33.0 sourcePaths
Specify the extra source paths when debugging the tests [] 0.22.4 testKind
Specify the targeting test framework for this test configuration. Supported values are junit
, testng
"junit" 0.37.0 vmArgs
Specify the extra options and system properties for the JVM [] 0.25.0 when
The when clause for matching tests by to determine if the configuration should be run with "" 0.41.0 workingDirectory
Specify the working directory when running the tests <PROJECT_ROOT_PATH> 0.14.0
When you have custom configurations, you'll be asked to pick one every time when running/debugging your test cases. To avoid that, you can use java.test.defaultConfig
and set its value to the name of a configuration.
If you want to bypass any existing configurations, you can use the built-in configuration named "default" which has the following definition:
{ "name": "default", "workingDirectory": "${workspaceFolder}" }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4