Difficulty: Beginner
Estimated Time: 10 minutes

In this tutorial you'll learn how to test HTTP REST APIs with Citrus integration Testing Framework.

Citrus is a Java based integration testing framework, that allows integration tests against various message protocols and data formats (HTTP, JMS, TCP/IP, SOAP, FTP, SSH, XML, JSON, Mail, just to name a few). Therefore it is suitable to test microservice based environments or other distributed systems. This makes it especially useful to test applications that runs on Kubernetes oder Openshift

System under test

The system under test, we want to perform our integration tests on, is a simple todo app with a few endpoints allowing us to communicate with other software components (e.g. a frontend).

You can list all todos, create new todo entries and remove the entries from the list.

You'll deploy this application to OpenShift in the first step.

In this session you've learned, how to test HTTP REST APIs using the Citrus HTTP client endpoint. In addition, you've tested a more complex workflow consisting of various steps to ensure that the system under test works as expected.

Congratulations! You've completed the tutorial!

If you are interested in more Citurs examples, visit the citrus-samples repository on GitHub.

Citrus Introduction

Step 1 of 5

Deploy to OpenShift

In this Tutorial you are going to learn how to test an HTTP/Rest driven application with Citrus Framework. One benefit of htis Framework is, that it tests systems based on messages and protocals. This makes the tests independet from the implementation technology of the system under test. You'll now test a HTTP-Api wich is written in Javascript and running on nodejs in an Openshift-cluster.

But first things first: You need a running system under test in order to test it.

We prepared a simple api-application on Github which you'll deploy on openshift in this step.

Thanks to Openshifts capabilites to deploy applications from a Dockerfile this requires only a few steps.

First of all you need a Openshift Project, so login to the OpenShift cluster:

oc login -u developer -p developer

This will log you in using the credentials:

  • Username: developer
  • Password: developer

Then run

oc new-project todo-api-sut

to create a new Project todo-api-sut in Openshift (this project is automatically set as your active project).

Now you can deploy he application by the Dockerfile directly from Github.

oc new-app https://github.com/tnobody/todo-example-api.git --name=todo-api

Since the deployment might take a little time you can follow the progress with:

oc logs bc/todo-api --follow

This will create the application on Openshift. To have access to this application as an endpoint you have to create a Route with:

oc expose svc/todo-api

If everything works fine you should access the [index page] (http://todo-api-todo-api-sut.[[HOST_SUBDOMAIN]]-80-[[KATACODA_HOST]].environments.katacoda.com).