MCPcopy Index your code
hub / github.com/citrusframework/citrus

github.com/citrusframework/citrus @v5.0.0-M2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v5.0.0-M2 ↗ · + Follow
32,169 symbols 162,757 edges 4,307 files 9,159 documented · 28%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Citrus Integration Testing Logo

Maven Central build Javadocs Licensed under Apache License version 2.0 Chat on Zulip

Welcome to Citrus

Citrus is a test framework written in Java that provides a complete test automation tool for integration testing of message-based enterprise applications.

The framework supports a huge set of different message transports and protocols like Http REST, Kafka, JMS, TCP/IP, FTP, SOAP Web Services.

In addition to that Citrus integrates with many technologies and libraries such as Apache Camel, Spring, Quarkus, Testcontainers, Kubernetes, Knative, Selenium and many more.

For validation purpose Citrus is able to verify many different message data formats and protocols such as XML, Json, YAML, CSV, Plaintext, SQL ResultSet and more.

Visit the official website at 'https://citrusframework.org' for more information and a detailed documentation.

Quickstart

Learn how to create and run Citrus integration tests in just a few minutes. You can choose from a set of supported runtimes (JUnit, TestNG, Quarkus, SpringBoot, JBang) and domain specific languages (Java, XML, YAML, Groovy, Cucumber).

For a full guide how to get started with Citrus please visit the quickstart section on the official website.

The easiest way to create and run a Citrus test without a project setup is to use the Citrus JBang support.

You can just call this command to create a new test.

jbang citrus@citrusframework/citrus init MyTest.java

The init command creates a new file that represents a Citrus test. The file extension used defines the test source language. You can choose one of the supported test source languages .java, .xml, .yaml, .groovy, .feature.

The result looks like this:

import org.citrusframework.TestActionSupport;
import org.citrusframework.TestCaseRunner;
import org.citrusframework.annotations.CitrusResource;

public class MyTest implements Runnable, TestActionSupport {

    @CitrusResource
    TestCaseRunner t;

    @Override
    public void run() {
        t.given(
            createVariables().variable("message", "Citrus rocks!")
        );

        t.then(
            echo().message("${message}")
        );
    }
}

You can now just run the test without any project setup using the Citrus JBang run command:

jbang citrus@citrusframework/citrus run MyTest.java

You may also install the Citrus JBang app to simplify the command line tooling:

jbang trust add https://github.com/citrusframework/citrus/
jbang app install citrus@citrusframework/citrus

Now you can just call:

citrus init my.citrus.it.yaml
citrus run my.citrus.it.yaml

A more complex Citrus integration test typically uses messaging endpoints to send and receive messages with different messaging transports.

A typical Citrus Java JUnit Jupiter test may look like this:

import org.citrusframework.TestCaseRunner;
import org.citrusframework.TestActionSupport;
import org.citrusframework.annotations.CitrusResource;
import org.citrusframework.annotations.CitrusTest;
import org.citrusframework.junit.jupiter.CitrusSupport;
import org.junit.jupiter.api.Test;

@CitrusSupport
public class HelloServiceIT implements TestActionSupport {

    @CitrusResource
    private TestCaseRunner t;

    @Test
    @CitrusTest
    public void shouldSayHello() {
        t.when(
            http().client("http://localhost:8080/test")
                    .send()
                    .post()
                    .contentType("text/plain")
                    .body("Hello from Citrus!")
        );

        t.then(
            receive().endpoint("kafka:my-topic")
                    .message()
                    .body("Hello from Citrus!")
        );

        t.and(
            http().client("http://localhost:8080/test")
                    .receive()
                    .response(HttpStatus.OK));
    }
}

As you can see the test leverages several Citrus features like sending/receiving messages with different message transports. Receiving a message always comes with an expected message content, so Citrus performs a powerful message validation on body and header content. Citrus is able to handle different message types such as XML, Json, Plaintext, YAML, CSV and more.

You can easily integrate the test into your project with Maven, or you can just run the test without any project setup with JBang.

citrus run HelloServiceIT.java

Developing

The following software is recommended in order to code with the Citrus framework:

  • Java 17+ Installed JDK plus JAVA_HOME environment variable set up and pointing to your Java installation directory. Used to compile and build the Citrus code.

  • Maven 3.9.8+ Citrus projects will fit best with Maven. However, it is not required to use Maven. You can also run tests using Gradle for instance.

  • Java IDE (optional) A Java IDE will help you to manage your Citrus project (e.g. creating and executing test cases). You can use the Java IDE that you like best like Eclipse or IntelliJ IDEA.

  • JBang (optional) For fast prototyping you can use the Citrus JBang app as a command line tooling. It allows you to create and run Citrus tests without a project setup. Dependencies and Java runtime setup is automatically managed by JBang.

Samples

Our sample section is still growing. You can find several sample projects in the separate repository citrusframework/citrus-samples.

Support

In case you need help and support for Citrus have a look at https://citrusframework.org/help. Contact citrus-dev@googlegroups.com directly for any request or questions.

Issues

Please report any bugs and/or feature requests directly to citrusframework/citrus/issues

Resources

  • Clone the code repository https://github.com/citrusframework/citrus.git with Git to run the Maven build on your machine to get a fresh copy of the latest bits.

  • Find our blog and news articles about Citrus and checkout the various post categories for selecting a specific topic.

  • The official website https://citrusframework.org offers tutorials and more information about Citrus.

  • Review the individual release notes to learn about the changes for a release. For detailed description of changed packages and classes do also consult the GitHub commit history.

License

Copyright 2006-2025 the original author or authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Information

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

Extension points exported contracts — how you extend this code

CodeProvider (Interface)
@since 2.7.4 [13 implementers]
tools/test-generator/src/main/java/org/citrusframework/generate/provider/CodeProvider.java
TestAction (Interface)
Interface for all test actions. @since 2006 [8 implementers]
core/citrus-api/src/main/java/org/citrusframework/TestAction.java
CitrusInstanceProcessor (Interface)
Citrus instance processor takes part in instance creation process. [22 implementers]
core/citrus-base/src/main/java/org/citrusframework/CitrusInstanceProcessor.java
MessageSelectorFactory (Interface)
@since 2.7 [12 implementers]
endpoints/citrus-spring-integration/src/main/java/org/citrusframework/channel/selector/MessageSelectorFactory.java
VertxInstanceFactory (Interface)
@since 1.4.1 [7 implementers]
endpoints/citrus-vertx/src/main/java/org/citrusframework/vertx/factory/VertxInstanceFactory.java
CamelActionBuilderWrapper (Interface)
Special wrapper holding a Camel action builder for future reference. @param [102 implementers]
endpoints/citrus-camel/src/main/java/org/citrusframework/camel/yaml/CamelActionBuilderWrapper.java
WebServiceMessageConverter (Interface)
Converter is abel to create proper WebService message from internal message representation and vice versa. Converter is [15 …
endpoints/citrus-ws/src/main/java/org/citrusframework/ws/message/converter/WebServiceMessageConverter.java
XsdSchemaMappingStrategy (Interface)
Interface for schema mapping strategies used in schema repository. [20 implementers]
validation/citrus-validation-xml/src/main/java/org/citrusframework/xml/schema/XsdSchemaMappingStrategy.java

Core symbols most depended-on inside this repo

when
called by 5663
core/citrus-api/src/main/java/org/citrusframework/GherkinTestActionRunner.java
get
called by 5481
core/citrus-api/src/main/java/org/citrusframework/actions/http/HttpClientSendActionBuilder.java
build
called by 2273
core/citrus-api/src/main/java/org/citrusframework/message/MessageProcessor.java
assertNotNull
called by 1722
core/citrus-api/src/main/java/org/citrusframework/util/ObjectHelper.java
getEndpointConfiguration
called by 1619
core/citrus-api/src/main/java/org/citrusframework/endpoint/Endpoint.java
put
called by 1483
core/citrus-api/src/main/java/org/citrusframework/actions/http/HttpClientSendActionBuilder.java
add
called by 1331
core/citrus-api/src/main/java/org/citrusframework/message/correlation/ObjectStore.java
message
called by 1263
core/citrus-api/src/main/java/org/citrusframework/actions/FailActionBuilder.java

Shape

Method 26,570
Class 4,816
Interface 649
Function 92
Enum 42

Languages

Java100%
TypeScript1%

Modules by API surface

tools/test-api-generator/citrus-openapi-codegen/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/request/ExtPetApi.java688 symbols
endpoints/citrus-camel/src/main/java/org/citrusframework/camel/xml/JBang.java312 symbols
endpoints/citrus-camel/src/main/java/org/citrusframework/camel/yaml/JBang.java238 symbols
tools/test-api-generator/citrus-openapi-codegen/src/test/java/org/citrusframework/openapi/generator/GeneratedRestApiIT.java236 symbols
connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/xml/Start.java179 symbols
endpoints/citrus-ws/src/main/java/org/citrusframework/ws/xml/Soap.java150 symbols
tools/test-api-generator/citrus-openapi-codegen/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/petstore/request/PetApi.java146 symbols
endpoints/citrus-ws/src/main/java/org/citrusframework/ws/yaml/Soap.java144 symbols
connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/yaml/Start.java133 symbols
runtime/citrus-yaml/src/main/java/org/citrusframework/yaml/actions/Message.java125 symbols
endpoints/citrus-http/src/main/java/org/citrusframework/http/yaml/Http.java123 symbols
endpoints/citrus-http/src/main/java/org/citrusframework/http/xml/Http.java121 symbols

Datastores touched

testdbDatabase · 1 repos
(mongodb)Database · 1 repos

For agents

$ claude mcp add citrus \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page