13.4    Testing Business Rules

Before a business rule is deployed on the server, it’s best practice to perform some unit test (i.e., test the rules locally). In this section, you’ll learn how to do that with a few different methods.

Depending on the type of test scenario (e.g., functional or technical) and the specific test requirements, you can test business rules in different ways in SAP PO. Which test approach you choose also depends on whether your business rules are exposed as a web service or not. The different test options you have include the following:

Using the WS Navigator or using an external test tool require that you’ve previously generated and configured an existing ruleset or flow ruleset as a web service so that it can be exposed as a web service.

How to Generate a Web Service for Business Rules

You can generate a web service for business rules in SAP PO as follows:

  1. From SAP NetWeaver Developer Studio, expand the Rules Composer DC containing the Rules Modeling nodes.
  2. Select a ruleset or flow ruleset, and right-click on it. Choose Web ServiceCreate WSDL Artifact from the context menu.
  3. A dialog box is shown in the wizard with the Service Attributes page; accept the default values, or apply changes if necessary to the suggested values. Click on Next.
  4. The Service Signature page is presented, the input and output types appear, and the checkboxes are selected by default. Click on Next.
  5. The WSDL Preview page is shown. By this point, you should be able to see the contents (WSDL parts) of the new web service.
  6. Click on Finish.
  7. Deploy the DC containing the business rules on the server.

Figure 13.22 shows the service attributes for the new ruleset web service.

Ruleset as Web Service

Figure 13.22    Ruleset as Web Service