microsoft / microsoft/vscode-java-test

Maven forkCount and reuseForks apparently not respected

Open
#1,654 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triaged enhancement maven question test-execution
Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 19h
Merged PRs (30d)
18

Description

Hello,

I am using systemstubs library.

As its author said, because of the way the library works, tests using it must be running in a forked vm, one per test.

I have been able to make this work in maven.

I have a multi module pom.xml. In my specific module pom.xml I configured sure-fire as follows:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.2.5</version>

                <configuration>
                    <forkCount>2.5C</forkCount>
                    <reuseForks>false</reuseForks>
                </configuration>

            </plugin>

This makes tests run by maven in cli run correctly.

However, when I run tests in vs code, they behave exactly as like they did when maven had not been configured with 1 fork, not reusing forks.

it seems as if not only is vs code not forking vms, it is running even methods in paralel, because tests in the same class are conflicting, while they should run sequentially in one thread, one after the other, in a class exclusive jvm process as maven is doing.

This makes me believe that either

  • vscode has its own runner and does not delegate to maven the test running OR
  • Some how delegation is ignoring the specific configuration in the module's pom.xml.

I have been searching a way to let vscode test runner know tthat either it should fork jvm process and run one test in each vm or it should delegate and follow what is specified in pom.xml.

Another desired and may be faster solution is to find (something I haven't found either) a way of asking vscode to just ignore these tests when running tests, so that we stop having failures on the test result.

Can you please provide me with information on how to proceed?

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.

Research direction

Reproduce the behavior with the module pom.xml, maven-surefire-plugin settings, and the VS Code test runner, comparing CLI Maven execution with VS Code execution. Trace whether the VS Code runner delegates to Maven and how it handles forkCount, reuseForks, and test exclusions. Done means the supported behavior or limitation is established and the requested configuration or workaround is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
devtools, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.