Cannot add command line arguments via java.test.config

Open
#1,297 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
testing-qa

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.

Description

ai-triaged enhancement test-configuration test-execution testng

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:

image

Is there a workaround?

Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 2h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode-java-test

All issues in microsoft/vscode-java-test

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.