christophd commented on issue #600: Testing Camel K integrations
URL: https://github.com/apache/camel-k/issues/600#issuecomment-500975102
 
 
   I have started to give some thought to it. 
   
   I really like the idea of test code to be part of the deployment, because 
then the test framework is able to interact with other services as part of the 
K8s platform. This is especially useful when the test code itself needs to 
provide a mocked service as part of the test. This mocked service could be 
provided as part of K8s as any other service.
   
   > can it work?
   
   I once put a little POC together (as part of the test framework Citrus 
https://github.com/citrusframework/citrus-remote-demo) where the integration 
tests (e.g. based on JUnit and Citrus) get deployed to Docker/K8s as part of a 
small web application. The web application (built as fat jar) provided a REST 
API to execute tests and to get its reports. The tests can also auto start upon 
deployment. 
   
   The POC also included a Maven plugin to create the test web application, 
execute the tests as part of the Maven build lifecycle and collect the reports.
   
   > is camel able to externalize test code completely from integration code?
   
   I think the answer is yes. You loose the ability to invoke the integration 
via direct endpoint as well as using the mock endpoint though as you would 
probably do with unit tests. But in general the integration should be invoked 
either via timer or some accessible endpoint I believe. All outbound calls to 
3rd party services can be mocked with frameworks like Citrus.
   
   > test code is not a DSL script... do we need some integration with IDE?
   
   I can imagine the test code to be a Camel DSL, too. That would be most 
comfortable for the user because it is not yet another DSL (e.g. Citrus) to 
learn. Integration into the IDE is quite important in my eyes. You get a lot of 
integration with tools and IDE for free when being compliant with frameworks 
like JUnit. JUnit5 provides a brilliant way to incorporate own frameworks and 
extensions.
   
   > which test framework?
   
   I think Citrus (https://github.com/citrusframework/citrus) can help to mock 
messaging transports and verify message content with Json, XML, plaintext 
validators. As already mentioned JUnit5 is a wonderful base framework with wide 
spread tools and IDE support. In general BDD (Behavior Driven Development) 
principles can help as testers and managers love it
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to