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 the subject and body of the email message. | |
File |
|
SOAP and .NET | 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 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.
-
Use the
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.
Testing details
See these topics for specific details about unit testing a specific type of service rule:
Service Email | Service EJB |
Service File | Service HTTP |
Service Java | Service JMS |
Service JSR94 | Service MQ |
Service .Net | Service SOAP |