TDD

TDD

Mock Object Discussion

 

Scott Hanselman has a great discussion on mock objects on Hanselminutes. They go over the basics of how mocks fit into the development environement and how it helps in a test driven development environment. Scott mentions how the Expect API of many mock object frameworks read like an english sentence, this is a great example of a fluent interface. Scott points out one of the most apparent reasons why Rhino Mocks is a great mock library, it doesn't rely on string-based method names, you actually use the method in your expectations. This is great because it...

Bored During Build Time?

 

It's very important to keep your build time as short as possible, but everyone has to deal with it one way or another. If you enjoy anagrams, try waitingforbuild.com next time you are waiting for your build process to complete. On a serious note, if your build time is extremely long (can you eat lunch during your build?) then the next step is to shorten your build time to increase the feedback loop within your development team. The longer your feedback loop is among the development team, the longer it will take to fix bugs when they...

Test Driven Development Discussion

 

Last night I had the opportunity to go to dinner with the Visual C# Team, C# MVP's and Regional Directors. I had an interesting discussion with Bill Wagner on the merits of having development teams following the test driven development methodology. It was a hearty discussion where I attempted to play the devil advocate in support of full compliance of the TDD approach. I also had the chance to chat with Jeffrey Palermo about some of the idiosyncrasies related to the configuration file within StructureMap and the immediate value ReSharper provides to development teams.

Rhino Mocks To The Rescue

 

A recent discussion on the Test Driven Development group brought in question the lacking ability of NMock for mocking classes. NMock will currently only mock an interface. The problem arose when the author wanted to mock a class that takes parameters in its constructor. His solution is to add an Initialize method to the interface and then every other method checks to confirm the object was initialized. While that is very mechanical and error prone - it does work, however there is another solution. Rhino Mocks allows you to create a PartialMock of a class...

Dependency Injection with StructureMap

 

I have posted previously about using Spring.NET as an IoC container and how we can implement some of this out of the box with the System.ComponentModel namespace. StructureMap is another dependency injection framework that in my opinon is much more approachable than Spring out of the box. Why? - Let's take a look at what it takes to start requesting services from the StructureMap container.   IRule rule = ObjectFactory.GetInstance<IRule>(); or for .NET 1.1   IRule rule = ObjectFactory.GetInstance(typeof(IRule)) as IRule; To begin with, StructureMap now supports generics (granted the 1.0.2 release of Spring does as well), however...

Extending Enterprise Library 2.0

 

Brian Button, formerly of the Patterns and Practices team just held a webcast covering how to provide custom design time extensions to the Enterprise Library console. I missed his session, however after reviewing the slide deck which he has provided, extending Enterprise Library appears much easier than when I had to do it only a year ago. Definitely worth checking out if you would like to integrate your own custom extensions within Enterprise Library.

ROI for Agile Methodologies

 

A common question I have heard regarding the use of agile methodologies is how can I determine the ROI of our new found practices. ThoughtWorks, an IT consulting company heavily involved with the agile movement has commissioned Forrester Research to perform an assessment of their processes; here you can read about their results.

Test Driven Development on Google Groups

 

I have recently created a Google group for test driven development. If you want to discuss test driven development, regardless of the technology, feel free to stop by and join in! http://groups.google.com/group/test-driven-development

Difficult Code to Test

 

In preparing for the December presentation on Test Driven Development for the Iowa .NET User Group, I would like to get a little feedback relative to your current testing environment. Specifically, what type of code do you find most difficult to test? Please feel free to leave feedback and I will try to address these issues during the presentation.

Data Driven Unit Tests in .NET 2.0

 

The new unit testing namespace provided with .NET 2.0 includes support for data-driven testing which is a great help when writing unit tests that deal with data access, or at least database access as it appears. The framework provides the DataSourceAttribute to specify your data source (fairly obvious), however, this attribute is really only designed for database access. What if my data source were an XML document or a 3rd party web service? Obviously there are other ways to access an XML document or a web service, such as through the Properties property of the TestContext. I'm just surprised the...