Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for delegating test and run/debug execution #119

Open
graemerocher opened this issue Dec 14, 2023 · 18 comments
Open

Add support for delegating test and run/debug execution #119

graemerocher opened this issue Dec 14, 2023 · 18 comments
Labels
enhancement New feature or request

Comments

@graemerocher
Copy link

The hooks seem to be there but it is currently unimplemented. We need to be able to delegate test and run execution to Gradle.

It seems from the blog is this is planned. Is there an ETA?

@jdneo
Copy link
Member

jdneo commented Dec 15, 2023

Hi @graemerocher,

Yes, it's in our plan. So far there is no concrete ETA yet.

@jdneo
Copy link
Member

jdneo commented Jun 26, 2024

Hi @graemerocher,

I'm working on the test delegation support with @Arthurm1 recently, and the code is closed to be ready.

Is there any sample project in Micronaut using Gradle in which tests are not working in VS Code previously. I can use it to test if that's working now.

@graemerocher
Copy link
Author

Great news! Sure you can grab any example from Micronaut Launch hat uses testcontainers/docker to run tests:

curl --location --request GET 'https://launch.micronaut.io/create/default/com.example.demo?lang=JAVA&build=GRADLE_KOTLIN&test=JUNIT&javaVersion=JDK_21&features=mysql&features=data-jdbc' --output demo.zip

@graemerocher
Copy link
Author

running tests that require testcontainres/docker requires delegating to the build tool

@jdneo
Copy link
Member

jdneo commented Jun 26, 2024

Screenshot 2024-06-26 at 16 00 06

Works now, thanks for sharing the sample project. I'll keep you updated.

@jdneo
Copy link
Member

jdneo commented Jul 3, 2024

Update: client side PRs are under review:

microsoft/vscode-java-test#1705
microsoft/vscode-gradle#1510

@graemerocher
Copy link
Author

does this also support delegating the static void main method in src/main/java to Gradle's run?

@Arthurm1
Copy link
Contributor

Arthurm1 commented Jul 8, 2024

does this also support delegating the static void main method in src/main/java to Gradle's run?

I need to split out and re-submit the original buildTarget/run support. I'll try to sort this week.

I'm not sure what plans there are on the BSP client side @jdneo?

@jdneo
Copy link
Member

jdneo commented Jul 9, 2024

I'm not sure what plans there are on the BSP client side @jdneo?

I'll make a pre-release for the test delegation late this week. Next I'll do the test debug support (In this month)

Delegate run will be the next.

@jdneo
Copy link
Member

jdneo commented Jul 30, 2024

Update: PR for debug test support: microsoft/vscode-gradle#1536

@jdneo
Copy link
Member

jdneo commented Aug 5, 2024

The Gradle Test Delegation (both run and debug) has supported now.

To use this feature, you need to install the latest Test Runner for Java and Gradle for Java extension.

To delegate the tests to Gradle, you can set the default testing profile in Testing explorer:
image
image

If you do not want to change the default testing profile, you can trigger an one-time execution via:
image
image

@graemerocher
Copy link
Author

nice!

@graemerocher
Copy link
Author

is there a way to default to this setting for all Gradle projects under Gradle settings? Or does it need to be done every time you open a project

@graemerocher
Copy link
Author

Seems that output from Gradle is not collected into the Test Results log window, is that a bug?

@jdneo
Copy link
Member

jdneo commented Aug 6, 2024

is there a way to default to this setting for all Gradle projects under Gradle settings? Or does it need to be done every time you open a project

VS Code will remember the choice for the project.

Seems that output from Gradle is not collected into the Test Results log window, is that a bug?

Yes, it's not implemented yet.

@graemerocher
Copy link
Author

is there an issue to track that?

@Arthurm1
Copy link
Contributor

Arthurm1 commented Aug 6, 2024

FYI - #147 needs to be merged to send stdout/err back. See spec

@nickzhums
Copy link
Member

@graemerocher we have already published a blog for delegating test to Gradle. If possible, we would greatly appreciate if you could also help us to promote that as well: https://x.com/NickZhu9/status/1818951420454072769 . Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants