Rants, rambles, news and notes from another geek

Unit Testing and BizTalk 2004

Over the past few months I have seen a number of people talking about a desire to do Unit Testing in BizTalk 2004. But what I haven’t seen is anyone claiming any success.

Since all of the BizTalk objects now compile down to .NET Assemblies, it seems to be that with a good framework we should be able to test them with something like NUnit. This framework may be a set of MockObjects, stubs or even a very customized version of NUnit itself.

Since&nbsp_place_holder;I am now on a BizTalk project, I’m going to start down this road and see where it leads. I’m hoping that it will be successful.

I’m hoping even more that someone will read this post and send me an email back that says, “Wait! I’ve already done it. Here is the code!”

But until that happens, I have to proceed on my own.

While I’m at it, I also intent to explore how NAnt and Continuous Integration can be used with BTS04. Given all the nice command line tools, I’m optimistic. Again… if you’ve written some BTS tasks for NAnt, please let me know.

UPDATE: I found these&nbsp_place_holder;two posts by Scott Colestock about using NAnt with BTS. Thanks Scott! [subscribed]

Geek Notes 2004-06-19

I’m off camping in about an hour, which should be a blast. I use the term camping loosely. A good friend owns 100 acres in the mountains outside of Ft. Collins and he has his birthday party camping trip each year about this time. We drink too much, play music, horseshoes and do some extreme sledding (riding a taboggan down a cliff in the summer time at 2am after drinking for 6 hours).

  • NUnit 2.2 Beta 1 - The next release is almost ready. Should be good, althought I know some people who think it was “done” at 2.0 and didn’t need any changes at all. :)
  • Using Reflection for the Visitor Pattern - After explainin how the visitor pattern works in a previous post, Brad Wilson now explains how reflection can be combined with Visitor to make an easier to use a read design. Take a look.
  • Netsh.exe - This went by a few weeks ago and I ignored it, but then this week I actually used one of the commands, so I thought I would share this post by Keith Browm showing how to configure your network from a command prompt. For those of use who hate using mice, this is a Good Thing.
  • Automatic (empty) Unit Test Case Generator in Reflector - I respect what Peli is doing here, but I question its value. As a TDD guy, I shouldn’t need it. But if you need a whole bunch of stub Ignored tests, this could help.
  • Microsoft Patterns & Practices Block Testing - Jim Newkirk blogs about some of the new stuff coming out of PAG around testing the app blocks.
  • Boo Programming Language - This looks interesting. A new .NET language inspired by Python that has a “focus on language and compiler extensibility.” [via Mike Gunderloy]
  • Marble Mouse Considered Bad - I’ve always hated these things, and Julia Lerman seems to have confirmed my feeling. It is apparently MUCH WORSE than a regular mouse as far as Repetitive Stress Disorders go. Take heed!

Have a great weekend!

SpsAreaExplorer Source Code

A while ago I posted about my SharePoint Portal Area Explorer project and promised to make the source available. Well, here it is.

Enjoy!

This sample source code is offered without warranty and without restrictions. If you don’t agree to use it entirely at your own risk, don’t download it. If you learn something from it, I would appreciate a note telling me so. If you include part or all of this code in a product, it would be polite (but not required) to credit the source. Thanks.

Slides and Files From Building Quality .NET Solutions Seminar

I promised the people who attended my “Building Quality .NET Solutions” seminar that I would post the slides, the NAnt files and the Cruise Control config files to my weblog.

You can download the files here.

Thanks to everyone who came to the class. It was a lot of fun to teach and hopefully you all found it useful.

(The Colorado Springs class will be on Monday June 21, but I wanted to post the files now for the Ft. Collins and Denver folks).

Building Quality .NET Solutions: All the Other Stuff...

Sorry for the late reminder on this, but I have been so heads down on other project work that I completely forgot to post this.

I will be giving an all-day presentation/class titled “Building Quality .NET Solutions: All the other stuff…” three days in a row in Ft Collins, Denver and Colorado Springs.

Here is the abstract:

A lot more goes into a successful development project than just designing the system and writing the code, but that is the focus of most developer training events. Very little attention is given to the other topics that enable a team to produce quality systems. In this session, you will learn about unit testing, build tools, continuous integration, source control systems, and other tools and techniques to improve your team’s productivity.

And here are links to the Microsoft Events registration pages:

Hope to see some of you there.

A Few Final Comments About the Unit Testing Thing...

So this thing got a lot more traction that I thought it would. It started out as a discussion between friends on the sidewalk. Then I made a blog post, and now I’ve got almost 100 comments on my blog and other people posting about it on their own.

A lot of people are saying a lot of interesting things, and I want to address some of them directly. But before I do, I want to say a few things about my motivations here.

My Motivations

I love Visual Studio. I have been a user since the first version of a product with that name. I used Microsoft QuickC and VB before that. I’ve always liked the developer tools that MS has produced.

And I still do.

In fact, I absolutely love what I see in Team System. That is why I have such strong feelings about this. I want it to be even better. To me, the things that really make Team System amazing are not that they are integrating unit testing tools, static analysis tools or performance testing tools. We have all of these tools now, and thanks to Jamie Cansdale, we have many of them integrated into the IDE. That isn’t what makes Team System great.

What makes Team System great is the TEAM part of it. The workflow. The methodology integration. The Project Manager stuff. The integration with the Whitehorse designers. That it includes components for thinking about how the infrastructure works. That is has issue tracking and routing. That it has an enterprise-class version control system (regardless of what I think about lock-edit-commit). That is has an amazing looking data warehouse and reports to tell you what is going on inside your team.

That is what makes Team System great. Not integrated unit testing. Or static analysis. Or performance testing.

And I would completely expect to pay more for all of those wonderful features. I would probably expect to pay a lot for all of those features. And while I may want to get them for free in my MSDN subscription, I can understand why that may not be reasonable from a cost center perspective.

But as so many commenters and posters have said, unit testing is a core development activity. It is something that a single college kid working at 2am in his dorm room should be doing. It is also something that a large team of developers working on an enterprise sized business application should be doing. The latter group could probably use some of the interesting reports and workflow, while the former just needs a test runner. And I firmly believe that for unit testing to be as pervasive as it needs to be, we have to have a consistent toolset shipping with all versions of the product.

A final motivation for me in all of this is that I strongly believe that unit testing is hard. It is misunderstood. It is not actually used by the majority of developers in the world. I do a lot of speaking and training in the Rocky Mountain region, and you would be amazed how often I have to show people what unit testing is. They haven’t even heard of NUnit. And these people are making mission critical business applications! So the core of this final motivation is that I want everyone to see unit testing in front of them from the moment they start programming in .NET. It may not save the world, but it should at least help lots of developers write better code.

Now let me address some of the comments I’ve seen out there in the past 24 hours…

Is Unit Testing Enough?

Scott Densmore writes:

Peter Provost has started a grass roots movement (aka petition) here to include Unit Testing in all the versions of Visual Studio.

Now seeing that I am an Microsoft Employee, I feel I must put in my 2 cents to defend the position of only including this in Visual Studio Team System.&nbsp_place_holder; Programming is hard, I don’t think anyone disagrees.&nbsp_place_holder; Unit Testing is one way to increase code confidence and reduce bugs.&nbsp_place_holder; There are many other practices to help us (developers) make our code / products better.&nbsp_place_holder; This is the goal of Team System: integrate these practices (Unit Testing, Stress Testing, Static Analysis, Work flow, Source Control, Code Coverage) so we can me more productive and better developers.&nbsp_place_holder; So if all you want is Unit Testing is it because that is all you are doing? I doubt it.&nbsp_place_holder; The integration is what makes Team System the price of admission.

I hear you Scott, unit testing is not a panacea. But it is an important tool that all developers should have. We have it now. We will have it later (one way or another).

But in fact you and I agree on your last point too… the integration of all of that (developer tools + team and workflow process tools + data warehousing/reporting + version control) is what makes Team System cool. That very integration and reporting and traceability is what makes me willing to pay for Team System. Not everyone needs all of that team process&nbsp_place_holder;stuff, but I think everyone does need good unit testing and static analysis tools.

But Why?

Philip Reick posts:

Now, don’t get me wrong, I want it there for all versions too.&nbsp_place_holder; But saying “Microsoft should put this feature in all versions” is like saying “Macromedia should include flash mx with dreamweaver”.

Actually, Philip I have to disagree with you there. I think your analogy is broken. I think it would be more accurate to say that this is like “Macromedia should include a script debugger for ActionScript in FlashMX,” which is, of course, a valid statement. You can’t really do efficient development in Flash without a good debugger (trust me… I tried in some of the older versions). And you can’t be expected to do good development in Visual Studio without integrated unit testing&nbsp_place_holder;(hence the success of NUnitAddin).

Philip continues:

So, let’s give them actual reasons that they can use to justify it to the bean counters and shareholders that expect them to make more and more money.&nbsp_place_holder; Here’s mine:

  1. Adding unit test capabilities to VS2005 (all versions) will help reduce software bugs in applications running under windows.&nbsp_place_holder; Anytime an application crashes under windows, customer perception of Windows’ stability is reduced, and a possible support call to MS’ PSS can occur.&nbsp_place_holder; Fewer problems caused by third-party applications means higher customer satisfaction and reduced support costs.
  2. Higher community good will will encourage defectors from the Java camp to .net (yes, they happen regularly, really!) More .net development means more software that runs on Microsoft platforms.&nbsp_place_holder; More microsoft platforms means a higher chance of more Microsoft applications as well. (Office&nbsp_place_holder;2003 on OSX? but what about Office&nbsp_place_holder;2003 on Windows XP?)&nbsp_place_holder;&nbsp_place_holder; Adding unit tests to all versions of VS2005 will help community goodwill.

Damn straight! Now we agree again.

What Will You Give Up?

Mike Gunderloy posts:

ΓǪit doesn’t seem to me that anyone is asking the right question: what are you willing to give up to get this? Microsoft doesn’t have unlimited resources, and they can’t just shove more stuff in the sack without something spilling out the other end. The Team System people aren’t even going to have all their bits in the next VS 2005 beta, which says to me that they’re already overloaded. So: are you willing to have all of VS 2005 slip to get unit testing in the base packages? Are you willing to give up X other new sexy feature so resources can be reallocated? Do we even know enough about the architecture of Team System to know how much work would be involved in pulling out just the unit testing portion? Having unit testing everywhere is a nice thing, but I don’t think a petition in advance of the facts is really all that productive.

If this whole thing does nothing more that raise awareness of unit testing, then I will consider it a success. I am planning to use Team System regardless of whether unit testing is included in the lower versions or not. For me, and the teams of developers I work with, the Team Development Tools that make Team System powerful are worth it.!

But I have to take issue with your question about how much work would be involved in pulling out the unit testing portion. There really would be no good reason to assume that the test attributes are all that different from the NUnit ones. There also is no good reason to assume that the test runner is all that complicated either, although this argument is a little less strong. We have heard the product team say that the static analysis tool is effectively just an integrated FxCop, so that isn’t a big deal either. I could be wrong, but since the Team System team was effectively building on top of the Whidbey IDE and not working as a part of that team, I would expect that it is all pretty modular.

Conclusion

That’s enough. I think I’m done with my bitching and complaining about the tool that I love. I’m sure I will love whatever they ship. I know I will use all that wonderful stuff. If they don’t listen to what all of my commenters have said, then so be it. Some people will still have to use NUnit and FxCop. Oh well. Things could be worse.

Unit Testing Tools in VS.NET 2005 Team System

Apparently when I posted my petition last night, I wrongly assumed that everyone would know what I was talking about. But Sam commented…

Uum, I extensively use unit testing in MS VS .NET with NUnit and the NUnit-Addin for VS.

Does work like charm, what more do you want??

To which I responded

Sam missed my point entirely. If you’ve read anything I’ve written or ever heard me speak, you know I’m a huge fan of both NUnit and NUnitAddin.

But if MS is going to ship unit testing tools with Visual Studio, then it should be included in all versions. Not just the top tiers. Remove Comment 1399

And then Sam followed up with…

Peter, yup, I totally don’t understand the problem - are there editions of the IDE that don’t work with the NUnit-Addin?

And I never seen anything like Unit-testing from MS, is there something I miss? Remove Comment 1408

So, since Sam was obviously neck deep in work during the Ted Ed blog blitz, let me remind him (and anyone else who still doesn’t get it)…

At Tech Ed 2004, Microsoft annouced&nbsp_place_holder;a new set of Visual Studio 2005 versions called “Team System.” These versions of Visual Studio will ship with all kinds of interesting new productivity tools that were formerly known by their codename “Burton”. These include:

  • Unit Testing
  • Static Analysis
  • Work Item Tracking
  • Performance Analysis
  • Enterprise-level Source Control (not Source Safe)
  • Data warehousing
  • Full lifecycle/methodology integration
  • Etc.

It was made very clear by all of the Team System people that I spoke to that the Visual Studio SKUs would be like a Russian doll, where each version up the chain has everything from those versions below, plus more. This is how the Visual Studio product line works now, so it isn’t really all that surprising that it will continue.

So we can expect that the product family will look something like this:

  • Visual Studio 2005 Academic
  • Visual Studio 2005 Professional
  • Visual Studio 2005 Enterprise Developer
  • Visual Studio 2005 Enterprise Architect
  • Visual Studio 2005 Team System for Developers
  • Visual Studio 2005 Team System for Testers
  • Visual Studio 2005 Team System for Project Managers
  • Visual Studio 2005 Team System for Architects

But understand that according to what we were told at Tech Ed, these new features will only ship with the top four (Team System) versions of the product. I was told quite clearly that&nbsp_place_holder; they will not ship with the versions that most people use today (Enterprise Architect). They will not ship with the version that students use today (Academic). They may not be included in the version that comes with your MSDN Universal subscription – although I think they relaize that doing that will have a significant impact on their adoption curve. So they may give us VS2K5TS for Architects in MSDN Universal, but still make us pay for the Foundation Server (the source control and central data warehouse stuff).

Hopefully that clarifies why I said what I said in the original post. Please link to it if you agree with it. Since the product release is still&nbsp_place_holder;probably a&nbsp_place_holder;year away, perhaps we can influence the powers that be. We’ll see.

Unit Testing in Visual Studio 2005

I want to start a blog petition. I want everyone who agrees with me to blog the following sentence:

Unit Testing support should be included with all versions of Visual Studio 2005 and not just with Team System.

Please link or trackback to this post so I can keep track of how well this works.

Thanks

[UPDATE: I added this for those who don’t know what I’m talking about.]

[UPDATE2: I followed up to some of the opposing posts with this.]

[UPDATE3: I suppose&nbsp_place_holder;I should mention that TestDriven.NET (nee NUnitAddin)&nbsp_place_holder;supports all versions of .NET (except maybe the Express versions of 2005, but that isn’t 100% yet.]

Geek Notes 2004-06-12

I’ll be doing a bunch of training this coming week. I’ll be doing a two day custom .NET course at a large aerospace company on Monday and Tuesday. Then at the end of the week I’m doing a one day course three times (Southern CO, Denver and Northern CO) about best practices. In that class, I’ll be stepping outside of the typical .NET training box and covering stuff like continuous integration, NAnt, NUnit and other cool topics. If you are interested in attending one of these, let me know.

Free Web Server Uptime Service

In my last post I begged for a free service to notify me if my web server goes down. Keith Brown commented:

I was about to recommend Phil Greenspun’s free “uptime” service at uptime.arsdigita.com/uptime, but hey, arsdigita.com is dissolved

Well, Keith didn’t look hard enough becuase Phil’s system is still up and running, but the URL has changed.

It is now running at http://uptime.openacs.org/uptime/&nbsp_place_holder;and I have registered my server. Thanks Keith and for anyone else looking for this kind of thing, that looks like a pretty good server.

(Of course it could just be an email address collector for spam, but I don’t think so.)