In this article, I want to tell you how you can create a test project on the Citrus Framework in order to further develop it, that is, write integration tests. I want to note that if you have not worked with this framework before, but let's say you worked with Junit or TestNG, then you will feel comfortable, since Citrus uses these libraries internally. So each Citrus test is a Java class representing a JUnit or TestNG unit test of your choice. Okay, for an easy start, let's generate a project from the command line, send the following for execution: mvn archetype:generate -Dfilter=com.consol.citrus.archetypes:citrus Next, you will be prompted to generate a Citrus project of your choice: Choose archetype: : remote -> com.consol.citrus.archetypes:citrus-quickstart (Citrus quickstart project) : remote -> com.consol.citrus.archetypes:citrus-quickstart-jms (Citrus quickstart project JMS consumer and producer) : remote -> com.consol.citrus.archetypes:citrus-quickstart-soap (Citrus quickstart project SOAP client and server) : remote -> com.consol.citrus.archetypes:citrus-simulator-archetype-jms (Archetype Citrus JMS simulator) : remote -> com.consol.citrus.archetypes:citrus-simulator-archetype-mail (Archetype Citrus mail simulator) : remote -> com.consol.citrus.archetypes:citrus-simulator-archetype-rest (Archetype Citrus REST simulator) : remote -> com.consol.citrus.archetypes:citrus-simulator-archetype-swagger (Archetype Citrus Swagger auto generated REST simulator) : remote -> com.consol.citrus.archetypes:citrus-simulator-archetype-ws (Archetype Citrus SOAP simulator) : remote -> com.consol.citrus.archetypes:citrus-simulator-archetype-wsdl (Archetype Citrus WSDL auto generated SOAP simulator) 1 2 with 3 with 4 for 5 for 6 for 7 for 8 for 9 for We need the “Citrus quickstart project”, so choose the number: 1. “Citrus quickstart project” version I recommend choosing 2.8.0. Further, for example: Define value groupId: com.citrus.projects Define value artifactId: citrus-sample-project Define value version: -SNAPSHOT Define value package: com.citrus.projects for for for 1.0 for After the installation is complete, find the folder where the project was generated and open it in the development environment. Go to “projectName/src/ java/citrus” and create a class named for example “FirstTest”. This will be our first Citrus test. As I wrote at the beginning, we can extend our class using the TestNG or Junit libraries built into Citrus, so let's do this: For TestNG: public { @Test @CitrusTest public getTestActions() { } } class FirstTest extends TestNGCitrusTestRunner void For JUnit: public { @Test @CitrusTest public getTestActions() { } } class FirstTest extends JUnit4CitrusTestRunner void And as you noticed, I marked the test method with annotations @Test (which refers to TestNG or JUnit) and @CitrusTest (which Citrus Framework itself requires). Before we add actions to our getTestActions() method, let's configure, for example, a REST client that will send requests to and receive responses from the service under test. We will configure the client in the “citrus-context.xml” file in the “projectName/src/resources” folder. Let's add the following: <citrus-http:client id= request-url= content-type= timeout= /> "restClient" "https://service_host:8080/api/" "application/json" "60000" Now let's get back to our “FirstTest”. Let's create a client instance using the @Autowired annotation. Next, let's add actions as described below. public { @Autowired private HttpClient restClient; @Test @CitrusTest public getTestActions() { http(httpActionBuilder -> httpActionBuilder .client(restClient) .send() .get( ) ); http(httpActionBuilder -> httpActionBuilder .client(restClient) .receive() .response() .messageType(MessageType.JSON) .payload( + + + + + + ) ); } } class FirstTest extends TestNGCitrusTestRunner void "users/2" "{\n" " \"data\":{\n" " \"id\":2,\n" " \"first_name\":\"Janet\",\n" " \"last_name\":\"Weaver\",\n" " }\n" "}" Two actions are shown here, where the first one sends a GET request to url: “https://service_host:8080/api/users/2”, the second receives a synchronous response and checks the received result with what we specified in “payload”. As a result of running the test, we get the result of passing the test "passed" or "failed". So, we have created a simple test for testing a REST service. You can now extend this test project further by adding other tests. For those who are interested in Citrus Framework, I leave a link to the site “ ”. www.citrusframework.org That's all for now. I wish you all successful testing!