microsoft / microsoft/vscode-java-test
Cannot add command line arguments via java.test.config
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 340
- Forks
- 173
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 18
Description
I'm trying to add listeners when running testNG tests using the Java Test runner.
In my settings.xml I've added:
"java.test.config": {
"name": "RunWithContinue",
"workingDirectory": "${workspaceFolder}",
"args": [
"-listener", "org.test.TestFilter"
]
},
But when I run:
[ERROR] {"name":"error","attributes":{"message":"Failed to run TestNG tests","trace":"java.lang.ClassNotFoundException: -listener
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at com.microsoft.java.test.runner.testng.TestNGLauncher.getClassName(TestNGLauncher.java:53)
at com.microsoft.java.test.runner.testng.TestNGLauncher.parse(TestNGLauncher.java:46)
at com.microsoft.java.test.runner.testng.TestNGLauncher.execute(TestNGLauncher.java:32)
at com.microsoft.java.test.runner.Launcher.main(Launcher.java:57)
"}}
It seems all args are expected to be a Class/Method name, even though it seems to be the only place to pass TestNG command line arguments:

Is there a workaround?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing stack trace in TestNGLauncher.java, especially parse and getClassName, then inspect how Launcher.java receives settings from java.test.config. Reproduce the case with the shown TestNG listener arguments. Done means the configured arguments are handled as intended by the test runner and the listener configuration no longer produces a ClassNotFoundException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100