-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow @QuarkusTest
and @QuarkusIntegrationTest
to coexist in same test suite
#23528
Comments
/cc @geoand |
Did you have encounter problems in such a setup? |
I do see this, and I am talking about both Maven and Gradle. The integration test idea makes sense to me; testing a fully packaged application from outside. What makes less sense is why this can't be part of the regular test command/suite. For Gradle, any integration test that I create gets some form of initialization error when it is in the (Example init error: For both Maven and Gradle, it seems odd to need two commands to run all of my tests. I would want to be able to have one command to ensure all my tests are run and passing, with the option to exclude potentially slower integration tests. |
The idea is that the So I fail to see what the proposal is here. |
The proposal is that it should be easier to setup these integration tests; these tests should comingle in the If that means making the build/ package task a dependency for the tests, I feel that is reasonable. A note that making
I am of course willing to be shown an example of how these are 'meant' to be done, and that I might be overcomplicating something, but from what I have seen I don't see a perfect solution. Maybe my google foo is off, but I can't seem to find any comprehensive documentation on the topic (something that specifically hits integration tests, rather than mentioning it in passing) |
I personally don't feel there is anything difficult about the current setup as it's based on standard build tool practices.
That is huge breaking change and from my perspective brings no real benefit. I personally fail to see why the standard I'd like to hear what @famod and @edeandrea think. |
So I'll chime in here with my $0.02. And for those who don't know me, I'm much more a Gradle fan than I am a Maven fan :) Like @geoand mentions, integration tests must run after the application has been packaged, since those tests are run against whatever the output artifact is (jar file, container image, native binary, etc). This means that those test classes need to have a separate classloader. I actually prefer the way Gradle does this by having a separate source set (the name I think Maven makes this separation messy because the unit & integration tests are co-mingled in the same source set ( You also mention
You don't need two commands to run your entire test suite. In maven, |
@geoand I'm playing with this a little bit. I'm attaching the project I'm using here If I have a Gradle project and inside package org.acme;
import io.quarkus.test.junit.QuarkusIntegrationTest;
@QuarkusIntegrationTest
public class ExampleResourceIT extends ExampleResourceTest {
// Execute the same tests but in native mode.
} If I then run So maybe I see where @GregJohnStewart is coming from - having just integration tests that you want to run against the output of a Gradle build (not necessarily only against native images) requires some "manual labor" by the developer. Following this guide shouldn't I be able to run these integration tests against whatever the output of the build is? Here is my console log (I added some stuff to ╰─ ./gradlew clean build --console=plain
> Task :clean
> Task :processResources
> Task :quarkusGenerateCode
preparing quarkus application
> Task :compileJava
> Task :classes
> Task :jar
> Task :quarkusGenerateCodeTests
preparing quarkus application
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
ExampleResourceTest STANDARD_ERROR
Feb 09, 2022 11:52:15 AM org.jboss.threads.Version <clinit>
INFO: JBoss Threads version 3.4.2.Final
Feb 09, 2022 11:52:16 AM org.jboss.threads.Version <clinit>
INFO: JBoss Threads version 3.4.2.Final
Feb 09, 2022 11:52:17 AM io.quarkus.bootstrap.runner.Timing printStartupTime
INFO: Quarkus 2.7.1.Final on JVM started in 2.262s. Listening on: http://localhost:8081
Feb 09, 2022 11:52:17 AM io.quarkus.bootstrap.runner.Timing printStartupTime
INFO: Profile test activated.
Feb 09, 2022 11:52:17 AM io.quarkus.bootstrap.runner.Timing printStartupTime
INFO: Installed features: [cdi, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, vertx]
ExampleResourceTest > testHelloEndpoint() STANDARD_ERROR
Feb 09, 2022 11:52:18 AM org.acme.ExampleResourceTest testHelloEndpoint
INFO: Inside org.acme.ExampleResourceTest.testHelloEndpoint()
ExampleResourceTest > testHelloEndpoint() PASSED
Gradle Test Executor 5 STANDARD_ERROR
Feb 09, 2022 11:52:20 AM io.quarkus.bootstrap.runner.Timing printStopTime
INFO: Quarkus stopped in 0.067s
> Task :quarkusBuild
building quarkus jar
> Task :assemble
> Task :check
> Task :build This is what I added to tasks.withType(Test) {
// Configuration for all test tasks
//makes the standard streams (err and out) visible at console when running tests
testLogging {
displayGranularity -1
minGranularity -1
maxGranularity -1
showStandardStreams true
showStackTraces true
showExceptions true
showCauses true
exceptionFormat "full"
stackTraceFilters "truncate", "groovy"
events "passed", "failed", "skipped"
}
reports {
junitXml.outputPerTestCase = true
}
} If I run So @GregJohnStewart might be onto something - just maybe wasn't able to express it. |
I haven't used Quarkus with Gradle in a while, so I'll have to check and come back |
Yeah, same on preferring Gradle myself :) I fully understand the purpose of integration tests, and makes sense for separate source sets, where the That being said, I also saw that with a I did end up finding the test quickstart that seems to clear up the Maven questions, though. |
From my perspective the workflow you are mentioning (being able to run integration tests with a In my opinion what is there currently is broken. One workaround I did find is that if you do I don't know the internals of the Quarkus Gradle plugin, but something doesn't seem to be right. The |
cc @glefloch who knows more about the Gradle plugin than anyone |
Yes sure |
Looking back at the plugin code, we indeed have a When first running I don't know how to handle this. As mention in #21997 should we introduce a new integration test sourceset in gradle ? and in the future start deprecating the |
I think so. @aloubyansky WDYT? |
This would also fix the issue faced in #22982 |
Keep in mind though (also described in #22035) that it needs to be backwards compatible. On the Maven side, the execution of integration tests is done by the In Gradle, however, the source set config/execution is managed by the Quarkus Gradle plugin. That plugin will need to support both the There needs to be a deprecation period in place for users to migrate away before its removed completely. @glefloch Take a look at #22035 as well. I opened that when the conversation in #21997 spilled into discussing how similar capability should be handled in Gradle. |
Right, we won't just rename the sourceset, we will have to create a new source set without the extra What do you think of first creating that new source set and then updating code start? Have a preference for the source set name ? |
My own opinion, but |
I think |
Makes sense to me. |
I'm ok with |
@glefloch Maybe better to take that conversation over to #22035 since that ticket has been around for a bit and is specifically for this? |
Sure i will sum up everything there. I should be able to come up with a PR quite soon. |
Hello there, Something like this for instance : tasks.test {
useJUnitPlatform {
excludeTags("io.quarkus.test.junit.QuarkusIntegrationTest")
}
}
tasks.register<Test>("intTest") {
group = "verification"
useJUnitPlatform {
includeTags("io.quarkus.test.junit.QuarkusIntegrationTest")
}
shouldRunAfter("test")
}
tasks.check {
dependsOn("intTest")
} |
This is not enough. |
Definitely, it's more likely to be something like : dependsOn("assemble")
shouldRunAfter("test") |
Really needs to be |
Bump to this! How goes it? |
I don't think anyone is currently working on it |
I started some work before holidays, I will and push it. I was waiting for the maven PR to be merge before. |
The maven PR is about whether or not to always run the integration tests (instead of only in the native profile). Currently it's impossible to even run Whether or not to always run them (i.e. Just my $0.02. |
Hi @FengHuangDong I'm not sure your comment has anything to do with the issue being discussed in this ticket? It might get more visibility if you start a discussion thread about it? |
Description
I am running across some major hurtles with
@QuarkusTest
vsQuarkusIntegrationTest
. Essentially, it makes sense to me as a developer that I would want to run both in the sametest*
command, and for the test codebase to comingle.What I want to accomplish with this:
Currently though it seems that due to how the app is packaged for the different types of test, this is not currently supported and requires multiple code bases and different commands to be used to run them.
In Gradle, this seems to be the purpose of the
native-test
source set at the core, and in Maven an amount of pom configuration.I suggest that we support a homogeneous codebase and command for running both
@QuarkuTest
and@QuarkusIntegrationTest
tests. This would drastically simplify test creation and required configuration. If one wanted to have additional source-sets for Gradle runs it should still be possible, but one could also just run the same source set oftest
in native mode, and have the same tests available for jar integration testing.I also realize I could be missing something and a reasonable solution might exist but I am not seeing it.
Implementation ideas
We already have the ability to segment/ order tests by profiles and test resources; if we added the ability to order based on the two test annotations, we can separate the required runtime contexts and ensure they can run in the same suite/ run. It is possible I have a naive view of how the tests execution/ordering is handled, but I believe this is possible based on a couple of assumptions:
The text was updated successfully, but these errors were encountered: