...
HTTP REST, JMS, TCP/IP, SOAP, FTP, SSH, XML, JSON and more.
Description
In a typical test scenario the system under test is deployed on some application server and interacts with Citrus over various message transports. During the test run Citrus is able to act on both sides as client and/or server simulating request/response messages.
...
Citrus has been integrated to the framework using maven dependencies and used for the REST integration testing.
The Citrus Domain Specific Language (DSL), in combination with JsonPath, are used to perform the assertions on the service calls.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
http().client(mockAppClient).send().get("therapeuticExclusion/v2/therapeuticExclusions/${patientSsin}") .queryParam("hcPartySsin", "${hcPartySsin}") .header("Authorization", "Bearer " + authToken).accept(ContentType.APPLICATION_JSON.getMimeType()); http().client(mockAppClient).receive().response(HttpStatus.OK).messageType(MessageType.JSON) .validate("$[:1].patient.identifier[:1].value", "${patientSsin}") .validate("$[:1].hcParty.identifier[?(@.type=='ssin')]", "${hcPartySsin}") |
Within the project, you can find the code using Citrus in the REST project, in the Assertion module, under src/test/java/be/cetic/M2/features
Further information
Citrus has a pretty well made and complete documentation including examples on their website : https://citrusframework.org/citrus/reference/2.8.0/html/index.html