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)

1
vote
3answers
556 views

test coverage reality

I am NOT doing test driven development and I write my test classes after the actual code is written. In my current project I have a test coverage (Line coverage) of 70% for 3000 lines of Java code. I ...
1
vote
4answers
1k views

Moving from mock to real objects?

I'm like doing TDD so I started everything mocking objects, creating interface, stubbing, great. The design seems to work, now I'll implement the stuff, a lot of the code used in the stubs are going ...
5
votes
4answers
309 views

Testing To Prevent Cascading Bugs

Yesterday, Twitter was hit with a "Cascading Bug" as described in this blog post: A “cascading bug” is a bug with an effect that isn’t confined to a particular software element, but rather its ...
19
votes
5answers
6k views

What are the design principles that promote testable code? (designing testable code vs driving design through tests)

Most of the projects that I work on consider development and unit testing in isolation which makes writing unit tests at a later instance a nightmare. My objective is to keep testing in mind during ...
16
votes
9answers
1k views

Are too many assertions code smell?

I've really fallen in love with unit testing and TDD - I am test infected. However, unit testing is normally used for public methods. Sometimes though I do have to test some assumptions-assertions ...
17
votes
10answers
2k views

Is 100% code coverage a pipe dream?

Is it feasible to expect 100% code coverage in heavy jquery/backbonejs web applications? Is it reasonable to fail a sprint due to 100% coverage not being met when actual code coverage hovers around ...
3
votes
4answers
529 views

Should you exercise TDD on prototype applications?

I'm developing an iOS app, which is a prototype for a customer. They're expecting it to not be of production standard and are happy for a few rough edges here and there. Since this is my first ...
5
votes
4answers
282 views

TDD: Write a separate test for object initialization or relying on other tests exercising it

This seems to be the common pattern that's emerging in some of the tests I've worked on lately. We have a class, and quite often this is legacy code whose design can't be easily altered, which has a ...
3
votes
5answers
520 views

Which class to start TDD of card game application? What's the next 5-7 tests?

I have started to write card game applications. Some model classes: CardSuit, CardValue, Card Deck, IDeckCreator, RegularDeckCreator, DoubleDeckCreator Board Hand and some game classes: Turn, ...
3
votes
1answer
484 views

How to unit test with lots of IO

I write Linux embedded software which closely integrates with hardware. My modules are such as : -CMOS video input with kernel driver (v4l2) -Hardware h264/mpeg4 encoders (texas instuments) -Audio ...
6
votes
2answers
846 views

Test Driven Development, has it reduced stress for developers?

I understand the benefits of test driven development, but have there been any studies that reveal the level of satisfaction with the product or stress levels of the authoring developers with the ...
6
votes
4answers
658 views

How do asserts and other error avoidance checks fit into TDD?

http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd You are not allowed to write any production code unless it is to make a failing unit test pass. So where do asserts fit into this? If ...
9
votes
8answers
1k views

TDD: Am I doing it right?

I'm a new programmer (only been learning for about a year) and in my goal to become better at it I have just recently learned about TDD. I wanted to get into the habit of using it since it seems very ...
11
votes
2answers
403 views

Are there any scientific studies done on TDD that use total cost of ownership for a product as the measurement?

When I was reading the summary of previous work in Dogsa T, Batic D. The effectiveness of test-driven development: an industrial case study. Software Quality Journal. 2011;19(4):643-661. it struck me ...
8
votes
6answers
517 views

How to use unit tests as a source of information?

A colleague of mine was once at a seminar about agile development, where he heard it is possible to use unit tests as technical documentation. Something like using unit tests as an example of how to ...
3
votes
3answers
279 views

TDD adding simple properties

I am currently doing my first real project with TDD. I have written tests, and implemented most of the logic for the application. However, there are properties I know I need to have on the UI, ...
2
votes
3answers
167 views

Test-driven development: To create test when issue is filed or when issue is picked up by somebody?

I've recently been working on a web development project on a team of less-than-five people. Things are going good but now we are decided to go with test-driven development. So far what I've learned ...
17
votes
4answers
836 views

Should we always unit test bugs when correcting them?

When correcting bugs, it is encouraged where I work to first write a test that fails with the given bug, and then to fix the code until the test passes. This follows TDD practices, and is supposed to ...
9
votes
2answers
824 views

How to TDD that the correct results are returned

I'm starting a new project, and trying very very hard to use TDD to drive the design. I've been pushing for years, and finally got approval to spend the extra time on this project to use it while I ...
67
votes
16answers
10k views

When is unit testing inappropriate or unnecessary? [duplicate]

It seems to be generally assumed (on Stack Overflow at least) that there should always be unit tests, and they should be kept up to date. But I suspect the programmers making these assertions ...
4
votes
3answers
380 views

How to conduct a 3 days training on current techniques like TDD and CI

I am tasked to conduct a training for an upcoming team of 20 Java developers for a new project. The project owner wants us to use state of the art development techniques like TDD and CI. The ...
43
votes
6answers
6k views

How to deal with static utility classes when designing for testability

We are trying to design our system to be testable and in most parts developed using TDD. Currently we are trying to solve the following problem: In various places it is necessary for us to use static ...
15
votes
3answers
3k views

Real-world examples of apps written with TDD and good test coverage? [closed]

Are there any open source applications that are developed using test driven development that serve as models of how good unit testing should work? I'd prefer to see examples in C# and .NET. (Note ...
11
votes
10answers
824 views

How to convince teammates to use TDD

I am the only person on my team that use TDD. How do I make them to use it? I am annoyed that when I pull, someone's code will break my tests and I am the one who has to fix them. Will using github, ...
9
votes
1answer
945 views

How can I get started using TDD to code some simple functionality?

I basically have the gist of TDD. I'm sold that it's useful and I've got a reasonable command of the MSTEST framework. However, to date I have not been able to graduate to using it as a primary ...
48
votes
16answers
3k views

Why not write all tests at once when doing TDD?

The Red - Green - Refactor cycle for TDD is well established and accepted. We write one failing unit test and make it pass as simply as possible. What are the benefits to this approach over writing ...
36
votes
14answers
2k views

If you had two projects with the same specification and only one was developed using TDD how could you tell?

I was asked this question in an interview and it has been bugging me ever since. You have two projects, both with the same specification but only one of these projects was developed using Test ...
3
votes
2answers
1k views

How much extra time is needed to add unit test in a development task?

My team is considering moving to test-driven development. Currently we have almost no unit testing, we have been only relying on the user acceptance test, and developer's own manual test. Not everyone ...
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
276 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
754 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 ...
132
votes
6answers
65k 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 ...
56
votes
12answers
6k 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 ...
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
543 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 ...
345
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
702 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 ...
20
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
537 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
2k 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 ...
4
votes
8answers
559 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
206 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
182 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
237 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 ...
29
votes
2answers
4k 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 ...