BPELUnit Tutorial - Testing a simple Hello BPEL Process

Remark: This tutorial has been created as part of the lecture "Development of Service-Oriented Architectures and Applications" (Entwicklung service-orientierter Architekturen und Anwendungen (SOA)).

Author: Daniel Lübke
Version: 2009-03-13

This tutorial describes how to test a simple BPEL process with BPELUnit. It is assumed that you have already installed BPELUnit and that you know how to develop rudimentary BPEL processes and deploy them onto your BPEL engine.


This tutorial assumes ...

Course of Action

  1. Download and import the HelloBPEL process: Within this tutorial you will work with the HelloBPEL process from the first BPEL tutorial. To go ahead, download this process here. The version you can download is bundled with an Apache ODE deployment descriptor. However, the BPEL constructs used are so simple that you should be able to easily deploy this process on any server. If you are not familiar enough with BPEL, you can revisit the BPEL tutorials. After you have downloaded the archive, import it into Eclipse: Create a new project named HelloBPELProcess and select Import from the project's context menu. The process is very simple as you can see in the following picture: It just takes some input like Name and returns Hello Name.

    Screenshot: The HelloBPEL Process

  2. Deploy the Process: Deploy the BPEL Process. If you experience difficulties and use Apache ODE, follow the instructions in this tutorial.
  3. Create a new Test Project: Create a new Eclipse project. The project does not need to have a special facade, therefore choose File / New / Project / General / Project and name the project HelloBPELTest. Within this project, the BPELUnit test suite will be created.
  4. Create a new BPELUnit Test Suite: All test cases are defined in so-called Test Suites. Create a new test suite by choosing File / New / Other / BPELUnit / BPELUnit Test Suite.

    Screenshot: Create a new Test Suite

    Place the suite in the suggested location. After you have successfully created the test suite, the Test Suite Editor should show up as illustrated in the following figure.

    Screenshot: Empty Test Suite Editor

  5. Fill in Process Information: General information has to be entered in the test suite. The Base URL is unimportant for us now, just fill in http://localhost:7777/ws. As the PUT (process under test) name, give HelloBPEL. Because the BPEL process has been deployed manually beforehand, choose the Fixed Deployer as the PUT type. The editor should now look like this:

    Screenshot: Entering General Information

  6. Specifying the BPEL WSDL: Because BPELUnit needs to call the BPEL process, the WSDL file that describes the service needs to be specified . Create a new folder wsdl in the test project and copy the HelloBPELArtifacts.wsdl from the HelloBPEL project there. Now you can choose the WSDL in the Test Suite Editor. Please be aware that the WSDL file has to contain the correct endpoint address for your process. If you have deployed the BPEL process differently (not on Apache ODE or on another host), you have to change the WSDL!
  7. Create a new Test Case: Because no other services are defined, leave the partners section empty and define the first test case: Choose Add... in the Test Cases and Tracks section. Name the new Test Case Donald and do not alter the other settings. As you can see the test case Donald appears that has one partner client. The client simulates a real client and will be responsible for calling the BPEL process.
  8. Send a Message to the Process: Select the client and choose Add... but this time in the Activities section! Activities describe the test scenario. Therefore, you will add a new message exchange for the test case. Because there are a variety of possible message exchange patterns (MEPs), you have to choose how BPELUnit shall interact with the BPEL process. Because the process is a simple Receive-Reply process, choose Send/Receive Synchronous as shown in the picture:

    Screenshot: Choose Send/Receive Synchronous

    In the following dialog choose the port type, binding, and the operation (you only have one choice because it is a very simple process). More complicated is the XML to be sent as the payload of the SOAP message. You can inspect and define the XML namespaces by clicking on the namespaces link. BPELUnit has automatically defined hel as the prefix for the HelloBPEL process. Enter the following XML as the message payload:
    Your dialog should look like the one in the figure now:

    Screenshot: Define send operation

    Choose next for defining the assertions for the response message. Assertitions consist of an XPath query and an expected value. Choose Add and enter //hel:result as the XPath query and 'Hello Donald' as the expected value. Please be aware of the quotes that are necessary to denote that Donald is an XPath string. Your dialog should then look like in the following figure:

    Screenshot: Define assertion on the incoming message

    Now choose Finish to create the new activity.
  9. Run the Test Suite: Make sure your the HelloBPEL process is deployed and accessible and your BPELUnit Test Suite is saved. Select the suite.bpts file in the Project Explorer and choose Run as / BPELUnit Test Suite from the context menu of the suite.bpts file. The BPELUnit view should appear, in which you can observe the progress of the test run. Like with the JUnit view, a green bar means that everything went fine and a red bar means that a test failed. If you have done everything correctly, you should see a green bar like in the picture:

    Screenshot: Apache ODE Deployment Descriptor

    In the bottom part of the BPELUnit view is an area for technical details. You can browse through the test run structure to inspect the SOAP messages, which were sent, and the assertions and their results.


Now you know the basics of testing with BPELUnit. You can experiment with your own new assertions and try some tests that fail so you can see how a failed test looks like.

Eclipse Projects

Both the HelloBPEL Process as well as the corresponding test project can be downloaded. You can import the projects directly into Eclipse.

Last Update: 2009-03-13 by Daniel Lübke