TDD stands for Test-Driven Development, or Test-Driven Design. It is the practice of writing a unit test before writing code to satisfy it, in what is known as the Red-Green-Refactor cycle.

learn more… | top users | synonyms (2)

34
votes
10answers
4k views

Is unit testing or test-driven development worthwhile?

My team at work is moving to Scrum and other teams are starting to do test-driven development using unit tests and user acceptance tests. I like the UATs, but I'm not sold on unit testing for ...
27
votes
11answers
2k views

Do I need to test everything?

I'm going to start my first real project in Ruby on Rails, and I'm forcing myself to write TDD tests. I don't see real advantages in writing tests, but since it seems very important, I'll try. Is it ...
5
votes
4answers
271 views

Type mocking frameworks does not change coding practices from testability point?

Many people recommend that we should code against interfaces and avoid statics for testability. Interfaces are not just for testability, they are sometimes a requirement. But sometimes we introduce ...
10
votes
2answers
709 views

How can I unit test audio?

I have inherited a small project and want to extend it and stabilize it at the same time by writing Unit Tests for all the new code I am adding. The first class, TypedAudioCreator, creates audio files ...
8
votes
6answers
2k views

How can I organize fast and comfortable solution compilation in VS 2010?

Most of programmers who are involved into development of more or less large project(s) know how annoying the process of compilation can be. There are some other things which are dependent on ...
119
votes
6answers
48k views

What is the difference between BDD and TDD?

I have been learning writing test cases for BDD using specflow. If I write comprehensive tests with BDD is it necessary to write TDD test separately? Is it necessary to write test cases for both TDD ...
54
votes
12answers
5k views

New to TDD. Should I avoid private methods now?

I'm just now learning TDD. It's my understanding that private methods are untestable and shouldn't be worried about because the public API will provide enough information for verifying an object's ...
1
vote
1answer
321 views

Looking for resources on TDD and BDD [closed]

I'm doing a presentation this week for Uni on the application of TDD and BDD. I'm trying to focus on types of code (such as algorithms, business logic or crud) and which methodology (if at any at all) ...
36
votes
11answers
1k views

How do people doing TDD handle loss of work when doing major refactoring

For a while I have been trying to learn to write unit tests for my code. Initially I started out doing true TDD, where I wouldn't write any code until I'd written a failing test first. However, I ...
5
votes
1answer
491 views

Node.JS testing with Jasmine, databases, and pre-existing code

I've recently built the start of a core system which is likely going turn into a monster product. I'm building the system with node.js, and decided after I got a small base built, that It'd be a ...
10
votes
3answers
2k views

Is Test Driven Development in Javascript helpful for front-end developers?

I really need your advice. I'm reading a few articles about TDD in JavaScript but I'm really struggling to understand how to use it in my daily work. For instance I'm currently working on a page that ...
343
votes
12answers
11k views

Should I intentionally break the build when a bug is found in production?

It seems reasonable to me that if a serious bug is found in production by end-users, a failing unit test should be added to cover that bug, thus intentionally breaking the build until the bug is ...
2
votes
4answers
676 views

Development setup for TDD. Is it correct?

This is how my team has it's development environment set up: Each team member has a local development environment on their own computer, where they check out the code from a shared repository. Every ...
19
votes
9answers
2k views

Should we test all our methods?

So today I had a talk with my teammate about unit testing. The whole thing started when he asked me "hey, where are the tests for that class, I see only one?". The whole class was a manager (or a ...
5
votes
4answers
525 views

How to Write Unit Tests When One Fix Will Make Many Failing Tests Pass?

I have two test cases to test a fix to code that is using the wrong criteria for selecting objects from a collection: Given one object in the collection matching the bad criteria, ensure that no ...
7
votes
8answers
1k views

Advantages and disadvantages to making common unit test scaffolding code

For the project my team and me are working on we often find that we need large pieces of scaffolding code. Creating domain objects with correct values, setting up mocks for repositories, dealing with ...
1
vote
2answers
739 views

A good code coverage framework for groovy/java?

Currently, I am working on a very complex product. Unit testing is something unknown to this product till date. Hence the code base is too complex to keep it compatible with unit tests. I am supposed ...
3
votes
8answers
550 views

Emphasizing the importance of TDD to customers

The importance of TDD needs to be propagated but there's always a gap in the project timeline and time needed for developing a TDD project. Customers usually do not understand the importance of code ...
4
votes
4answers
203 views

How can I create Assert.AreEqual(myobject,somevariable) a test in TDD before writing production code?

Im researching TDD, I'm not really sure how to write a test before I have written production code. The problem is that TDD states that you make assertions and then write your code so that these ...
10
votes
6answers
2k views

Single or multiple files for unit testing a single class?

In researching unit testing best practices to help put together guidelines for my organization, I've run into the question of whether it is better or useful to separate test fixtures (test classes) or ...
3
votes
4answers
170 views

Does not testing internals entail diligent refactoring and/or rely on developer talent?

I'm not asking here what the arguments are for/against testing internal methods (though I'll restate some, and don't mind hearing others). My questions relate to the implications of only testing ...
4
votes
2answers
1k views

Should I use an aggregate root when designing my repository?

I have an entity that is called Master which is composed of a number of Slave entities. There can only be one Master in my database and I want to query repositories to get the Slave for a given id. ...
2
votes
2answers
223 views

Moving legacy application to a testable framework?

We have a web application which contains a web service with over 50 methods. The application is currently installed at a number of sites and is currently being maintained by one developer. The ...
24
votes
2answers
3k views

What are the London and Chicago schools of TDD?

I’ve been hearing about the London style vs. Chicago style (sometimes called Detroit style) of Test Driven Development (TDD). Workshop of Utah Extreme Programming User's Group: Interaction-style ...
2
votes
2answers
379 views

How do you end up with event-sourcing if you use a xDD approach?

When working in a TDD or BDD manner your unit tests are supposed to drive your design. But how do you end up with event-sourcing using a xDD techniques? As I see it event sourcing is something you ...
13
votes
4answers
929 views

Unit testing statically typed functional code

I wanted to ask you people, in which cases it makes sense to unit test statically typed functional code, as written in haskell, scala, ocaml, nemerle, f# or haXe (the last is what I am really ...
6
votes
3answers
962 views

Getting from a user-story to code while using TDD (scrum)

I'm getting into scrum and TDD and I think I have some confusion which I'd like to get your feedback about. Let's assume I have a user-story in my backlog, in order for me to start developing it as ...
14
votes
4answers
2k views

Why is Conway's “Game of Life” used for code retreats?

Code Retreat is an all-day training event that focuses on the fundamentals of software development. There's a "global" code retreat day coming up, and I'm looking forward to it. That said, I've been ...
18
votes
5answers
660 views

Does unit testing lead to premature generalization (specifically in the context of C++)?

Preliminary notes I'll not go into the distinction of the different kinds of test there are, there are already a few questions on these sites regarding that. I'll take what's there and that says: ...
8
votes
7answers
3k views

How do I do TDD on embedded devices?

I'm not new to programming and I've even worked with some low level C and ASM on AVR, but I really can't get my head around a larger-scale embedded C project. Being degenerated by the Ruby's ...
3
votes
1answer
91 views

How to deal with changes that need further testing while working on another test?

TDD means to test before you start writing production code. So I start writing a test for MyClass called MyClassTest. It fails and I start to implement the wanted functionality in MyClass. During the ...
3
votes
7answers
356 views

Steps towards TDD [duplicate]

I need some advice to take the steps for TDD. How do we think in terms of interfaces for everything when we are writing code? Most of the testing books tell you how to write tests. But I want a book ...
7
votes
4answers
303 views

How do I do TDD when expected behaviour is to be changed?

I've been doing TDD with a project I'm working on, and I have quite a large number of tests. I have quite a few automated tests around restrictions enforced in code, making sure things that shouldn't ...
37
votes
11answers
9k views

What are the disadvantages of automated testing?

There are a number of questions on this site that give plenty of information about the benefits that can be gained from automated testing. But I didn't see anything that represented the other side of ...
17
votes
5answers
538 views

How can I start testing in a testing anticulture?

I have a confession to make: Formalized automated testing was never a part of my programming background. I now work in a very large company with many developers (most of them web developers of one ...
18
votes
6answers
786 views

Does adding unit tests make sense for well-known legacy code?

I'm talking about unit tests in the TDD sense. (Not automated "integration", or what you like to call it tests.) Legacy code as in: (C++) code without tests. (see: Michael Feathers' Working ...
11
votes
5answers
766 views

How to do TDD for something with many permutations?

When creating a system like an AI, which can take many different paths very quickly, or really any algorithm that has several different inputs, the possible result set can contain a large number of ...
3
votes
2answers
628 views

Which GOF design patterns work well with TDD, and which do not?

The GOF Design Patterns book rarely mentions the test-ability of each pattern. I'm aware that there are patterns such as Singleton that would lead to code for which it is difficult to write unit ...
4
votes
2answers
166 views

How to keep settings for C++ Unit Test modules in sync with the production code modules?

Note: I'm coming from a Windows / Visual-C++ background. Note: I have already read Michael Feathers' Working Effectively with Legacy Code. Note: Broad question, asking for narrow answers, i.e. while ...
4
votes
1answer
284 views

Unit testing of “workflow” methods

We are currently developing a public API for our app. The methods on this public API are mostly putting together functionality in different corners of the system. An example would be: (names have been ...
0
votes
1answer
68 views

Verification naming confusion

According to Martin Fowler classical article, there are two types of verification: state and behaviour verification. At the same time I often see people telling about implementation vs. behaviour ...
2
votes
1answer
444 views

Does a project using proper TDD have a lot of code without tests?

Most (all?) TDD resources show you how the cycle goes: Write Test Check Test Write Production Code Check Test Clean up Production Code Check test They also - to me - seem to imply that all code ...
11
votes
4answers
1k views

Does test-driven development force me to follow SOLID?

I hear a lot from TDD practitioners that one of TDD's advantages is that it forces developers to follow SOLID principles (Single responsibility, Open-closed, Liskov substitution, Interface segregation ...
11
votes
2answers
923 views

Relation between BDD and TDD

What is the relation of BDD and TDD? From what I understood BDD adds two main things over TDD: tests naming (ensure/should) and acceptance tests. Should I follow TDD during development by BDD? If ...
15
votes
5answers
1k views

How granular should TDD tests be?

During TDD training based on medical software case we are implementing the following story: "When user presses Save button, system should add patient, add device and add device data records". The ...
33
votes
9answers
2k views

How baby are your baby-steps in TDD?

Today we were training TDD and found the following point of misunderstanding. The task is for the input "1,2" return sum of numbers which is 3. What I have written (in C#) was: numbers = ...
5
votes
2answers
480 views

Testing-related methodologies except TDD/BDD [closed]

Are there any testing-related methodologies except TDD/BDD? I see a lot of people who practice their own testing approaches (e. g., see Ayende post), but I don't see any formalization for it, no ...
11
votes
4answers
765 views

Does TDD's “Obvious Implementation” mean code first, test after?

My friend and I are relatively new TDD and have a dispute about the "Obvious Implementation" technique (from "TDD By Example" by Kent Beck). My friend says it means that if the implementation is ...
1
vote
2answers
170 views

Tdd on a datadriven webapp

How would one go about to use tdd/bdd on a mostly data driven webapp? For example a blog or a forum?
3
votes
2answers
232 views

Product Owner and automated tests

One of the claims of BDD-style development is that it bridges the gap between Product Owner and developers: the Product Owner writes a story, which can be converted in an equivalent automated test ...