This project is read-only.

Lessons Learnt

Whilst building the Shweet project we looked at the way we approached development and how this was changed using Pex and Moles.

Using Moles and Behaviours

The hardest part to learn when starting unit testing is when it is right to use isolation, it also feels very strange at first because you have the feeling that you are not really testing your code. Having worked with isolation frameworks before the use of Moles and Behaviours is very natural. In fact as the Behaviours developed the unit tests became less brittle and the code needed to setup the tests reduced.

Test Driven / Test First Development with Pex

The Pex team see Pex as being where the ultimately value is, however our experience was that it required a shift in the way you develop. Being an advocate of TDD and this being a fairly well engrained development practice it was difficult yo make Pex work for us. What we have settled on is a mixed approach - using TDD we produce the 'Happy Path' we code as we would normally and create all of the unit tests and production code. Once we say "that's enough" we can then bring Pex to the process in order to help us discover the hard to find bugs (often these are the simple things like invalid casts, or null reference exceptions, but they tend to be the things that we didn't think of.

One area we did not validate was the value of using Pex on existing applications that do not currently have any unit tests. Being able to right click on a project or method and getting Pex to generate and run unit tests would be a great way to get started.

Test Driven Development with Pex

Last edited Apr 7, 2010 at 1:12 PM by jamesafisk, version 6

Comments

No comments yet.