Pex – Assisted White Box Testing

On a brief side note after attending Mitch Denny’s (from Readify) presentation tonight on “Tools for Improving Software Quality” he introduced us to a great little tool for Visual Studio 2008 and beyond. “Pex (Program EXploration) produces a traditional unit test suite with high code coverage“.

It’s a tool that writes the unit test for you!

This may seem like a contradiction to the purpose of the unit test, and slap in the face for those promoting Test Driven Development (TDD). But that’s incorrect. The purpose of Pex is to assist in catching the missed branches (especially the mundane and tedious ones from switch statements). To be used to polish the unit tests, after the best practice approach is followed; of writing the core of the unit test before coding the actual function begins.

Given a parameterized unit test written in a .NET language, Pex automatically produces a small unit test suite with high code and assertion coverage. To do so, Pex performs a systematic white box program analysis.

Download it here at the Research.Microsoft.com site; available for “Commercial Evaluation” and “Academic Use” as it’s still in Beta.

The tool integrates directly into Visual Studio and assist with MSTest tests. You write click on a method and it explores the code paths determines input variables to test areas of the code your logic currently doesn’t cater for, thereby allowing you to further expand the function itself to cater for more “expected exceptions”.runpex

Here are some more screen shots on the official Pex site, also check out the Channel 9 video on it.

Advertisements

Why WCF

UPDATE 9-July-2010:
This entry gets a lot of random hits, so I thought I would update the information as of July 2010, just to give links to newer areas relating to WCF.

WCF – Windows Communication Foundation, has become in fact more of a foundation for a larger set of abstractions on top it. Simply put WCF is a set of fundamental plumbing components with powerful extensibility features. But is not the easiest of things to use and configure.

The options now for more out of the box ready solutions that wrap and exist on top of WCF are:

These frameworks/abstractions/concepts are intended to simplify creating and deploying your web accessible service offerings.

Original post as it was 24-Feb-2009…

To quote the MSDN front page for WCF:

“It unifies the capabilities in ASMX, WSE, Remoting, COM+, and MSMQ; therefore developers need to learn only one programming model.”

Simply put “it’s where we are with Microsoft.NET framework”, if you’re going to build .NET applications it’s the right choice. Service Oriented Architecture is currently the most practical approach to build robust, distributed and maintainable applications. WCF allows you to simply and easily build such services according to an industry standard, with the intention to achieve a high level of interoperability. WCF takes care of: service interactions, marshalling, type conversions and other protocols allowing the developer to focus less on plumbing and more on delivering application value.

Key WCF notes:

  • Most messages are SOAP messages.
  • Not only for HTTP (can have: TCP, NamedPipes).
  • Can therefore communicate:
    • same machine
      • same app domain
      • cross process
    • cross machine
      • intranet
      • internet
  • Interoperable with other non-WCF services.

What I will attempt to demonstrate in subsequent posts is how simple it is to get the application plumbing working right and smoothly. Also down the track demonstrate some of the more complex scenarios you can setup with WCF especially the capabilities to further extend the framework.

Next up is “The WCF Run-Down“.

WCF Beginners Series

I’ve been issued a task to run a series of presentations for the Microsoft arm of the software development service line of my consulting firm. Focusing on Windows Communication Foundation (WCF) for the .NET framework.

dotnetframework3

This blog will assist in breaking down some of the topics into simple easily referenceable chunks, including links to other relevant articles/blogs/samples online. They will begin of with the very basics ([Service|Data]Contracts/Bindings/Endpoints/Configuration/Hosting), acting as a tutorial to get started then expanding into more advanced topics (Transactions/Security/etc). So stay tuned for those.

The plan once the initial WCF series of posts is complete, to expand further in to other .NET 3.5 streams including WPF and WF. The goal is to deliver real world examples and not purely conceptual discussions. Possibly further depending on how productive I can be.

Look out for the next post “Why WCF“.