2

As described in the official documentation, it should be possible to run the @QuarkusIntegrationTest against a running application. This feature looks incredibly useful, especially if I can run these integration test against a Quarkus service running on a test server, where it is integrated with all my other micro-services.

Unfortunately I never managed to make it work. I'm following step-by-step what's written in the documentation, but to me it looks it's not working at all.

Is there anyone who is using this feature and knows if it is actually working/supported by Quarkus v2.7?

Federico Bellini
  • 365
  • 1
  • 7
  • 18

2 Answers2

1

In order for quarkus.http.test-host to be recognized as valid configuration key, integration tests need to be run.

In order for integration tests to be run, the Failsafe Maven plugin needs to be correctly configured.

If you create your Quarkus application starting from the Getting Started example, please consider that, in such example, the Failsafe plugin is only configured for the native profile of Maven (refer to POM.xml).

As such, in the Getting Started example Failsafe won't be used (and integration tests not run), unless you issue mvn verify -Pnative -Dquarkus.http.test-host=...


You can move the Failsafe plugin configuration in POM.xml out of the native profile, to let it always be run.


When integration tests are run, the output of mnt verify shows two different test phases: the first for the unit tests (those tests whose names end by "Test"); the second for the integration tests (those tests whose names end by "IT").

In the first phase (unit tests) the quarkus.http.test-host won't be recognized as valid configuration key. Indeed the output says: "Unrecognized configuration key "quarkus.http.test-host" was provided; it will be ignored; ...".

In the second phase (integration tests), quarkus.http.test-host will be recognized as valid configuration key.

0

If you set the System property "quarkus.http.test-host", the QuarkusIntegrationTest won't start the application but uses the application running on a remote host defined by this property (and optionally the test-port)

System.setProperty("quarkus.http.test-host", "localhost");
System.setProperty("quarkus.http.test-port", "8080");

See here https://quarkus.io/guides/getting-started-testing#executing-against-a-running-application

Gerald Mücke
  • 10,724
  • 2
  • 50
  • 67