Test with Kafka activities

Relevant for: API testing

This topic describes how to add and configure Kafka activities in your API test.

Overview

Use OpenText Functional Testing's native API testing capabilities to test your Kafka server.

Kafka activities enable you to test the main API functionality of your Kafka server. You can use these activities in OpenText Functional Testing to verify Kafka's data exchange processes, including the processes of publishing messages to topics, consuming or deleting messages from topics.

Kafka activities are independent of each other. You can add and configure one or multiple activities to serve your testing purpose.

Back to top

Prerequisite

Before you add a Kafka activity in OpenText Functional Testing, do the following:

  • You must have a Kafka server (Kafka broker) set up.

  • If your Kafka server is using SSL or Kerberos for authentication, configure the authentication settings for your test.

    Authentication mode How to configure
    SSL authentication
    1. Create an API test or open an existing API test.
    2. Right-click the Start node in the canvas and select Properties.
    3. In the Test Settings tab of the Properties pane, under Kafka SSL, configure the following SSL settings:

      • Enable SSL: Select Yes.

        Set this field only when your CA certificate is issued by one of the most trusted certification authorities in the industry.

      • CA certificate path: Optional. The path to the CA certificate file.

      • Client public key certificate path: Optional. The path to the public key certificate file. This is mandatory if your server requires client authentication.

      • Client private key path: Optional. The path to the private key certificate file. This is mandatory if your server requires client authentication.

    Kerberos authentication

    1. Create an API test or open an existing API test.
    2. Right-click the Start node in the canvas and select Properties.
    3. In the Test Settings tab of the Properties pane, under Kafka SASL, configure the following SASL settings:

      • Enable SASL: Select Yes.

      • Mechanism: The mechanism used to perform authentication. Select the following option:

        GSSAPI: A security mechanism that authenticates using Kerberos V5.

      • Service Name: The Kafka server name.

    Note: OpenText Functional Testing supports testing Kafka servers that use Kerberos authentication only on Windows.

Run tests of previous versions

When running tests created in OpenText Functional Testing versions earlier than 2022 on OpenText Functional Testing:

Before running tests with SSL authentication configured, do the following:

  1. Open the UFT.exe.config file in the <Installdir>\bin folder.

  2. Add the following line to the <appSettings> section of the file:

    <add key="ValidateWithSchema" value="false"/>

Back to top

Publish a message to a Kafka topic

This activity allows you to publish a message to a partition on a Kafka topic.

In the process, OpenText Functional Testing acts as a producer to test if a message can be successfully sent to the correct partition of the correct topic on your Kafka server.

To publish a message to a Kafka topic

  1. Create an API test or open an existing API test, and expand Kafka activities under the Kafka node in Toolbox > Standard Activities.
  2. Drag a Publish Message to Kafka Topic activity from Toolbox pane to the Test Flow in the canvas.
  3. In the Input/Checkpoints tab of the Properties pane, set the activity properties.

    You can enter the name of an existing topic hosted on your Kafka server or a new name. If you enter a new name, after this activity is successfully executed, a new topic with only one partition (partition 0) is created on your Kafka server.

    Note: If you leave the Partition parameter empty, the default value is used, that is, OpenText Functional Testing sends the specified message to partition 0. If you set this parameter to a negative value, the message will be sent to any available partition on your topic.

  4. If necessary, add checkpoints to validate this activity.

Back to top

Receive messages from a Kafka topic

This activity enables you to fetch all messages unconsumed by other consumers in the same group from a specified topic.

In the process, OpenText Functional Testing acts as a consumer. You must specify a Consumer Group ID for OpenText Functional Testing to retrieve messages that are not consumed by other consumers in the consumer group.

To receive messages from a Kafka topic

  1. Create an API test or open an existing API test, and expand Kafka activities under the Kafka node in Toolbox > Standard Activities.
  2. Drag a Receive Messages from Kafka Topic activity from Toolbox pane to the Test Flow in the canvas.
  3. In the Input/Checkpoints tab of the Properties pane, set the activity properties.

    You can set the Group ID to any value according to your test scenario. Remember to change the Group ID if you want to receive the same messages from the topic again.

  4. If necessary, add checkpoints to validate this activity.

Back to top

Receive a message from a specific offset/partition

This activity enables you to fetch a message from a specific partition at a defined offset.

In the process, OpenText Functional Testing acts as a consumer and always uses a new consumer group ID to retrieve a message from the specified offset on your Kafka server.

To receive messages from a specific offset/partition

  1. Create an API test or open an existing API test, and expand Kafka activities under the Kafka node in Toolbox > Standard Activities.

  2. Drag a Receive Message from Specific Partition/Offset activity from the Toolbox pane to the Test Flow in the canvas.

  3. In the Input/Checkpoints tab of the Properties pane, set the activity properties.

    Note: If you leave the Partition and Offset parameters empty, default values are used, that is, OpenText Functional Testing retrieves a message from partition 0 at offset 0.

  4. If necessary, add checkpoints to validate this activity.

Back to top

Receive messages starting from a specific offset/partition

This activity enables you to fetch all messages starting from a defined offset in a specific partition.

In this process, OpenText Functional Testing acts as a consumer and always uses a new consumer group ID to retrieve all messages starting from the defined offset on your Kafka server.

To receive messages starting from a specific partition/offset

  1. Create an API test or open an existing API test, and expand Kafka activities under the Kafka node in Toolbox > Standard Activities.

  2. Drag a Receive Messages Starting from Specific Partition/Offset activity from the Toolbox pane to the Test Flow in the canvas.

  3. In the Input/Checkpoints tab of the Properties pane, set the activity properties.

    Note: If you leave the Partition and Offset parameters empty, default values are used, that is, OpenText Functional Testing retrieves all messages starting from partition 0 at offset 0.

  4. If necessary, add checkpoints to validate this activity.

Back to top

Receive all messages from a Kafka topic

This activity enables you to fetch all messages from a Kafka topic.

In this process, OpenText Functional Testing acts as a consumer and always uses a new consumer group ID to retrieve all messages from the specified topic on your Kafka server.

To receive all messages from a topic

  1. Create an API test or open an existing API test, and expand Kafka activities under the Kafka node in Toolbox > Standard Activities.

  2. Drag a Receive All Messages from Topic activity from the Toolbox pane to the Test Flow in the canvas.

  3. In the Input/Checkpoints tab of the Properties pane, set the activity properties.

  4. If necessary, add checkpoints to validate this activity.

Back to top

Delete messages from an offset/partition

This activity enables you to delete all messages at offsets smaller than a specified offset in a partition. After you successfully execute this activity, you cannot recover the deleted messages.

To delete messages from an offset/partition

  1. Create an API test or open an existing API test, and expand Kafka activities under the Kafka node in Toolbox > Standard Activities.

  2. Drag a Delete Messages from Partition/Offset activity from the Toolbox pane to the Test Flow in the canvas.

  3. In the Input/Checkpoints tab of the Properties pane, set the activity properties.

    Note: If you leave the Partition and Offset parameters empty, default values are used and no message is deleted as offset 0 is the smallest offset.

  4. If necessary, add checkpoints to validate this activity.

Back to top