'Different @QuarkusTestResource per Quarkus profile
I have just set up my project to use H2DatabaseTestResource
in the tests.
I also have created a custom PostgresDatabaseTestResource
, following this brilliant blog
If I manually change the ***DatabaseTestResource
written in the @QuarkusTestResource
annotation, they both work separately.
What I want to achieve now is to use one resource or the other based on a Quarkus profile or something similar, but I could not find a way to do this.
Any idea?
Solution 1:[1]
QuarkusTestProfile
has the testResources
method that you can use for this case. See https://github.com/quarkusio/quarkus/blob/2.9.0.CR1/integration-tests/spring-web/src/test/java/io/quarkus/it/spring/web/testprofile/Profiles.java#L35 for an example usage.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | geoand |