You are here: Integration > Integration Services category > How to provide test data when testing service rules

How to provide test data when unit testing service rules

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 Type

Test 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.
Email

Manually 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 .NET
  • Manually provide values for each parameter.
  • Provide the entire SOAP request parameter.

Additionally, 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 an example, locate and open one of the following standard activities:

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.

Testing details

See these topics for specific details about unit testing a specific type of service rule:
Service EmailService EJB
Service FileService HTTP
Service JavaService JMS
Service JSR94Service MQ
Service .NetService SOAP
Integration Services category