Martijn's blog - E-Commerce, EAI, BizTalk and .NET


Unit testing BRE policies

When Unit testing BRE policies, it might be useful to be able to declaratively define which RuleStore to use, which Policy to test and which Version to load. Using the Attributes I created, doing this become pretty simple. One of the Attributes also provides for a class Type to be instantiated implementing IRuleSetTrackingInterceptor, which allows tracking what the BRE does while executing the requested Policy. Have a look at the code, as I think it might be useful for many UnitTesting scenarios with version policies.

using it is quite simple:

using MartijnHoogendoorn.BizTalk.BRE.Testing.Attributes;

[PolicyTester("MyPolicy", typeof(MyInterceptor))]
[RuleStore("Integrated Security=SSPI;Database=BizTalkRuleEngineDb;Server=MyRuleEngineServer", "MYDOMAIN", "myusername", "mypassword")]

private void TestMyPolicy()
  XmlReader reader = new XmlTextReader(@"..\..\..\MyMessage.xml");
  XmlSerializer serializer = new XmlSerializer(typeof(MyMessage));
  MyMessageClass = (MyMessageClass) serializer.Deserialize(reader);

  MyInterceptor interceptor = (MyInterceptor) PolicyTesterHelper.ExecutePolicy(new object[] { "Some interesting value", someObject });
  foreach(string eventLine in interceptor.PolicyExecutionEvents)

See the sample code here for a real implementation


  • Hoping you can help!

    Hi there...using your new Biztalk Pipeline wizard 1.34 version. I wanted to get the "Basics" working on a custom pipeline component, and I'm still getting an error!

    I created a custom pipeline, and then created a simple xml message to pass through to the send port. On the send port, I speciified this pipeline.

    I used your wizard to create just the skeleton component. It does nothing...just returns the message.

    I then associated it with my send port.

    When I try to push a message through, I get this error.

    There was a failure executing the send pipeline: "PipeLineTest.Senddata" Source: "Microsoft.BizTalk.Messaging" Send Port: "C:\Projects\TestSystem\BizTalkProjects\Processing\OutBox\post%MessageID%.xml" Reason: AddDocument: The component "dataComponent" must implement the IAssemblerComponent interface.

    What am I doing wrong?

    By Anonymous Mikeh, at 3:56 AM  

  • Hi Mikeh,

    You selected "implement IAssemblerComponent interface" from the options when selection the class I guess. You now have a method called AddDocument, which should be implemented...

    Ping me by e-mail if you have other questions

    By Blogger Martijn Hoogendoorn, at 9:38 PM  

  • Martijn,

    Have a look at the Policy Verificatorfrom Acumen Business. This is a tool that automates the process of testing Business Rules. The tool should be able to find rule anomalies among rules, or within the premisse of a rule. The tool ships with some examples.

    I hope you like it.


    By Blogger Marco Ensing, at 1:20 AM  

  • Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
    Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

    By Blogger Adi, at 9:14 AM  

  • Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! Web Design Company

    By Anonymous Web Design Company, at 7:17 AM  

  • I absolutely love your blog and find almost all of your post’s to be precisely what I’m looking for. Does one offer guest writers to write content in your case? I wouldn’t mind creating a post or elaborating on a lot of the subjects you write regarding here. Again, awesome site!

    By Anonymous Gadgets UK, at 9:47 AM  

  • Thanks you. Very good post.Unless they can offer a really compelling reason for users to come back, it will be the next Bebo, MySpace

    By Anonymous 10755GF, at 11:09 PM  

  • Stephen Stapinski

    Really your blog is very interesting.... it contains great and unique information. I enjoyed to visiting your blog. It's just amazing.... Thanks very much for the share.

    By Blogger rocky case, at 6:19 AM  

Post a Comment

Links to this post:

Create a Link

<< Home