Citrus sample projects using Java DSL tests and Spring Java configuration
Java Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-annotation-config Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-behaviors Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-binary Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-camel-context Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-dictionaries Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-docker Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-dynamic-endpoints Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-gradle Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-hamcrest Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-javaconfig Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-jms Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-kubernetes Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-mail Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-message-store Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-reporting Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-rmi Update to 2.8.0-SNAPSHOT Jul 16, 2018
sample-selenium Update to 2.8.0-SNAPSHOT Jul 16, 2018
samples-cucumber Update to 2.8.0-SNAPSHOT Jul 16, 2018
samples-db Fixed jdbc sample with new dependency versions Jul 16, 2018
samples-ftp Update to 2.8.0-SNAPSHOT Jul 16, 2018
samples-http Optimized thread count in http load test Jul 16, 2018
samples-json Update to 2.8.0-SNAPSHOT Jul 16, 2018
samples-junit Update to 2.8.0-SNAPSHOT Jul 16, 2018
samples-remote Update to 2.8.0-SNAPSHOT Jul 16, 2018
samples-soap Fixed wssecurity sample with spring-ws 3.x Jul 16, 2018
samples-testng Update to 2.8.0-SNAPSHOT Jul 16, 2018
samples-xml Update to 2.8.0-SNAPSHOT Jul 16, 2018
todo-app Update to 2.8.0-SNAPSHOT Jul 16, 2018
.gitignore Add deployable test war sample Feb 16, 2018
README.md Cosmetic changes Jun 21, 2018
pom.xml Update to 2.8.0-SNAPSHOT Jul 16, 2018

README.md

Citrus samples Logo

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:

Samples Description
sample-reporting Shows how to add a custom reporter
sample-docker Shows how to use Citrus within Docker infrastructure
sample-kubernetes Shows how to use Citrus within Kubernetes infrastructure
sample-gradle Uses Gradle build to execute tests
sample-annotation-config Uses annotation based endpoint configuration
sample-javaconfig Uses pure Java POJOs for configuration
sample-behaviors Shows how to reuse test actions in test behaviors
sample-dictionaries Shows how to incorporate message manipulation using data dictionaries
sample-message-store Shows how to access internal message store
sample-binary Shows binary message content handling in Citrus
sample-hamcrest Shows Hamcrest matcher support in validation and conditions
sample-mail Shows mail server activities in Citrus
sample-selenium Perform UI testing with Selenium and Citrus
sample-dynamic-endpoints Shows dynamic endpoint component usage
sample-jms Shows JMS queue connectivity
sample-rmi Shows how to use RMI with Citrus as a client and server
sample-camel-context Interact with Apache Camel context and routes
Samples DB Description
sample-jdbc Simulates database server with JDBC
sample-jdbc-callable-statements Simulates database server communication using callable statements
sample-jdbc-transactions Simulates database server with transactional JDBC
sample-sql Validates stored data in relational database
Samples JSON Description
sample-json Shows Json payload validation feature with JsonPath validation
sample-databind Shows JSON object mapping feature when sending and receiving messages
Samples XML Description
sample-xml Shows XML validation feature with schema and Xpath validation
sample-oxm Shows XML object marshalling feature when sending and receiving messages
sample-xhtml Shows XHTML validation feature
Samples FTP/SFTP Description
sample-ftp Shows FTP client and server interaction in Citrus
sample-sftp Shows SFTP client and server interaction in Citrus
sample-scp Shows SCP client and server interaction in Citrus
Samples TestNG Description
sample-testng Shows TestNG framework support
sample-dataprovider Shows TestNG data provider usage in Citrus
Samples JUnit Description
sample-junit Shows JUnit4 framework support
sample-junit5 Shows JUnit5 framework support
Samples Http Description
sample-swagger Auto generate tests from Swagger Open API
sample-http Shows Http REST API calls as a client
sample-http-loadtest Calls REST API on Http server with multiple threads for load testing
sample-http-static-response Shows how to setup a static response generating Http server component
sample-http-query-param How to use Http form data with x-www-form-urlencoded Http POST
sample-http-form-data Exchange form data via Http GET/POST
sample-http-basic-auth Shows how to use basic authentication on client and server components
sample-https Shows how to use SSL connectivity as a client and server
Samples SOAP Description
sample-wsdl Auto generate tests from WSDL
sample-soap Shows basic SOAP web service support
sample-soap-mtom Shows how to send and receive MTOM enabled SOAP attachments
sample-soap-attachment Shows how to send SOAP attachments to server
sample-soap-wssecurity Shows how to configure SOAP web service client and server with WSSecurity enabled
sample-soap-wsaddressing Shows how to configure SOAP web service client and server with WSAddressing enabled
sample-soap-ssl Shows how to configure SOAP web service with SSL secure connectivity
sample-soap-static-response Shows how to setup a static response generating SOAP web service server component
Samples Cucumber BDD Description
sample-cucumber Shows BDD integration with Cucumber
sample-cucumber-spring Shows BDD integration with Cucumber using Spring Framework injection
sample-cucumber-spring2 Shows BDD integration with Cucumber Spring Framework support
Samples - Remote Description
sample-test-jar Creates an executable test JAR to run all integration tests
sample-test-war Creates 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 applicaiton that demonstrates the messaging aspect.

Demo Projects JMS Http SOAP Channel Camel Arquillian JDBC SYNC ASYNC
sample-bakery X X X X
sample-flightbooking X X X X
sample-greeting X X X X
sample-bookstore X X X
sample-incident X X X X X
sample-javaee X X X X X

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 1.8 or higher plus JAVA_HOME environment variable set up and pointing to your Java installation directory

  • Apache Maven 3.0.x or higher The sample projects are executable via Apache Maven (http://maven.apache.org/). You need ANT installed and running an your machine in order to use this way of executing the sample applications.

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 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 -Dembedded

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.