O'Reilly logo

Professional BizTalk® Server 2006 by Ewan Fairweather, Kevin B. Smith, Darren Jefford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.4. Testing

Testing is an important part of business rules and can be done in two main ways:

  • BRE authors and developers can test rules in the comfort of the Rules Composer by using the Test Policy feature.

  • Developers can use test rules by using the PolicyTester class.

Both of these methods enable you to test unpublished and undeployed rules, whereas the usual rules execution approach requires that rules be both published and deployed.

7.4.1. Test Policy

To display the Test Policy dialog box, shown in Figure 7-25, right-click a rules policy version in the Policy Explorer and choose Test Policy.

Figure 7.25. Figure 7-25

All the fact types required for the rules policy are displayed, and you can provide instances of these fact types to be used to test the policy. XML- and database-based fact types can be provided automatically by the tool.

To browse to an XML file or select a SQL Server database (or so forth), click Add Instance. If you want to use a .NET-based fact, however, you need to provide a custom fact creator. The custom fact creator will create these types, initialize them, and return them so that they can be asserted into the BRE. Of course, you can use a custom fact creator to assert database and XML facts as required. (You could, perhaps, have a fact creator for each type of test, each asserting different data to produce different results.)

Custom fact creators are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required