Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 1204

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.

18 votes
Accepted

How to get initial API right using TDD?

https://hanselminutes.com/171/return-of-uncle-bob# I think it would be more sensible to approach TDD from a perspective of validating your structural design. …
Robert Harvey's user avatar
4 votes
Accepted

How would one implement a data structure with test-driven development in mind?

A common misconception about TDD is that TDD drives the entire design of a software project, that a complete software architecture naturally emerges from writing tests and getting them to pass. … That's not how TDD works. You still have to design your software. …
Robert Harvey's user avatar
13 votes
Accepted

Building complex algorithms with TDD

TDD is not a substitute for design. This is a common misconception about TDD, that you can somehow "grow" a coherent design from red-green-refactor. You can't. …
Robert Harvey's user avatar
11 votes
Accepted

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

Any pattern that promotes a functional approach (i.e. you pass it some value(s), it returns a value, and doesn't cause side effects) is going to be straightforward to test. Any pattern that causes si …
Robert Harvey's user avatar
26 votes

What is the difference between writing test cases for BDD and TDD?

Within the confines of the requirements and testing dictated by BDD, you will use "ordinary" TDD to develop the software. …
Robert Harvey's user avatar
17 votes
Accepted

Can I start with a passing unit test?

No, because it is possible to write a test that inadvertently passes when it should actually fail. That's why you must make it fail first, so that you can demonstrate transitioning from a failed st …
Robert Harvey's user avatar
10 votes

TDD - is it just about unit tests?

Practicing TDD (which should really be called Test-Driven Design, not Test-driven Development) forces you to think about your code and write it in ways that make it more unit-testable. … Short answer: The practice of unit testing (of which TDD is a subset) can greatly improve the quality of the code you write. But, like most things in computing, it is not a silver bullet. …
Robert Harvey's user avatar
4 votes

Test driven vs Business requirements constant changing

Your question seems to suggest that TDD is bound by development life cycles. I'm not sure I agree. The answer to flexible, changing requirements is iterative development. … TDD has nothing to say about this, or about software schedules; it is a tool for developing software within whatever requirements and schedule you do have. …
Robert Harvey's user avatar
3 votes

On which abstraction level would you do TDD?

TDD involves Unit Testing; that is, it tests methods. You have methods at all three levels of your project, not just level A. … Writing tests at level A to test functionality through levels B and C isn't TDD; it's integration testing. …
Robert Harvey's user avatar
2 votes

BDD/TDD - exhaustively testing details which are low-level, but still behaviour

Massively tedious repetition of millions of tests, as on the low-level methods, but higher up. That's a straw man... Naturally, you're testing the same functionality higher up, but at a different …
Robert Harvey's user avatar
21 votes

How do you write unit tests for code with difficult to predict results?

The same way you write unit tests for any other kind of code: Find some representative test cases, and test those. Find edge cases, and test those. Find error conditions, and test those. Unless yo …
Robert Harvey's user avatar
11 votes

How do integration tests criticize design?

He means that good software design is better informed by unit tests than integration tests. Here's why. Writing unit tests forces you to write code that is unit-testable. Unit-testable code tends t …
Robert Harvey's user avatar
17 votes

Whats the real overhead of TDD once the entire team is used to it?

This is especially true of TDD, where the unit test specifies the functionality of the method. …
Robert Harvey's user avatar
140 votes
Accepted

Why isn't TDD more popular in universities?

So where does TDD fit into all of this? I honestly don't know. … In your question, you appear to present TDD as a "problem solving device;" I see TDD mostly as a way to improve the design and testability of code. …
Robert Harvey's user avatar
26 votes

Writing the minimum code to pass a unit test - without cheating!

TDD is not a magic bullet for design; you still have to know how to solve problems using code, and you still have to know how to do that at a level higher than a few lines of code to make a test pass. … I do not favor reductionist TDD philosophies that claim you can grow an application by simply writing the smallest amount of code to pass a test. …
Robert Harvey's user avatar

15 30 50 per page