Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Providing test data when unit testing service rules

Updated on November 15, 2021

When unit testing service rules, you can provide some representative data for the service rule either by typing or pasting in text, or by identifying an activity that will generate the test data.

Determine the source of the test data

Before you begin, determine how you to provide the sample data for the rule to process. Each service rule type has different options.

Service TypeTest Data Options
EJB, HTTP, JMS, Java, JSR 94, and MQ
  • Manually provide values for each parameter.
  • If the request data includes objects rather than scalar values, identify an activity that sets the values.
EmailManually provide values for the subject and body of the email message.
File
  • Manually provide content that is similar to file input.
  • Browse to and select a test input file for the service to process.
SOAP and .NETAdditionally, if the rule has data mappings for request headers, you must enter values for them, too.

Create activities that set up request data

If the EJB, HTTP, JMS, Java, JSR 94, or MQ service rule that you want to test receives objects rather than scalar values in the request, you cannot provide request values directly in the unit testing form. Instead, create and identify an activity that sets the request values.

The Data-Admin-IS-ClientSimulation class is a helper class for the unit testing feature. A page of class Data-Admin-IS-ClientSimulation serves as temporary storage location for the test data that the unit testing feature uses to test a service rule. Your activity must create a page named pySimulationDataPage for the Data-Admin-IS-ClientSimulation class and store the test request data on that page.

  • For the test message data, configure the activity to put the values in the Java Object List property named pyRequestObjectValues.
  • If the test message is for an HTTP, JMS, or MQ service, your simulation activity must also provide any information that is required for header fields or message properties.
    • Use the Value Group property named pyRequestHeaderGroup to store test data for HTTP, JMS, or MQ header fields.
    • Use the Value Group property named pyRequestPropertyGroup to store test data for JMS message properties.

For an example, locate and open one of the following standard activities:

  • Rule-Service-.SetRequestData
  • Data-Admin-IS-ClientSimulation.SetRequestData

You can use one of these activities as the template for yours: save it into the appropriate RuleSet and specify the same Applies To class as that specified as the primary page class on the Service tab of the service rule that you want to test.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us