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

#32: Add capability to write QuarkusIntegrationTests #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

turing85
Copy link

While at it, reformat and unify code.

Resolves #32

@turing85 turing85 force-pushed the feature/32-support-integration-tests branch from b615652 to 08f51ae Compare June 23, 2023 21:13
@turing85
Copy link
Author

closed, superfluous.

@turing85 turing85 closed this Jun 23, 2023
@turing85
Copy link
Author

Premature closure. It is not superfluous after all

@@ -29,6 +29,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this using Weld? Quarkus uses ArC as its CDI implementation?

If I am reading this right you want to be able to basically do injection on the client side outside the packaged application?

Is this really necessary? A normal @QuarkusIntegrationTest does not support injection on the test side, and I think adding a new injection provider into the mix could really confuse things.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkouba could we possibly leverage your new QuarkusComponentTest work to allow injection into the client side of integration tests? I am not sure how compelling the use case is but I know we don't want a weld dependency.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this using Weld? Quarkus uses ArC as its CDI implementation?

If I am reading this right you want to be able to basically do injection on the client side outside the packaged application?

Is this really necessary? A normal @QuarkusIntegrationTest does not support injection on the test side, and I think adding a new injection provider into the mix could really confuse things.

@stuartwdouglas See https://groups.google.com/g/quarkus-dev/c/HGZhNw6jsLg/m/KWptjIg6CQAJ - This was the advice given by Ladislav at the time.

Copy link
Author

@turing85 turing85 Jun 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkouba could we possibly leverage your new QuarkusComponentTest work to allow injection into the client side of integration tests? I am not sure how compelling the use case is but I know we don't want a weld dependency.

I played around with QuarkusComponentTest and got it working. Only inconvenience is that there must be some configuration on each test class that lists all (entry-) beans. This basically boils down to listing all step-classes and would look something like so:

public class CucumberResourceIT extends CucumberQuarkusIntegrationTest {
    @RegisterExtension
    static final QuarkusComponentTestExtension COMPONENT_TEST_EXTENSION = new QuarkusComponentTestExtension(
        CucumberResourceSteps.class, CucumberResourceActor.class);

    public static void main(String... args) {
        runMain(CucumberResourceIT.class, args);
    }
}

Right now, all classes that we want to be (actually) injected must be listed in the extension configuration. Otherwise, an automatic mock will be created.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartwdouglas @mkouba I have a POC based on @QuarkusComponentTest here (github.com). Usability is still improvable, and we'd need to wait for a release of quarkus containing component tests, but it is a first step. Care to take a look?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure it's a good idea to mix the QuarkusComponentTestExtension with CucumberQuarkusIntegrationTest. I think that what Stuart meant was to reuse some logic from the QuarkusComponentTestExtension, i.e. init an ArC container for the classes you want to inject in the CucumberQuarkusIntegrationTest. Basically some logic from the QuarkusComponentTestExtension.initArcContainer() and QuarkusComponentTestExtension.afterAll() methods.

@vsevel
Copy link

vsevel commented Jul 7, 2023

we are interested in this as well. hoping this goes through at some point.

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

Successfully merging this pull request may close these issues.

Feature Request/ Question: Run tests as Integration Tests
4 participants