Table of Contents

Evaluate event strategies through unit testing (8.3)

Automate Event Strategy rule testing through unit tests. By unit testing event strategies, you can detect design flaws that produce errors or return unexpected results. In addition, the option to unit test an event strategy decreases the number of resources that are required for testing coverage by eliminating the need to create a Data Flow and Data Set rules only for testing purposes.

By unit testing event strategies, you can perform the following actions to ensure that the event strategy configuration meets the design requirements:

  • Test whether the property values of emitted events meet specific criteria.
  • Verify whether the aggregation of the incoming events matches the expected results. You can assert that an event is emitted only when a specific aggregation threshold is reached (for example, only after three dropped calls are detected).
  • Affirm the number of events emitted. For example, you can check if an event strategy emits only one event that corresponds to a unique customer ID, in a specific time window.

The following example demonstrates how to create and run unit tests in event strategies. In this example, the test ensures that the following design criteria are met:

  • The number of aggregated input events per an emitted event is equal to 3.
  • The number of emitted events equals 1 for a unique customer ID.
Creating and running event strategy unit tests

For more information, see Unit testing event strategies.

Suggest Edit

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.