Citrus samples ![Logo][1]

December 15, 2025 ยท View on GitHub

Sample applications

The Citrus samples applications try to demonstrate how Citrus works in different integration test scenarios. The projects are executable with Maven and should give you a detailed picture how Citrus testing works.

This repository uses the Java DSL and configuration in Citrus. In case you are not a Java developer you can also use the plain XML DSL and configuration notation. The samples using XML can be found in samples-xml.

Overview

The Citrus samples section contains many small projects that each represents a separate system under test and some Citrus test cases.

Each sample folder demonstrates a special aspect of how to use Citrus. Most of the samples use a simple todo-list application as system under test. Please find following list of samples and their primary objective:

SamplesDescription
sample-reportingShows how to add a custom reporter
sample-dockerShows how to use Citrus within Docker infrastructure
sample-kubernetesShows how to use Citrus within Kubernetes infrastructure
sample-gradleUses Gradle build to execute tests
sample-annotation-configUses annotation based endpoint configuration
sample-javaconfigUses pure Java POJOs for configuration
sample-groovyUses Groovy scripts to define Citrus test cases
sample-behaviorsShows how to reuse test actions in test behaviors
sample-dictionariesShows how to incorporate message manipulation using data dictionaries
sample-message-storeShows how to access internal message store
sample-binaryShows binary message content handling in Citrus
sample-hamcrestShows Hamcrest matcher support in validation and conditions
sample-mailShows mail server activities in Citrus
sample-seleniumPerform UI testing with Selenium and Citrus
sample-dynamic-endpointsShows dynamic endpoint component usage
sample-jmsShows JMS message broker integration
sample-kafkaShows Kafka integration
sample-rmiShows how to use RMI with Citrus as a client and server
sample-camel-contextInteract with Apache Camel context and routes
Samples DBDescription
sample-jdbcSimulates database server with JDBC
sample-jdbc-callable-statementsSimulates database server communication using callable statements
sample-jdbc-transactionsSimulates database server with transactional JDBC
sample-sqlValidates stored data in relational database
Samples JSONDescription
sample-jsonShows Json payload validation feature with JsonPath validation
sample-databindShows JSON object mapping feature when sending and receiving messages
Samples XMLDescription
sample-xmlShows XML validation feature with schema and Xpath validation
sample-oxmShows XML object marshalling feature when sending and receiving messages
sample-xhtmlShows XHTML validation feature
Samples FTP/SFTPDescription
sample-ftpShows FTP client and server interaction in Citrus
sample-sftpShows SFTP client and server interaction in Citrus
sample-scpShows SCP client and server interaction in Citrus
Samples TestNGDescription
sample-testngShows TestNG framework support
sample-dataproviderShows TestNG data provider usage in Citrus
Samples JUnitDescription
sample-junitShows JUnit4 framework support
sample-junit5Shows JUnit5 framework support
Samples HttpDescription
sample-swaggerAuto generate tests from Swagger Open API
sample-httpShows Http REST API calls as a client
sample-http-loadtestCalls REST API on Http server with multiple threads for load testing
sample-http-static-responseShows how to setup a static response generating Http server component
sample-http-query-paramHow to use Http form data with x-www-form-urlencoded Http POST
sample-http-form-dataExchange form data via Http GET/POST
sample-http-basic-authShows how to use basic authentication on client and server components
sample-httpsShows how to use SSL connectivity as a client and server
Samples WebsocketsDescription
sample-websocket-clientShows how to connect to a Websocket as a client during the test
sample-websocket-serverShows how to provide a Websocket as a server for clients to connect
Samples SOAPDescription
sample-wsdlAuto generate tests from WSDL
sample-soapShows basic SOAP web service support
sample-soap-mtomShows how to send and receive MTOM enabled SOAP attachments
sample-soap-attachmentShows how to send SOAP attachments to server
sample-soap-wssecurityShows how to configure SOAP web service client and server with WSSecurity enabled
sample-soap-wsaddressingShows how to configure SOAP web service client and server with WSAddressing enabled
sample-soap-sslShows how to configure SOAP web service with SSL secure connectivity
sample-soap-static-responseShows how to setup a static response generating SOAP web service server component
Samples Cucumber BDDDescription
sample-cucumberShows BDD integration with Cucumber
sample-cucumber-springShows BDD integration with Cucumber using Spring Framework injection
sample-cucumber-spring2Shows BDD integration with Cucumber Spring Framework support
Samples - RemoteDescription
sample-test-jarCreates an executable test JAR to run all integration tests
sample-test-warCreates a deployable test WAR to run all integration tests as part of a web deployment

Following sample projects cover message transports and technologies. Each of these samples provides a separate system under test application that demonstrates the messaging aspect.

Demo ProjectsKafkaJMSHttpSOAPChannelCamelSQLSYNCASYNC
sample-quarkusXXXXX
sample-bakeryXXXX
sample-flightbookingXXXX
sample-greetingXXXX
sample-bookstoreXXX
sample-incidentXXXXX

Pick your sample application for try out and got to the respective folder.

Preconditions

See the preconditions for using the Citrus sample applications:

  • Installed JDK 17 or higher plus JAVA_HOME environment variable set up and pointing to your Java installation directory

  • Apache Maven 3.9.x or higher The sample projects are executable via Apache Maven (http://maven.apache.org/).

In each of the samples folders you will find the Maven (POM) pom.xml that defines all dependencies and build plugins.

Run

You can run all the samples locally on your machine. We are using the Maven build tool for this.

All samples use some project as a system under test. These sample application has to be started before executing any Citrus tests. Many samples reuse the todo-list application which is a simple web application that provides a basic REST API.

You can auto start and deploy the todo-list application within the Maven build by using the following command:

 mvn clean install -Dsystem.under.test.mode=embedded

The embedded option automatically starts an embedded Jetty Web Server Container before the integration test phase in Maven. After that the Citrus tests will be able to perform its actions in integration-test phase in Maven. After the tests are finished the embedded Jetty container is automatically stopped.

You can also start the Jetty container manually by calling:

 mvn jetty:run-war

Execute this command in the respective sample folders and you will get a running Jetty Web Server Container with the system under test deployed.

Once the sample application is deployed and running you can execute the Citrus test cases in that sample folder. Open a separate command line terminal in that folder and execute the following command.

 mvn verify

This executes all Citrus tests in that sample. You can also pick a single test by calling

 mvn verify -Dit.test=<testname>

You should see Citrus performing several tests with lots of debugging output in both terminals (sample application server and Citrus test client). And of course green tests at the very end of the build.

Please read the instructions in each sample folder for different setup options and execution commands.

Information

For more information on Citrus see www.citrusframework.org, including a complete reference manual.