You are here: Reference > Rule types > Service SOAPs > How to Unit Test a Service SOAP Rule

How to Unit Test a Service SOAP Rule

Services start their processing in response to a request from an external application. Before you add the external application to your testing process, use the Simulate SOAP Service Execution feature to verify that the service processes data appropriately. When using this feature, you manually provide some representative data to process. You specify a test page for the rule to use, provide sample data as the input, run the rule, and examine the results to see if they are what you expect.

If you have the AutomatedTesting privilege (through an access role), you can use the features of Automated Testing such as saved test cases and unit test suites for testing your Service SOAP rule. See About Automated Unit Testing and Working with the Test Cases tab for more information.

Before you Begin

Before you begin testing the Service SOAP rule, determine how you will provide the sample data for the service rule to process. For help with this step, and for information about additional ways to test your services, see the articles about testing services and connectors in the Testing Applications category of the PDN.

Run the Rule

Complete the following steps:

  1. Save the rule.
  2. Optionally, start the Tracer by selecting Availability from the Quick Launch bar. See Tracer tool   — Tracing services.
  3. Click the Run toolbar button Run.
  4. Fill out the fields in the form as described in the following table:

    Field

    Description

    Test Cases

    If you have the AutomatedTesting privilege, Run Against a Saved Test Case, Show Saved Results, and Run Test Case are available if this rule has saved test cases. To run the rule and see how its behavior compares to that in a previously saved test case, select a choice from the Run Against a Saved Test Case drop-down list.

    After making your selection, click Run Test Case. If differences are found between the results of running the current state of the rule and the saved test case, they are displayed and you have the options of choosing to ignore differences for future test runs, overwriting the saved test case, and saving the results. (See the Playing back saved test cases section in Working with the Test Cases tab.)

    Click Show Saved Results to view any previously saved test case results.

    Requestor Context

    Select one of the following items to specify which requestor session to use in the test:

    • Use current requestor context — Runs the rule in your session, that is, with your RuleSet list, privileges, and current clipboard.
    • Initialize service requestor context — Run the rule in a newly created service requestor session based on the APP requestor type and, if the service package requires authentication, another Operator ID instance.
    Authentication
    User ID

    If you selected Initialize service requestor context, and the service package for the service requires authentication, enter the Operator ID to use to test the service.

    Authentication
    Password

    If you selected Initialize service requestor context, and the service package instance for the service requires authentication, enter a password for the Operator ID.

    Enter Request Data

    Select one of the following to define the source of request data values for this test:

    • Specify individual request values — This option appears only when all elements of the message are simple text values, not arrays or complex values of type XML Page.
    • Supply SOAP Envelope — You can enter an entire SOAP message including the header.
    SOAP Header Values

    add row If you selected Specify individual request values for the previous field, in the Value field, enter a literal constant value for each Header Field row on the Request tab. Enter a value that matches the XSD type shown.

    SOAP Parameter Values

    add row If you selected Specify individual request values for the previous field, in the Value field, enter a literal constant value for each Request Parameters row listed on the Request tab. Enter a value that corresponds to the XSD data type shown.

    SOAP Request Envelope

    If you selected Supply Soap Envelope, enter or paste a well-formed and valid XML document in the SOAP Request Envelope text area, starting with the <?xml version=“1.0” ?> declaration.

    If the service expects requests containing an array element or XML Page elements, a skeleton document is provided as a starting point.

  5. Click Execute  to run the rule. The system runs the rule and displays the results.
  6. Optional. Click the Show Clipboard icon in the Quick Launch area to see the clipboard pages that were generated.
  7. Run the rule again using different data, as necessary.
  8. Optional. If you have the AutomatedTesting privilege, the Save as Test Case  button is available and you can click it to create a Test Case that holds the test data and the results.