Tuesday 16 June 2009

Intro to Pex and TDD

I need to work on the presentation for the dev team at work and have the samples and presentation from the Pex site but am not sure which code samples to use or to mix in some work code?

Do I include Contacts and Stubs as well or would that be to much for a 2 hour session?

Friday 5 June 2009

Pex Explorations

So after last night I decided to break out a couple of methods for testing from the main project.



and running Pex generate unit tests gave me the following



and added










Thursday 4 June 2009

Pex

Didn’t get as much done as I would have liked. Though one thought did cross my mind why do VS templates not conform to things like StyleCop  and R#

Must admit though I like Pex as it helps create tests I think I might need to pick a fresh project to add it to.

Do take the time to read through the documentation and the slide decks are good for teams.

Wednesday 3 June 2009

First pass at Pex

I have a class that I need to serialize out for remoting which has information about an order with addresses, payment details and order items.

This object will be sent to a message queue and deserialized before process into out MS Dynamics Nav database.

The first thing I did was download the latest version of Pex and get the class to build. Once this was done I ran the Pex explorations and encountered an error ‘failed to generate project CSharp\Test\TestProject.zip’ the post explains about file path lengths and how to get passed this. It’s a bit confusing here as this was my home machine and it’s not difficult to move solutions around but I think it my be more tricky on the dev box at work where paths can be long as projects can be nested quite deeply. This has also caused Reshaper to throw exceptions as well so it is something to watch out for.

So what happened next – well everything went smoothly and Pex found that I was missing an entry in my app.config. True – i had copied the code over but not the solution so I had missed the app.config even though everything built. A .stubx file is built by default for the class under test.

It is worth pointing out that I had seen previous demos of Pex at DDD7 and read through, though so far not in great detail the documentation.

I’ll go through the other tests tomorrow.

Tuesday 2 June 2009

Stubs

Just run the Bowling Game application created to run unit tests from the TDD book and used Pex to create parameterized unit test stubs and it creates a .stubx for each of the classes. Wondered how each class had to be stubbed out.

Monday 1 June 2009

Stubs and Pex

Should have paid more attention to the ‘Getting Started’ document where it mentions that Stubs only supports mocking of Interfaces and abstract methods.