1

I need to run my Quarkus Tests against multiple different databases. Right now I write an abstract class with the tests and for each database a class that inherits this class with

@QuarkusTest
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@TestProfile(OracleProfile.class)

Where OracleProfile is my test profile with the QuarkusTestResourceLifecycleManager implementation to start Oracle in Test containers and set the environment. The same is there for postgres and mysql.

This works but leads to an inflation of test classes with only Annotations. Is there a better way to do Tests against multiple profiles?

Jens Popp
  • 131
  • 1
  • 12

1 Answers1

0

This can now be solved with the dev services and different test profiles:

# use -Dquarkus.test=oracle-test
%oracle-test.quarkus.datasource.db-kind=oracle
%oracle-test.quarkus.log.file.path = target/log/admin-quarkus-test-oracle.log
%oracle-test.quarkus.rest-client.ua-api.url=https://server:18443/ua-rest
%oracle-test.quarkus.rest-client.ua-api.scope=javax.inject.Singleton

# use -Dquarkus.test=postgres-test
%postgres-test.quarkus.datasource.db-kind=postgresql
%postgres-test.quarkus.log.file.path = target/log/admin-quarkus-test-postgres.log
%postgres-test.quarkus.rest-client.ua-api.url=https://server:18443/ua-rest
%postgres-test.quarkus.rest-client.ua-api.scope=javax.inject.Singleton

This will start the containers for oracle or postgres.

In my ci I have than two commands for:

- mvn -B -Dquarkus.test.profile=postgres-test test | tee postgres-test.log
- mvn -B -Dquarkus.test.profile=oracle-test test | tee oracle-test.log
Jens Popp
  • 131
  • 1
  • 12