Home » Java » java – Citrus Framework – How to do multi-actor end-to-end integration tests-Exceptionshub

java – Citrus Framework – How to do multi-actor end-to-end integration tests-Exceptionshub

Posted by: admin February 23, 2020 Leave a comment


I have been working with the Citrus Framework to write integration tests for applications consisting of multiple interacting Spring Boot services. The services communicate via HTTP REST calls.

I am at a point where I need to write a test that will do end-to-end integration testing on a multi-service application.

The application scenario is as follows:

A master service that is invoked from a client via a POST call. The master calls two worker services, in sequence – it cannot be done in parallel, via POST calls. The master expects a response from each worker. Once the process is complete, the master returns a completion response to the client that triggered the whole process.

I have written Citrus tests for all three of these services, and in the case of the master, there are test actions that essentially mock the two worker services, dictating what they should receive and respond with. It took some time and hair pulling to get it to work correctly.

Now, I want to write a Citrus test that will allow for the testing of the process from start to finish with all of the services being real and not mocked. I would think that this test would be similar to the master integration test, except that the workers are no longer mocked.

I don’t know how to do this with Citrus. There is a section in the user guide (https://citrusframework.org/citrus/reference/2.8.0/html/index.html#test-actors) that seems to address this, but it’s quite short and I can’t see how it’s actually done. How are the “real” actors “wired up”? How are they configured and started/stopped? Also, the section only provides examples in XML, there are no Java DSL examples.

Is this question outside the scope of just Citrus? Does it need to involve a wider cast of characters, such as maven or a maven plugin?

How to&Answers: