Chris McGrath’s Blog

Just another Developer’s Blog

Continuous State Check

leave a comment »

Another post about my ideas on T# expressed on DotNetRocks.

One line which I think was too specific for that discussion was

Make it easier to express testing ideas – one small idea I had with this is during a test there is often a state which you want to always check. T# could provide a mechanism for checking it after every line so you don’t have to have every second line as an assert.

I think this was way too much of a potential implementation idea and took away from the focus of why T# is necessary. And the problem with an implementation detail is they are hard to properly explain in 2 sentences.

The idea is best explained with a form. There are some statements that always going to be true for this form. For example, The save button’s enabled only when the business object is dirty. Now let’s say we write a test which does a heap of operations on the form. Wouldn’t it be useful if after every line of our test it checked that the continuous state is correct?

That’s pretty much the idea. To put it in a real example, imagine you’re on holidays camping (Yes I’m taking the explain as a tour idea from James Whittaker, what can I say it’s a good technique). While there there you are going to face several scenarios. But though them there are always some checks you want to make, “Do I have enough water?”, “Do we need to start setting up camp for the night?”, “Is this a suitable place to camp?”. These checks are the tests the touring is just potential scenarios which could cause our tests to fail.

So by having our definition of continuous state separated from our tour of the code, we are separating what are our test definition and our exploration of the code to find any scenarios where the tests fail.

Written by Chris McGrath

April 14, 2009 at 7:32 am

Posted in Blog

Tagged with

Leave a comment