Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Automated API testing for the KIE Server

May 1, 2020
Juliano Mohr
Related topics:
ContainersDeveloper ToolsDevOpsMicroservices

Share:

    In software development, much has been said about testing and there are many ways to think about it. In the context of agility and DevOps, automated testing is considered a foundation for the principles of flow and fast feedback. Considering the implementation of jBPM and Drools within a software delivery project, it becomes natural to think about how to support reliable automated testing for both stages of development and continuous integration.

    The KIE Server is a standalone component that can be used to execute business processes and rules via a REST API interface. This article explores the concept of API testing where consumers are expected to interact with the APIs provided by the KIE Server. The test cases consist of HTTP requests and responses exchanged against a live server. Consequently, these test cases are completely agnostic to the technology behind the API, just like real consumers are expected to be.

    Why API testing?

    The API testing approach was previously described as agnostic, but what does that mean? Perhaps it's worth explaining by listing the benefits:

    • Tests are decoupled from changes in the system under test as long as the API contract is satisfied.
    • Higher confidence, as tests assert on exact upstream expectations.
    • Independence, as tests can be maintained as a separate artifact.
    • Scalability, as tests can be adapted to also assess performance.

    What about unit testing?

    Yes, unit testing is important and should not be neglected. There are well-established techniques in the jBPM and Drools ecosystem to unit test knowledge assets. Such techniques usually comprise of either plain JUnit or the test scenarios offered by Business Central (aka The Workbench).

    However, there are challenges that unit tests cannot address, especially if JUnit is not an option for your project. In that case, you are limited to only what Business Central offers:

    • Testing rule flows, where the combination of rules fired must be taken into account.
    • Testing transformations that occur with the input and output of the REST API.
    • Writing API testing even with no Java or JUnit skills.
    • Testing API performance (did I mention performance testing already?)

    Having said that, it is well known that unit tests are faster and simpler to write, maintain, and troubleshoot. Therefore, one should favor them whenever possible.

    Example implementation with Postman and containers

    If you read along to this point you must be looking for something concrete. Before we get started, Figure 1 illustrates what follows later.

    Automated API Testing for the KIE Server
    Automated API Testing for the KIE Server
    Figure 1: The example implementation.">

    Postman is a popular tool for creating and executing HTTP requests. Walking through the diagram, notice that Postman is a core component in this implementation. With it, developers write test cases that are grouped into collections and later exported to a native JSON format. This exported JSON collection is then used as an input to Newman, which is a powerful command-line collection runner for Postman. It allows you to run and test a Postman collection directly from the command line.

    The system we are testing is Red Hat JBoss Enterprise Application Platform running the KIE Server, which has the KJAR deployed.

    Finally, both Newman and JBoss / KIE Server are bootstrapped in Linux containers. This setup particularly enables:

    • Fast provisioning of components.
    • No need to worry about dependencies (NodeJS, Java, etc).
    • No difference when executed local or in the CI agent (e.g. Jenkins).

    Experiment

    In this example, docker and docker-compose are used to simplify the user experience. They are, together with Git, the only pre-requisites to running through the steps:

    $ git clone https://github.com/juliaaano/rhdm-quickstart.git && cd rhdm-quickstart 
    $ docker-compose up --detach --force-recreate rhdm-jboss

    Check the logs and wait for KIE Server to startup:

    $ docker-compose logs --follow rhdm-jboss

    Run the postman tests:

    $ docker-compose run --rm postman

    Notice it is possible to launch and build the containers directly with other tools such as Podman, Buildah, and Docker itself.

    You can also build the container image locally, which is useful if you made any changes to the source code. This process takes a bit longer, especially in the first run when there is no Docker cache on disk. Additionally, authentication is required with Red Hat's container registry to access the base image:

    $ docker login registry.redhat.io
    $ docker build --file d.jboss.Dockerfile --tag juliaaano/rhdm-jboss .

    Once a new image is built, repeat the step:

    $ docker-compose up --detach --force-recreate rhdm-jboss

    In the GitHub project you just checked out, there are instructions for how to run the same app with Spring Boot instead of JBoss EAP. Look over the project's README for more information.

    The example above features a business rules application, so business processes are left aside. However, the elements demonstrated there should not change and are also applicable to jBPM. KIE-Server and Business Central are integral parts of the Red Hat Decision Manager (RHDM) and Red Hat Process Automation Manager (RHPAM) platforms.

    Last updated: June 26, 2020

    Recent Posts

    • Migrating Ansible Automation Platform 2.4 to 2.5

    • Multicluster resiliency with global load balancing and mesh federation

    • Simplify local prototyping with Camel JBang infrastructure

    • Smart deployments at scale: Leveraging ApplicationSets and Helm with cluster labels in Red Hat Advanced Cluster Management for Kubernetes

    • How to verify container signatures in disconnected OpenShift

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue