Friday, May 23, 2008

Pex 0.5 Released - Your Parameterized Unit Test Buddy

Nikolai Tillmann's Blog - Pex 0.5 Released

Pex

Today we released the first version of Pex under a Microsoft Research License. Ideally you have Visual Studio 2008 Professional to get the full experience, but all you really need is .NET 2.0.

We even wrote a tutorial. While it's quite long, exercise 3 helps you to get started with Visual Studio 2008 Professional, and exercise 4 shows you how to use the command-line.

What is Pex?

Pex generates test inputs that cover all, or at least many of the corner cases in your .NET code. These test inputs are plugged into parameterized unit test that you write. The result is a small unit test suite, where each unit test calls the parameterized unit test with particular test inputs. There is a great picture on our main Pex page that illustrates this process.

Pex supports other unit test frameworks since the unit tests that Pex generates can be executed by other unit test frameworks without Pex. Pex comes with support for MSTest, the unit test framework of Visual Studio, out of the box. For support for other unit test frameworks, please look at the Pex Extensions project.

..."

I dig that logo... ;)

I also dig the idea behind Pex. Unit Testing can only take you so far. You can only write so many tests to cover so many things before your head explodes. Yet you want well tested code, right? You want to try to feed it as much "stuff" as you can, because you KNOW as soon as you give your app to your users (or your assembly to its consumers, etc) that they are going to do "silly user stuff." They are going to feed it data that you just never expected... and break your app in very spectacular ways.

Just because you have 70-80%, or even 100%, code coverage doesn't mean you're done and the app is perfectly tested. It just means that the tests envisioned provide a little cover and exercise the code in expected ways. Better than nothing that is for sure, but you've only tested what you've decided to test with. (GIGO and all that...)

As I understand Pex, it's meant to examine your code and automate the feeding in of "stuff" you didn't think about or have time to consider (along with the normal "stuff" in between). It's a tool to help you, the coder and test writer, add one more level of assurance that your code is "good" and the edges are tested. An additional sanity check, without you going insane in doing it...

(via Peli's Farm - Download Pex 0.5 NOW!)

 

Update #1 5/23/2008 @ 10:15am PDT:

Ben Hall(Ben Hall's Blog) has a very nice Pex post, Microsoft Pex - 0.5 Released, covering download/install all the way through viewing the testing results... If you're interested in Pex and want to see it "in action" you should check out his post...

No comments: