Relative Content

Tag Archive for tdd

How would type errors be detected while creating mocks in a dynamic language?

The problem occurs while doing TDD. After a couple of test pass, the return types of some class/module change. In a statically typed programming language, if a previous mocked object was used in the tests of some other class and was not modified to reflect the type change, then compilation errors will occur.

How do we make unit tests run fast?

We have reached the point in our project where we have almost a thousand tests and people have stopped bothering with running them before doing a check in because it takes so long. At best they run the tests that are relevant to the piece of code that they changed and at worst they simply check it in without testing.

Unit Test Friendly Domain Driven Design

Many of the readings I’ve done on DDD, both in books and online, seem to represent code that, often times, is difficult or impossible to unit test. For example, there are numerous samples with static factories, calls to concrete domain classes and static extension methods (in C# samples only). I find it frustrating and taxing to have to constantly re-evaluate the code to make it testable in my mind.

Test driven development when implementing a flexible length list

According to the commonly used TDD strategy, to implement something, you write a test that fail the code first, write the simplest code, refactor, and then repeat. I am trying to imagine this scenario with implementing a flexible length list (e.g. List<T> in .net.

How should you TDD a Yahtzee game?

Let’s say you’re writing a Yahtzee game TDD style. You want to test the part of the code that determines whether or not a set of five die rolls is a full house. As far as I know, when doing TDD, you follow these principles: