microsoft / vscode-java-test

Run and debug Java test cases in Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test
Other
297 stars 129 forks source link

Micronaut tests are skipped #1732

Closed ChrisVesters closed 3 weeks ago

ChrisVesters commented 2 months ago
  1. Unzip the zip and try to run the default application test in VSCode.
  2. See that they are skipped.
%TSTTREE2,com.example.DemoTest,true,1,false,1,DemoTest,,[engine:junit-jupiter]/[class:com.example.DemoTest]
%TSTTREE3,testItWorks(com.example.DemoTest),false,1,false,2,testItWorks(),,[engine:junit-jupiter]/[class:com.example.DemoTest]/[method:testItWorks()]
%TESTS  3,@Ignore: testItWorks(com.example.DemoTest)
%TESTE  3,@Ignore: testItWorks(com.example.DemoTest)
  1. Comment out the line id("io.micronaut.test-resources") version "4.4.2" in build.gradle.
  2. Run the tests again, and now they work.

demo.zip

jdneo commented 2 months ago

The attached project has compilation errors

image

Anyway, I comment out RunCucumberTest.java and StepDefinitions.java, and using gradle delegation feature, looks like it works as expected.

image

image

ChrisVesters commented 2 months ago

I don't think you are looking at the right project. The one I uploaded doesn't contain any Cucumber tests.

It only contains a single DemoTest file.

jdneo commented 2 months ago

Have you tried Delegate Test to Gradle mentioned above?

ChrisVesters commented 2 months ago

I don't seem to have the option to run it with a certain profile.

Update: turns out I didn't have the extension enabled. So I can run it now like that, but it doesn't seem to do anything.

jdneo commented 2 months ago

but it doesn't seem to do anything.

Could you explain more about what happened on your side?

ChrisVesters commented 2 months ago

As I say. I don't see any output. Not in the test tab, not in the debug tab, nothing. The test tab only shows this: * The test run did not record any output.

If i run it on the command line with gradle it does run the test successfully.

 ./gradlew test

BUILD SUCCESSFUL in 8s
jdneo commented 2 months ago

Not in the test tab, not in the debug tab, nothing.

It's a limitation right now from upstream: https://github.com/microsoft/build-server-for-gradle/issues/119#issuecomment-2270972146

Can you see the green mark after running in the gutter?

ChrisVesters commented 1 month ago

I don't see the green mark. I also don't seen an update about the tests in the testing panel.

Screenshot 2024-09-19 at 09 24 44

On the image above I had previous runs directly through VSCode (also tried with coverage and such) I cleared the previous runs and tried do always delegate to Gradle

Screenshot 2024-09-19 at 09 25 34
jdneo commented 1 month ago

I cannot repro, here is what I've seen for this project.

https://github.com/user-attachments/assets/59797fea-d14a-4de1-a3e5-fc87e236903b

ChrisVesters commented 1 month ago

Interesting. I just tried to disable all extensions except for Gradle and Java test runner, but I still have the same issue? You think it could be related to the platorm/machine?

I am using Mac.

jdneo commented 1 month ago

You think it could be related to the platorm/machine?

No I don't think so.

What are the enabled extensions and their versions on your side?

ChrisVesters commented 1 month ago

I tried to disable as much extensions as I could.

Still active extensions are:

Screenshot 2024-09-19 at 12 10 02
ChrisVesters commented 3 weeks ago

I am going to close this ticket for the following reasons:

  1. I tried it with another project and I couldn't reproduce it, so something weird must have happened.
  2. It only happens when you use the test-resources plugin from Micronaut. If you simply use the dependencies the runner works fine out of the box (no need to delegate to mvn)

Because of this, this doesn't feel like an important thing.