Follow @RoyOsherove on Twitter

NSPec - The evolution of unit tests into behavior description?

Get ready for another naming storm. This time it's going to be "Behavior Driven Development". The most important thing coming out of the BDD "movement" thee days is NSpec - a framework and specification for writing Behavior Verification code (Think Unit Tests with a clearer syntax that explains what you're *really* doing).

Here's a code sample using NSpec:

 

 

              [Specification]
                public void BooleanSpecificationExample()
                {
                        // ...Some set up code...
                        Specify.That( someObj.SomeMethod() ).ShouldBeFalse();
                        // Or...
                        Specify.That( someObj.SomeOtherMethod() ).ShouldBeTrue();
                }

 

Does feels pretty nice, but I think there's along way to go before this start feeling like something I would use for my production code. Still, I think this is an interesting direction to go, but the real development would be to make these behaviors possibly written by the customer for specific scenarios, and the developer for other scenarios - one system that handles both cases.

Not that the customer should write code, but they can write in a laungage that can be transformed into such code. With this syntax it's possible.

Still - this is a long way away, and right now, NSPec looks awful promising.

 

[via larkware]

 

 

See you at Agile Israel today!

ORMappers.Com is open for business (sort of)