quarkusquarkus-extension

Cannot mix both QuarkusUnitTest based tests and QuarkusTestExtension error


As the title suggests, I'm experimenting with writing my own extension. The extension offers an abstract adapter and an interceptor that can be used from apps, and I was thinking to test the abstract logic in the extension so to confirm that the basic functionality works as expected.

I added a couple of QuarkusUnitTest to test the BuildSteps for different config options, which run fine, but when I add a @QuarkusTest class I get the following build error:

java.lang.IllegalStateException: Cannot mix both io.quarkus.test.QuarkusUnitTest based tests and io.quarkus.test.junit.QuarkusTestExtension based tests in the same run
    at io.quarkus.test.ExclusivityChecker.checkTestType(ExclusivityChecker.java:16)
    at io.quarkus.test.QuarkusUnitTest.beforeAll(QuarkusUnitTest.java:545)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Maven runs the @QuarkusTest first and then tries to run the QuarkusUnitTests. It's not clear if it's impossible to run both types in the same run, or if I've missed a config option somewhere.


Solution

  • As the error implies, you cannot mix the two types of tests.

    For the purposes of extension writing, we usually suggest having QuarkusUnitTest in the deployment module covering most of the functionality and then use @QuarkusTest in an integration-tests module which is meant to simulate real applications using the extension