vscode-java-test icon indicating copy to clipboard operation
vscode-java-test copied to clipboard

The property file in src/test/resources is not recognized and the test fails.

Open tsukasa89 opened this issue 4 years ago • 7 comments

Environment:

  • OS: Windows10
  • VS Code: v1.60.2
  • JDK: v11
  • Java Test Runner Extension: v0.32.0

Repro steps:

  1. git clone : https://github.com/tsukasa89/test-runner-example
  2. Open test-runner-example with VSCode

VSCode Test run:

Click "Run All Tests"

Result:

The test "test resource properties value" failed.

Gradle Test run:

.\gradlew clean test

Result:

All tests succeed.

tsukasa89 avatar Sep 23 '21 08:09 tsukasa89

Took a quick look and found that in the resolved classpath, main folder comes previous of the test folder.

Needs to take a deep look to see what's happening.

jdneo avatar Sep 23 '21 09:09 jdneo

Root cause is that the upstream does not specially put the test output location before the main output location.

Same bug can be seen in Eclipse as well.

jdneo avatar Sep 29 '21 07:09 jdneo

I know about the eclipse issue. However, in eclipse, JUnit succeeds by prioritizing src/test in the Java Build Path. Is it possible to prioritize src/test when running the Java Test Runner in VS Code?

image

tsukasa89 avatar Oct 01 '21 09:10 tsukasa89

Currently the order of the build path is not configurable in VS Code. But that's a good point how we can solve such kind of issues.

jdneo avatar Oct 04 '21 02:10 jdneo

Thank you. I hope this problem will be solved.

tsukasa89 avatar Oct 04 '21 06:10 tsukasa89

Root cause is that the upstream does not specially put the test output location before the main output location.

Same bug can be seen in Eclipse as well.

@jdneo May I ask who the upstream is in this case? Is there already a ticket addressing this issue?

FieteO avatar Jan 25 '22 10:01 FieteO

@FieteO Since this is a Gradle project, so Buildship is used to resolve the classpaths

jdneo avatar Jan 26 '22 00:01 jdneo