How to create a test case - 6.3

Talend Real-time Big Data Platform Studio User Guide

EnrichVersion
6.3
EnrichProdName
Talend Real-Time Big Data Platform
task
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

To create a test case for a Route, do the following:

  1. Open the Route for which you want to create a test case. For example, create a test case for a Route using a cTimer, a cProcessor, and a cLog component.

  2. Right-click the functional part of the Route you want to test and select Create Test Case from the contextual menu, the cLog component in this example.

  3. The [Create Route Test Case] wizard opens. Enter a name for the test case in the Name field, and the optional information, if needed, such as purpose and description in the corresponding fields.

  4. The Create a Test Skeleton check box is selected by default so that the components required for the test case to work are automatically added. Click Next.

    Note

    If you clear this check box, you will need to complete the test case by adding components of your choice manually.

  5. The [Define Test Skeleton details] view of the wizard opens, allowing you to use a cMock or a cDataset as the message producer, and a cMock to check the result.

    When enabling the Mock first component option and using a cMock or a cDataset as the message producer, the test case will start with the testing component cMock or a cDataset. The selected component from the Route will be added behind the testing component. If you selected a message producer in the Route, it will become a consumer in the test case.

    If the Route contains any standalone component, for example, the cConfig, cBean and so on, they will be shown in the [Define Test Skeleton details] view of the [Create Route Test Case] wizard. You choose to copy them into the test case.

    Select the component you want to use and Click Finish to close the wizard. The test case is then created and opened in the design workspace, with all the required components automatically added, allowing you to test any types of input and output messages.

    In the Repository tree view, the newly created test case appears under your Route.

    The generated skeleton depends on the component(s) selected in the Route to create the test case. Note that you should not change the components between the INPUT and OUTPUT items in the test case. In this example, the test case aims at:

    • generating test message exchanges and reading input test data (cTimer_1 and cMock_1 components),

    • transforming data with an immutable set of components (INPUT and OUTPUT items) based on the initial Route,

    • checking that messages have been routed as expected and validating the test output result (message content, count, header, and so on.) using the cMock_2 component.

    Depending on the number of input and output flows, a variable number of context variables are automatically created to specify the input and reference files.

    For more information about the cMock or cDataset component, see the Talend ESB Mediation Components Reference Guide.