--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAD%2BL2cx7zQ8y4p%3Dz6cREkDvdLD6CC6XWidtzZ7DbLvw6LjnLPw%40mail.gmail.com.
-... on the downside the application is not built in TEST mode
--Stéphane Épardaud
Hi Everyone,As I have mentioned previously I am planning on enhancing our testing capabilities, and to start with I am proposing a new approach to integration testing.At the moment we have some limitations with regards to integration testing:- We only provide integration testing for the actual production app for the native images- These tests in our examples generally inherit from the corresponding unit test, this is confusing as unit tests support extra features that integration tests don't (namely injection), so this approach as the default leads to user confusion.- We have no way of testing the actual JVM application that is generatedTo solve these problems I propose we introduce @QuarkusIntegrationTest which will provide general integration test capabilities. In essence this will work almost exactly the same as our current native testing, except that it will test the generated application no matter what it is. If we are building a JVM application it will run the JVM app, if we are building a native application it works the same as our existing native tests, and so on. This will also allow us to test docker images, as we can use this to run the generated docker image and run tests against it (potentially we could even deploy to a kube pod and test in a cluster, but I am not sure how useful that will be).From a practical point of view, this would mean the following:- We discourage RestAssured based testing for @QuarkusTest. Instead we focus on unit style testing of components. Note that you can still test functionality without the transport layer by just injecting JAX-RS resources directly into the test. Is this something that we want to encourage as it provides a really simple way to test logic (while obviously not testing the transport layer)? Also if you really want to RESTAssured will still work fine, this is more just about what ends up in our examples/docs.
- We use @QuarkusIntegrationTest for all 'over the wire' tests, and run them in the integration tests phase. This means the actual application is being tested, but on the downside the application is not built in TEST mode so there is some inconsistency here (same as we already have for native). The actual target of this test will depend on the build output, native builds will test native, Java build will test the jar, Docker builds will run and test the docker image.To look at a concrete example, the getting started example would have the changes in [1]. Basically the unit test now tests the endpoint without the transport layer, and the integration test runs over HTTP and would test both the JVM and native production applications.There are some downsides/caveats to this proposal that need serious consideration:- IDE support will not work as well for integration tests, as it requires a build to update the actual application that is being run. It will likely still be possible to have it launch from the IDE, but changes will not be automatically picked up (unless we can detect this and force a build before launch in this case).
- All integration style tests will be run in a separate process, so you would need explicit debugger support to launch the process in suspended mode, so debugging is slightly more involved.- The tests would run in the verify phase, and need to follow the failsafe naming convention. This means you need to run 'mvn verify' rather than 'mvn test' and the tests are naming ITCase rather than TestCase. This is all 'standard' maven, however in general developers seem to be more experienced with surefire than failsafe.
On Wed, Apr 15, 2020 at 12:37 AM Stuart Douglas <sdou...@redhat.com> wrote:Hi Everyone,As I have mentioned previously I am planning on enhancing our testing capabilities, and to start with I am proposing a new approach to integration testing.At the moment we have some limitations with regards to integration testing:- We only provide integration testing for the actual production app for the native images- These tests in our examples generally inherit from the corresponding unit test, this is confusing as unit tests support extra features that integration tests don't (namely injection), so this approach as the default leads to user confusion.- We have no way of testing the actual JVM application that is generatedTo solve these problems I propose we introduce @QuarkusIntegrationTest which will provide general integration test capabilities. In essence this will work almost exactly the same as our current native testing, except that it will test the generated application no matter what it is. If we are building a JVM application it will run the JVM app, if we are building a native application it works the same as our existing native tests, and so on. This will also allow us to test docker images, as we can use this to run the generated docker image and run tests against it (potentially we could even deploy to a kube pod and test in a cluster, but I am not sure how useful that will be).From a practical point of view, this would mean the following:- We discourage RestAssured based testing for @QuarkusTest. Instead we focus on unit style testing of components. Note that you can still test functionality without the transport layer by just injecting JAX-RS resources directly into the test. Is this something that we want to encourage as it provides a really simple way to test logic (while obviously not testing the transport layer)? Also if you really want to RESTAssured will still work fine, this is more just about what ends up in our examples/docs.What you mean by "discourage RestAssured based testing for @QuarkusTest" is that, if you're writing Arc tests, you don't need to include JAX-RS and invoke over the wire? You should just be able to inject things into the test?
- We use @QuarkusIntegrationTest for all 'over the wire' tests, and run them in the integration tests phase. This means the actual application is being tested, but on the downside the application is not built in TEST mode so there is some inconsistency here (same as we already have for native). The actual target of this test will depend on the build output, native builds will test native, Java build will test the jar, Docker builds will run and test the docker image.To look at a concrete example, the getting started example would have the changes in [1]. Basically the unit test now tests the endpoint without the transport layer, and the integration test runs over HTTP and would test both the JVM and native production applications.There are some downsides/caveats to this proposal that need serious consideration:- IDE support will not work as well for integration tests, as it requires a build to update the actual application that is being run. It will likely still be possible to have it launch from the IDE, but changes will not be automatically picked up (unless we can detect this and force a build before launch in this case).This makes @QuarkusIntegrationTest not worth it. Right-click IDE support is a must for all testing. While I agree with your idea of testing what's built, the extra test coverage is just not worth it if right-click-IDE run won't work as it will be very very rare that integration testing will pick up a bug that running in regular Quarkus test mode won't.
- All integration style tests will be run in a separate process, so you would need explicit debugger support to launch the process in suspended mode, so debugging is slightly more involved.- The tests would run in the verify phase, and need to follow the failsafe naming convention. This means you need to run 'mvn verify' rather than 'mvn test' and the tests are naming ITCase rather than TestCase. This is all 'standard' maven, however in general developers seem to be more experienced with surefire than failsafe.Is there a way to detect the difference between a maven build from cmd line and right-click-ide? Maybe some extra system property that a quarkus plugin would set? That way right-click-IDE run would work for an QuarkusIntegrationTest too.
Would something not work with @QuarkusIntegrationTest vs. @QuarkusTest? My next thought is, why not just not have @QuarkusIntegrationTest and just force @QuarkusTest to work with built artifacts if run from mvn command line? Then there's no need for an extra annotation, things are backward compatible, and you get the extra testing.
Bill
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAD%2BL2czdUqGsJbH6V_YGY_ExV7mqC5F_znG4Hi9iyOGs7zqH9Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CACHzTrbCruppD%3D0LJ4nwzJzOY2yTqiJ6G2JF9fWcA1f4T6kuAg%40mail.gmail.com.
QuarkusIntegrationTestGoal(s)- Test the application network integration- Test the native application- BlackBox testingPre-requisities- Quarkus JVM packaging- Quarkus Native packaging- %prod profileFeatures- Manage application (re)start between tests- Provide TestContainers configuration- Application Client pre-configuration (RestAssured, AMQP, Kafka)DeveloperExperience- Maven failsafeQuestions/Comments- I have the feeling that we should clearly split the JVM and native mode testing but well at the end it's blackbox testing in the 2 sides...
- How do you do testing if teh %test profile is used for unit testing, here you should use %prod but the application will try to connect to the actual production third parties (DB, Kafka cluster etc) I don't think its something to promote.
- Since Junit is providing the RegisterExtension, could we consider to configura and start a quarkus application progamtically (à la ShrinkWrap) rather than running the actual application jar?
- Failsafe is not very popular compared to surefire, everybody will focus on mvn test and mvn package but not mvn verify
- Generallly speaking true integration tests are often skipped. A true production like environment is always time consuming to setup, the feedback loop is way to long and ends up delegated to a everyday CI build). IMy 2cts it's ok for native image but not for basic HTTP testing.
--Daniel PETISME
daniel....@gmail.com--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAD%2BL2czdUqGsJbH6V_YGY_ExV7mqC5F_znG4Hi9iyOGs7zqH9Q%40mail.gmail.com.
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CACHzTrbCruppD%3D0LJ4nwzJzOY2yTqiJ6G2JF9fWcA1f4T6kuAg%40mail.gmail.com.
Hi Stuart,When we look at black-box testing an application, the runtime-specific bits that only Quarkus has become less apparent, which makes a runtime-agnostic library a bit more attractive instead of every runtime implementing their own way. This is what I've been working to achieve in a project called MicroShed Testing [1].MicroShed has an extension for Quarkus already, among other runtimes like Liberty, Wildfly, and Payara. The ideal use case for MicroShed is block-box testing an application inside of a Docker container (as you describe). It currently has a good set of features for Quarkus integration including:- auto configuration of relational databases- auto configuration of MongoDB- auto configuration of Kafka and clients [2]- auto configuration of RestAssured or REST ClientDo you think it would be better to utilize MicroShed for black-box testing instead of creating a @QuarkusIntegrationTest anno? That way @QuarkusTest can focus on unit-testing capabilities that are tightly coupled with Quarkus, and MicroShed can focus on integrations between generic Java runtimes and their dependencies like DBs/Kafka/etc.
Side note: Currently MicroShed does not work with Quarkus 1.3 in w/ @QuarkusTest because of the classloading changes and I am working on fixing this, but if you are testing black-box in a Docker container (JVM or native) it works.
On Tuesday, April 14, 2020 at 11:37:07 PM UTC-5, Stuart Douglas wrote:Hi Everyone,As I have mentioned previously I am planning on enhancing our testing capabilities, and to start with I am proposing a new approach to integration testing.At the moment we have some limitations with regards to integration testing:- We only provide integration testing for the actual production app for the native images- These tests in our examples generally inherit from the corresponding unit test, this is confusing as unit tests support extra features that integration tests don't (namely injection), so this approach as the default leads to user confusion.- We have no way of testing the actual JVM application that is generatedTo solve these problems I propose we introduce @QuarkusIntegrationTest which will provide general integration test capabilities. In essence this will work almost exactly the same as our current native testing, except that it will test the generated application no matter what it is. If we are building a JVM application it will run the JVM app, if we are building a native application it works the same as our existing native tests, and so on. This will also allow us to test docker images, as we can use this to run the generated docker image and run tests against it (potentially we could even deploy to a kube pod and test in a cluster, but I am not sure how useful that will be).From a practical point of view, this would mean the following:- We discourage RestAssured based testing for @QuarkusTest. Instead we focus on unit style testing of components. Note that you can still test functionality without the transport layer by just injecting JAX-RS resources directly into the test. Is this something that we want to encourage as it provides a really simple way to test logic (while obviously not testing the transport layer)? Also if you really want to RESTAssured will still work fine, this is more just about what ends up in our examples/docs.- We use @QuarkusIntegrationTest for all 'over the wire' tests, and run them in the integration tests phase. This means the actual application is being tested, but on the downside the application is not built in TEST mode so there is some inconsistency here (same as we already have for native). The actual target of this test will depend on the build output, native builds will test native, Java build will test the jar, Docker builds will run and test the docker image.To look at a concrete example, the getting started example would have the changes in [1]. Basically the unit test now tests the endpoint without the transport layer, and the integration test runs over HTTP and would test both the JVM and native production applications.There are some downsides/caveats to this proposal that need serious consideration:- IDE support will not work as well for integration tests, as it requires a build to update the actual application that is being run. It will likely still be possible to have it launch from the IDE, but changes will not be automatically picked up (unless we can detect this and force a build before launch in this case).- All integration style tests will be run in a separate process, so you would need explicit debugger support to launch the process in suspended mode, so debugging is slightly more involved.- The tests would run in the verify phase, and need to follow the failsafe naming convention. This means you need to run 'mvn verify' rather than 'mvn test' and the tests are naming ITCase rather than TestCase. This is all 'standard' maven, however in general developers seem to be more experienced with surefire than failsafe.In terms of implementation I have not given it a lot of thought yet, as I wanted to get feedback on the idea first. It will likely be some form of SPI that allows a test launcher to be generated in the target dir, which can then be invoked by the test runner to launch whatever the output of the build happens to be, but I don't really want to look into it in depth until we have all the requirements.If you have any feedback I would love to hear it.Stuart[1] https://github.com/quarkusio/quarkus-quickstarts/commit/e1d46252ddc4b96686c3ce2fd11b73f8bb9476aa
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/27b56799-88e1-4381-b91d-bedbfbd73d93%40googlegroups.com.
Hi Stuart,I am using TestContainers for unit and integration tests. I did managed to start TestContainers for the @NativeImageTest (I disabled the NativeLaunchRunner).From my view this could help:1. Rename the @NativeImageTest to @QuarkusIntegrationTest.2. Disable or inject own implementation of the NativeLaunchRunner - In this way Quarkus project can still start native image for integration test with NativeLaunchRunner
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/75be3401-adc1-424c-91bb-93416030f312%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAD%2BL2cx5sV8xoaj7z8mi1cCGgMrpC4zMBa_wOFA1V6EcnF7LLw%40mail.gmail.com.
Hi Everyone,As I have mentioned previously I am planning on enhancing our testing capabilities, and to start with I am proposing a new approach to integration testing.At the moment we have some limitations with regards to integration testing:- We only provide integration testing for the actual production app for the native images- These tests in our examples generally inherit from the corresponding unit test, this is confusing as unit tests support extra features that integration tests don't (namely injection), so this approach as the default leads to user confusion.- We have no way of testing the actual JVM application that is generatedTo solve these problems I propose we introduce @QuarkusIntegrationTest which will provide general integration test capabilities. In essence this will work almost exactly the same as our current native testing, except that it will test the generated application no matter what it is. If we are building a JVM application it will run the JVM app, if we are building a native application it works the same as our existing native tests, and so on. This will also allow us to test docker images, as we can use this to run the generated docker image and run tests against it (potentially we could even deploy to a kube pod and test in a cluster, but I am not sure how useful that will be).From a practical point of view, this would mean the following:- We discourage RestAssured based testing for @QuarkusTest. Instead we focus on unit style testing of components. Note that you can still test functionality without the transport layer by just injecting JAX-RS resources directly into the test. Is this something that we want to encourage as it provides a really simple way to test logic (while obviously not testing the transport layer)? Also if you really want to RESTAssured will still work fine, this is more just about what ends up in our examples/docs.- We use @QuarkusIntegrationTest for all 'over the wire' tests, and run them in the integration tests phase. This means the actual application is being tested, but on the downside the application is not built in TEST mode so there is some inconsistency here (same as we already have for native). The actual target of this test will depend on the build output, native builds will test native, Java build will test the jar, Docker builds will run and test the docker image.To look at a concrete example, the getting started example would have the changes in [1]. Basically the unit test now tests the endpoint without the transport layer, and the integration test runs over HTTP and would test both the JVM and native production applications.There are some downsides/caveats to this proposal that need serious consideration:- IDE support will not work as well for integration tests, as it requires a build to update the actual application that is being run. It will likely still be possible to have it launch from the IDE, but changes will not be automatically picked up (unless we can detect this and force a build before launch in this case).
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAD%2BL2cwzuX_4tbKnwmUZrxKXdJ%2BDwtt2HQe2mPP1jGEgKP8v9w%40mail.gmail.com.