Santosh Benjamin’s Weblog

July 16, 2009

BizUnit 3.1

Filed under: BizUnit, Testing — santoshbenjamin @ 4:25 pm

BizUnit 3.1 is now released. (Actually its been out for over a week). There are a few bug fixes in this release and most notable is the addition of the following steps that Bram Veldhoen contributed.

  • BizTalkSteps/ExecuteMapStep
  • BizTalkSteps/ExecuteReceivePipelineStep
  • BizTalkSteps/ExecuteSendPipelineStep

The Pipeline steps use Tomas Restrepo’s Pipeline Testing Library.

I had originally planned on incorporating Bram’s steps into Extensions as I wrote previously.  However after discussing with Kevin, those plans changed so its now in the core BizUnit.

There is a similar MapExecutingStep in Extensions that has been around for a while now and when I get some time I’ll take a closer look at Bram’s step and see if there are any differences that are worth keeping or retire the Extensions step if not required anymore. I have had a couple of bugs reported on Extensions beta-1 which I shall fix soon and get the RTM released which will be compiled against BizUnit 3.1.

May 25, 2009

BizUnitExtensions_v3.0 Beta-1

Filed under: BizUnit, Biztalk, Testing, Tools — Tags: , — santoshbenjamin @ 10:56 pm

Finally made some progress on BizUnitExtensions and have released Beta-1 for the new version which now complies with BizUnit 3.0’s object model. This release specifically centres around the main Extensions and the Extensions.BizTalk  libraries.

Main changes

  • The Altova library has now been deprecated as there is much better xml validation support in the .NET Framework so the altova library is redundant.
  • The steps for manipulating applications, receive locations and send ports have now been completely overhauled, so there is a separate ApplicationConductorStep, ApplicationGetStatusStep and ApplicationVerifyStatus step and likewise for ReceiveLocations and Send Ports. The GetStatus steps will load the current status into the context which can be useful when we need to use that info in subsequent steps. VerfyStatus will check the status against a given value.
  • The ReceivePortConductorEx step in the old code-base has been transitioned to the above mentioned set of ReceiveLocation steps as it really was dealing with locations rather than the ports. There is a new ReceivePortConductor step which allows the bulk enabling and disabling of all the locations in that port.
  • Updates to the Orchestration Conductor allowing a STOP action on an orchestration.
  • The namespaces and assembly names have all been revised (for example, using the Biztalk steps requires the assembly name to be BizUnit.Extensions.BizTalk.dll) so your existing test cases will need to be updated.

Forthcoming Updates and Releases

  • Bram Veldhoen has contributed a fair amount of code including steps to link in with the Pipeline Testing Library. I will incorporate that into Beta-2 as I need to work through all the steps and the associated helpers and utility classes.
  • I have updated the Oracle and EntLib libraries as well, but haven’t had any time to test them. As I now have Oracle XE, I should be able to make some progress on that pretty soon. With EntLib, its a little more complicated. As I didnt write those steps myself, I am not too familiar with the code, so it will take a while to update. So for the present, its still using EntLib 3.1. 

Workspace Updates

  • The codeplex workspace has also been cleaned up and slimmed down drastically. A lot of the pointers to tutorials etc are all largely redundant anyway.
  • The Roadmap page has been completely rewritten. The framework has come a long way since that material was written. The only stuff left there is a list of probable new steps and some ideas for tooling around BizUnit which may make it into some future version of the framework.

Hope you find the updates useful. Let me know if you encounter any bugs or if you have any suggestions.

February 5, 2009

BizTalk Testing and Mocks

Filed under: BizUnit, Biztalk, Coding, Mock Objects, Testing, Tools — santoshbenjamin @ 11:08 pm

In an earlier article , I had briefly mentioned that some folk had used mocks with Biztalk, notably to test pipeline components. Since I didnt have the bookmarks at hand then I didn’t provide the links, but I have since found the links again so here they are (and I can also now use this as a note to self if I want to refer to them again or expand on any of the material they have written).

While the  blog posts pointing to the Pipeline Testing Library are useful, if you want to go straight to the source, check out the WIKI page that Tomas has set up on GitHub. That page has more samples on how to use the API.

I’m going to have a play around with MoQ and pipeline components in the next couple of days . I think MoQ’s approach is a bit more elegant than Rhino (particularly, the absence of record and replay). I’m also going to link into Tomas’s excellent pipeline testing library from BizUnitExtensions. This has been a long overdue item on my roadmap.

UPDATE: Bram Veldhoen has already done some work on linking the Pipeline Testing Library into BizUnit and has very graciously contributed his code to be put into BizUnitExtensions so that will be released soon with Extensions 3.0.

Enjoy the links and if you find others of a similar ilk that are also useful feel free to put them in the feedback section here and I will update the post.

January 14, 2009

On the ‘Opacity’ of Orchestrations

Filed under: BizUnit, Biztalk, Testing — santoshbenjamin @ 2:11 pm

Richard Hallgren recently sent me a link to a question that was posted on StackOverflow dealing with “Mocking Web Services consumed  by Biztalk Request Response ports” and asked for my thoughts on the subject as BizUnit and BizUnitExtensions were both mentioned. There were a couple of posts there at the time, one questioning why bother, another directing him to use SoapUI and another really good reply by David Hall on the topic of mock BizTalk adapters (which I want to talk about in some more depth later). David’s points helped me crystallize some of my thoughts on the subject of testing orchestrations and I replied there and figured that it was a good subject to blog about in more detail.

David raised the point about there not being real ‘unit tests’ in BizTalk (at least not unit tests in the purist sense of the word) and that the ‘opaque’ nature of orchestrations made it very difficult to actually ‘unit’ test them. He did also raise the point about BizUnit being a bit of a misnomer (the ‘Unit’ part being somewhat misleading to someone new to BizTalk). I do agree with the points he raises there. Here are some of the things I wrote there and which I will expand upon to some extent in this post and some extra points.

One approach which I have recently got sold on is the use of mock object frameworks (such as MoQ, RhinoMocks, TypeMock and NMock2). I used NMock2 in my last ASP.NET project and have recently started with MoQ which i think is much better and i’m really getting into the lambdas.. they make expressing intent so much more concise. I’ll write a bit more about how I’m using them in another post, but suffice to say here that, although I havent tried it myself, several Biztalk folk have successfully used mock objects to test pipeline components.

Orchestrations unfortunately, in this respect (of being able to completely control what their dependencies are and ‘faking’ the behavior of the dependency) can be considered opaque. But there are good reasons for that.

a) Because of the huge subscription system in the message box – that orchestrations use when being activated etc, it is not possible to fire up some “virtual” process to host the orchestration (I think Tomas’s Pipeline Testing Library does something along these lines for pipeline components, but I havent had the opportunity to use that so far although i have heard good things about it).

(b) Now for arguments sake, lets assume you could write such a virtual host. Now how would this virtual process handle persistence and dehydration?. I’d wager that people using WF would have the same problem in trying to test the workflow fully. (Soon after writing this I came across Matt Milners MSDN article on unit testing workflows, but workflows are just CLR code)

(c) Although you can see the C# equivalent of the ODX, we dont develop with the C# equivalent directly, so there is no way we can “inject” a mock interface into the orchestration code. Orchestrations are at a higher level of abstraction than ‘normal’ code so while you may declare variables and use them in expression shapes etc, its not the same as writing getters and setters in regular C#.

(d) An orchestration is not really a “unit”.  It is a composite element. The units are the messages going to and from the message box and the external components called through expression shapes.So even if you could inject a mock webservice interface you cannot inject mock message boxes and correlation sets and other things.

Of course, it may be possible to get more testability for orchestrations in future versions of the product (beyond v.2009), but this is the situation now. If there are other approaches you use to dealing with the innards of orchestrations then do let me know.

In terms of getting more info on the orchestration itself, one thing that can be done (and i’ve been considering an addition to the BizUnitExtensions library to do this) is to link in with the OrchestrationProfiler tool a(s that tool gives a pretty detailed report of all the shapes ). Now from the BizUnit test we can verify that individual steps were executed and perhaps also check the time it took for execution. This is a bit like setting expectations for mock objects. This could go quite far in making the orchestration a bit more of a white box.Also considering that the orchestration debugger shows a lot of the variable values, surely it must be possible to get that info via an API (one hopes!!) to show what the values of variables were at a given point for a given instance.

One thing which a lot of people get hung up on is terminology (unit tests vs. functional tests). I dont know why its hard for some folk to accept that the granularity of a unit is entirely subjective and depends a lot on the system. For a system like Biztalk, especially with orchestrations, in my opinion, the unit of testing includes the pickup of the message from the source, the processing and its dispatch. A functional test will expand on that to include things like getting the data into the source and an integration test will span the entire system, and of course, since the solutions built with Biztalk are quite different this definition of whats involved in each category of testing needs to be ‘adapted’ for each project.

Back to Richard’s question though, my previous dev team had a solution. Basically what we did was to write a generic configurable HttpHandler that parsed incoming service requests and returned pre-set responses. The response sent back was configurable based on conditions such as XPath. In the BUILD and DEV binding files, the webservice end point was the mock. This worked brilliantly in isolating the BUILD and DEV environments from the actual third party webservices. This also helped in a “contract first” approach where we built the mock endpoint and the orch developer used it while the webservice author went ahead and built the actual service behind the endpoint. In my next post, I’ll describe this in more detail as I have now put it on CodePlex.

As my previous team wasnt into traditional mock objects, we used this quite successfully for both Biztalk consumers and non Biztalk consumers. If you are not dealing with Biztalk , and if you have control over the consumer (especially if you are writing it from scratch), then i would recommend a mock object framework.

August 22, 2008

BizUnitExtensions and Tools Roadmap

Filed under: BizUnit, Biztalk — Tags: , — santoshbenjamin @ 11:31 pm

BizUnitExtensions 2.3

BizUnitExtensions crossed the 400 downloads mark recently and im really chuffed about that. One of the things I’ve been meaning to do for a very long time is to release some work i did with my previous project team in restructuring the codebase for Extensions. Basically, in alignment with BizUnit 2.3 we moved all non core steps into their own assemblies so now we have separate assemblies for Extensions.Biztalk, Extensions. EntLib and so on. This release is now on CodePlex. (Its not a default release so the homepage still shows the old one so use this link to get it).

Before you download this however please note the following

  • There is no new functionality as such (as far as i remember) and this is only an interim release to set the stage for v3.0 which has a completely new object model, strong typing of test step properties and so on. So you probably dont need this if you are happy with the previous release.
  • As the steps have been moved into different assemblies, the namespaces have also been changed to correspond with them and this will cause existing XML steps to break unless updated.
  • Since we are no longer redistributing the core BizUnit engine with Extensions, the extra entlib logging we had added to the core engine has now been dropped. I hope we can revisit this sometime in future. (The EntLIb database steps are all safe in their own assembly.. just the core logging no longer uses entlib).
  • The assembly version numbers have at last been updated and they are all fixed at 2.3.0.0. (This was doing my head in for a long time and the procrastination finally got to me).

The Roadmap

The wiki had a roadmap suggestions page for a long time and the points there had been converted to work items and for a few i actually got votes on what features would be useful. I’ve now been through the list with a fine tooth comb and extracted the ones to work on immediately.

I have been corresponding closely with Jean Paul Smit and looking through his excellent work on the Biztalk Solution Factory and eventually Extensions will make it into a full fledged Guidance Package.

The 4 main areas to work on are as follows (outside of the upgrade to BizUnit 3.0). For notes on the areas listed check out the old roadmap suggestions page on codeplex.

TestStepLibraries

  •  JMS
  •  SSIS
  • SB
  • WCF
  • WF
  • WSE
  • Pipeline Tests

TestStep Extensions

  •  Link into OrchProfiler
  •  Link into Quick Counters

Functionality Extension

 Pluggable Logging
 
Tools

  • XSD
  • Code Snippets
  • TreeView GUI / WPF GUI
  • WF Test Script Flow GUI
  • Generate BizUnit Test script (now in BSF)
  • Test Guidance Packages (also BSF)
  • Custom DSL
  • Repository

So thats my priority list. Unfortunately i cant promise any dates. If anyone has written steps in the areas listed below (I’ve chatted to Mike Stephenson about WSE steps), or even other areas that i’ve not listed here then please let me know if you would like to contribute your steps. It will all go towards making this a more comprehensive library.

Biztalk Solution Factory v1.5

Filed under: BizUnit, Biztalk, Factories — Tags: , , — santoshbenjamin @ 10:40 pm

Jean-Paul Smit has released a new version of Biztalk Solution Factory now with support for generating unit tests.  The unit test support is based on BizUnit 2.2 and NUnit 2.4.7. There are actions for generating schema tests, map tests and orchestration tests. Check it out…

June 13, 2008

BizUnit & Perf Testing on Technet

Filed under: BizUnit, Biztalk — Tags: , , — santoshbenjamin @ 9:46 pm

I just came across this excellent material on Technet – the Biztalk Server Performance Optimization Guide. Whats even cooler about this paper is that it goes into some pretty good depth on how to use BizUnit in conjunction with LoadGen to do performance testing. This is really good stuff. I was just thinking how good it would be to see a step by step guide to setting up performance testing, including how to get your solution fully isolated and ready etc and along comes this beauty. Its got a complete configuration file which we can customize and use for our projects.

It gets even better wherein there is an entire section on how BizUnit can be used with the end to end BPM scenario. This is an absolute gem. I remember talking with Gar when we first setup BizUnitExtensions on how good it would be to get hold of the end to end scenarios and setup BizUnit for them and this article provides a lot of that. This, IMO, is probably one of the most valuable articles around not only for BizUnit but also because it describes an approach to testing a complete solution.

Check out the articles and happy Biztalking and testing :-) Enjoy.

April 11, 2008

BizUnitDesigner and a Biztalk Testing Series

Filed under: Automation, BizUnit, Biztalk — Tags: , , — santoshbenjamin @ 9:34 pm

This post is mainly to call out two new resources that i just came across.

The first one is BizUnitDesigner. Finally someone has taken the plunge and written a GUI for BizUnit, at least, one that is publicly available. (I’ve heard rumors of IPR protected toolsets which obviously havent made the public domain). That was one of the key things on my TO-DO list . You know, sometimes procrastination can be good! Someone else takes the initiative. :-) I recently started “interviewing” my colleagues to find out what their idea of the ultimate BizUnit GUI would be. I shall compile their responses and share it. I also had some work items for the GUI on my Extensions roadmap on the codeplex workspace. The feedback was going to inform my next toolkit . Since we already have this project available, theres no sense in starting another one. I’ve asked the coordinator if i could join and contribute to this project. At this time it works for BizUnit 2.x and it should be interesting to see how it will work with BizUnit 3.0 (which is still in beta) where Kevin has changed the object model and made it easier to generate BizUnit test cases (and included a tool to generate BizUnit test cases from Excel).

The second one is Michael Stephenson’s series on Biztalk Testing. Michael has already written up over half a dozen articles starting with this and it looks like a really good resource. Some of my colleagues have been doing some interesting work in the way they have been using BizUnit and i have been planning to write them up so i find these posts to be a spur in that direction. We do need a lot of sharing in the area of Biztalk testing and using BizUnit. Here’s hoping we’ll get some good info on practices out into the community.

Check out those links. Enjoy!!

 

January 26, 2008

New Year, New Tools

Filed under: Automation, BizUnit, Factories — Tags: , , , — santoshbenjamin @ 8:51 pm

Happy New Year!! Yeah, i know its kinda late for that but i only got back last weekend from a nice long holiday back home in India so as far as i am concerned the year is just starting.

It was heartening for me to see that BizUnitExtensions has clocked over 250 downloads and the downloads for the VSTemplates and AddIns are approaching the century mark. I promised before i went on hols that there would be new release of Extensions when i got back and i havent forgotten. There will be one soon. My colleagues have added more extensions and are keen to share them with the rest of the community so I need to add the code in to the restructured library. It shouldnt take long but you never know. I opened VS the other day and promptly closed it, unable to think of anything useful to code as I’m currently wearing my Microsoft Word power user hat. Bear with me for a little while till I overcome my holiday hangover and coding inertia.

I did come across a couple of really nice free tools namely a Flash Saving Plugin for IE and a SWF Opener (and SWF Cache Viewer) all available from BrowserTools. I went hunting for a flash video download tool cos theres lots of good tech videos on many sites but all in flash format and not being able to save them and view them at leisure is a bit of a drag. I found some shareware flash rippers too, but this plugin seems to be the easiest to use and the quality of the original file is more or less well preserved.

I’m starting to look more closely at the Clarius MetaFactory now. I had a look at it earlier and it seemed to be a pretty neat piece of tooling and it does seem to be the easiest entry point into the world of GAT and Factories. I have to get started in migrating my VSTemplates and AddIns into full fledged guidance packages and i have a feeling its going to be an indispensable tool for that. I’ll be writing a series on VSX – (Visual Studio Extensibility) very soon to document my foray into this area.

More soon.

November 29, 2007

Happy Holidays

Filed under: BizUnit, Biztalk — santoshbenjamin @ 9:50 pm

For me at least :-) . I’m off to India for my annual vacation tomorrow and will be there for Christmas and New Year. So unless I’m really bored, there wont be any posts from me for a long time.

Theres news on the BizUnitExtensions front though. I finally got some time to cleanup and reorganise the code base so with the new year we will have 2.3 released and Kevin should be releasing the core BizUnit 2.3 around the same time so there will be new toys for the new year.

Anyway, hope you all have a great season.

Blog at WordPress.com.