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

Running a single integration test in IntelliJ runs other tests when using Gradle #44383

Open
rodcheater opened this issue Nov 8, 2024 · 4 comments · May be fixed by #46676
Open

Running a single integration test in IntelliJ runs other tests when using Gradle #44383

rodcheater opened this issue Nov 8, 2024 · 4 comments · May be fixed by #46676
Labels
area/gradle Gradle kind/bug Something isn't working

Comments

@rodcheater
Copy link
Contributor

Describe the bug

Using IntelliJ to execute a single Quarkus integration test (for example, by clicking on the run icon next to the test code and choosing ‘run’ or ‘debug’) causes other tests to run in a Gradle project. This is because quarkusIntTest depends on test and the --test command line option used by IntelliJ to isolate the test is not propagated to that dependency.

Expected behavior

Running a single test should only execute that test.

Actual behavior

Other tests (those run by the test Gradle task) are also run.

How to Reproduce?

Reproducer: quarkus-reproducer.zip

Steps to reproduce

  1. Open the project in IntelliJ.
  2. In GreetingResourceIT.java click the run icon that appears next to the class declaration, then choose quarkusIntTest and then ‘run’.
  3. Observe that GreetingResourceTest is also run.

Note that modifying the run configuration to add -x test to the command line will lead to the correct behaviour.

Output of uname -a or ver

Darwin Rods-MacBook-Pro.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:23 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6031 arm64

Output of java -version

openjdk version "21.0.4" 2024-07-16 OpenJDK Runtime Environment Homebrew (build 21.0.4) OpenJDK 64-Bit Server VM Homebrew (build 21.0.4, mixed mode, sharing)

Quarkus version or git rev

3.16.2

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.9

Additional information

No response

@rodcheater rodcheater added the kind/bug Something isn't working label Nov 8, 2024
Copy link

quarkus-bot bot commented Nov 8, 2024

/cc @glefloch, @quarkusio/devtools

@quarkus-bot quarkus-bot bot added the area/gradle Gradle label Nov 8, 2024
@rmanibus
Copy link
Contributor

as a workaround, I usually edit the run configuration and add -x test at the end of the run command

@gsmet
Copy link
Member

gsmet commented Nov 18, 2024

Would one of you be willing to contribute a fix for the Gradle plugin?

gilday added a commit to gilday/quarkus that referenced this issue Mar 7, 2025
The quarkusIntTest task does not use the output of the test task, so it does not need to be a dependency

Fixes quarkusio#44383
@gilday gilday linked a pull request Mar 7, 2025 that will close this issue
@gilday
Copy link
Contributor

gilday commented Mar 7, 2025

Would one of you be willing to contribute a fix for the Gradle plugin?

@gsmet I just opened a PR for this. It simply removes the dependency on the test task, because that is why the tests are running unexpectedly.

Arguably, the quarkusIntTest should have a dependency on the Gradle lifecycle task check, so that Gradle users may run both the test and quarkusIntTest tasks by simply executing check. I did not make this change, but am I happy to include it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants