admin管理员组

文章数量:1313120

Using a multi repo workspace our junit tests aren't being found by the Test Runner in VS Code. Meaning I can't run any tests directly in VS Code. If I run maven in a terminal/command the tests runs how I expect it to. The tests exist inside the web folder.

workspace/
├─ Repo 1/
│  ├─ automation folder/
│  │  ├─ src/
│  │  │  ├─ test/
│  │  │  │  ├─ web/
│  ├─ pom.xml
├─ Repo 2/

If I move the pom file up into the workspace folder it sees my files as junit tests and I can run them directly in VS code again.

workspace/
├─ Repo 1/
│  ├─ automation folder/
│  │  ├─ src/
│  │  │  ├─ test/
│  │  │  │  ├─ web/
├─ Repo 2/
├─ pom.xml

Is there a way to config VS code to recognize the files are junit tests when the pom is inside Repo 1.

If that isn't possible is there a way to commit files to Repo 1 when they exist outside of the folder?

Using a multi repo workspace our junit tests aren't being found by the Test Runner in VS Code. Meaning I can't run any tests directly in VS Code. If I run maven in a terminal/command the tests runs how I expect it to. The tests exist inside the web folder.

workspace/
├─ Repo 1/
│  ├─ automation folder/
│  │  ├─ src/
│  │  │  ├─ test/
│  │  │  │  ├─ web/
│  ├─ pom.xml
├─ Repo 2/

If I move the pom file up into the workspace folder it sees my files as junit tests and I can run them directly in VS code again.

workspace/
├─ Repo 1/
│  ├─ automation folder/
│  │  ├─ src/
│  │  │  ├─ test/
│  │  │  │  ├─ web/
├─ Repo 2/
├─ pom.xml

Is there a way to config VS code to recognize the files are junit tests when the pom is inside Repo 1.

If that isn't possible is there a way to commit files to Repo 1 when they exist outside of the folder?

Share Improve this question edited Jan 30 at 21:33 rick asked Jan 30 at 17:46 rickrick 454 bronze badges 1
  • Why not use multiple Maven projects? – Minxin Yu - MSFT Commented Feb 3 at 8:10
Add a comment  | 

2 Answers 2

Reset to default 0

Where is the VS Code runner looking? It would be helpful to know how you're calling it in CLI as well.

It kind of sounds to me like VS Code is considering workspace/ to be the root of the project, so the pom.xml only works correctly when it's effectively serving as the POM for workspace/.

Somehow, the IDE doesn't consider Repo 1/ as its own maven project. When you test in CLI, which directory are you calling mvn test? Are you calling it from Repo 1/?

Ended up just removing the Repo 1 folder with a new clone of the repo.

git clone REPO1 .

本文标签: gitMaven Multi repo workspaceTest Runner for Java VS Code not finding junit testsStack Overflow