I was listening to another good Hanselminuets podcast - Understanding BDD and NSpec with Matt Florence and Amir Rajan. As always it was a good an informative show. Towards the end of the show one of the interviewees (I think it was Amir) explained why BDD is much better than TDD… by djclear904 … Continue reading TDD vs. BDD or why can’t we all just get along?
Tag: Unit tests
Enabling parameterized tests in MSTest using PostSharp
I have blogged about the shortcoming of Microsoft’s unit testing framework in the past. It has very good Visual Studio (and TYFS) integration out of the box but it seems that in order to use it I have to suffer lack of functionality I’m used to taking for granted when using any other .NET unit … Continue reading Enabling parameterized tests in MSTest using PostSharp
Supercharge Isolate.Verify
At work we use Typemock Isolator for all of our Isolation/Mocking needs. Lately I’ve noticed that my co-workers do not like to use verify. One of the reasons they prefer not to use it is that sometime Verify error messages leave much to be desired. There are a few simple tricks that helps Isolator help … Continue reading Supercharge Isolate.Verify
Three Day TDD .NET Course (Israel)
A new practitioner of TDD and unit tests has much to learn: how to what are acceptance tests? how to write tests that won’t break on every trivial change? what mock objects and why should you care? How do I test my product code? So if you’re looking for a place to learn all those … Continue reading Three Day TDD .NET Course (Israel)
How to return default(Type) in runtime – a TDD example in four unit tests
I’ve found this question while going over my old StackOverflow answers:I'm using reflection to loop through a Type's properties and set certain types to their default. Now, I could do a switch on the type and set the default(Type) explicitly, but I'd rather do it in one line. Is there a programmatic equivalent of default?I … Continue reading How to return default(Type) in runtime – a TDD example in four unit tests
Don’t fix invisible bugs
Last week I conducted yet another code review. While looking at the code I’ve noticed a lot of lines similar to If(x != null) and if(y < 0) all over the code. These lines were not “business related” but were put in the code to make sure that proper inputs were given to the methods. … Continue reading Don’t fix invisible bugs
Testing right by testing the right thing
Before answering questions about unit testing I usually tend to ask some questions to get the broader picture – especially if the question sound strange. Such question was asked by a teammate – he wanted to know if he can replace the behavior of a fake object while still calling the method replaced. This sounded … Continue reading Testing right by testing the right thing
Multiple asserts – done right
If you’ve been writing unit tests for some time or seen a good presentation on how to write unit tests you probably heard the “One assert per test” rule. There are real benefits in having only one assert in each tests – you get a focused tests, it’s easier to understand what caused the test … Continue reading Multiple asserts – done right
Find out where is the method that was called unexpectedly using fake objects
Every Isolation/Mocking framework out there can verify that a method of a fake object was called and not less important make sure that certain methods are not called. Let’s say that I want to make sure that a method didn’t encounter any errors during execution but verifying that logger.Error was not called: [TestFixture]public class MyClassTests{ … Continue reading Find out where is the method that was called unexpectedly using fake objects
Why you fail with TDD
I’ve been working hard the last six months teaching my teammates about unit testing, code reviews, SOLID, SCRUM and anything else I think we can benefit from. I feel lucky – for the most part they are open minded and accept my ideas and try them without prejudice, working this way has enabled better code … Continue reading Why you fail with TDD

