Questions tagged [tdd]

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.

Further Reading

668 questions
154
votes
11 answers

When do you write the "real" code in TDD?

All the examples I've read and seen on training videos have simplistic examples. But what I don't see if how I do the "real" code after I get green. Is this the "Refactor" part? If I have a fairly complex object with a complex method, and I write…
johnny
  • 3,679
102
votes
16 answers

TDD negative experience

What is a negative side of your TDD experience? Do you find baby steps (the simplest fix to make test green) annoying and useless? Do you find no-value tests (when test has sense initially but in final implementation checks the same logic as other…
SiberianGuy
  • 4,793
61
votes
15 answers

Does TDD really work for complex projects?

I’m asking this question regarding problems I have experienced during TDD projects. I have noticed the following challenges when creating unit tests. Generating and maintaining mock data It’s hard and unrealistic to maintain large mock data. It’s…
Amir Rezaei
  • 11,018
41
votes
3 answers

How can I do TDD in real-world applications?

Doing TDD in a kata is simple. A red test, small amount of code, green test, and refactor. Repeat. And that's it. But, I work on a real application. With a REST controller, a service layer for business logic, a database layer and a converter from…
fluminis
  • 573
17
votes
7 answers

How to get initial API right using TDD?

This might be a rather silly question as I am at my first attempts at TDD. I loved the sense of confidence it brings and generally better structure of my code but when I started to apply it on something bigger than one-class toy examples, I ran into…
15
votes
4 answers

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 to one before and have to say there was a huge…
blunders
  • 4,530
14
votes
6 answers

Looking for Case Studies of How TDD Improved Quality and/or Speed of Development

At my company I am trying to make a case for why we should be doing TDD. Currently most developers just do whatever they can to get the project done, then go add unit tests after the fact in order to meet manager metrics. Any examples from reputable…
Matt West
  • 257
14
votes
9 answers

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 helpful. I wanted to check and make sure I'm…
cgasser
  • 293
13
votes
7 answers

TDD with limited resources

I work in a large company, but on a just two man team developing desktop LOB applications. I have been researching TDD for quite a while now, and although it is easy to realize its benefits for larger applications, I am having a hard time trying to…
bunglestink
  • 2,262
13
votes
1 answer

Can the TDD methodology be applied top-down?

I'm unclear how TDD, the methodology, handles the following case. Suppose I want to implement the mergesort algorithm, in Python. I begin by writing assert mergesort([]) === [] and the test fails with NameError: name 'mergesort' is not defined I…
Ray Toal
  • 1,315
  • 8
  • 11
10
votes
4 answers

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 obvious, you should go ahead and write it - before any…
natasky
  • 211
10
votes
5 answers

If TDD is about design why do I need it?

TDD gurus more and more tell us that TDD is not about tests, it is about design. So I know some developers who create really great design without TDD. Should they practice TDD then?
SiberianGuy
  • 4,793
8
votes
7 answers

Should I write tests when I can prove code correctness?

People say that "talking about TDD hardly works, if you want to convince someone to TDD, show them results". However, I'm already getting great results without TDD. Showing me that people who use TDD get good results won't be convincing, I want to…
Kylee
  • 127
8
votes
1 answer

Test Driven Development Code Order

I am developing my first project using test driven development. I am using Zend Framework and PHPUnit. Currently my project is at 100% code coverage but I am not sure I understand in what order I am supposed to write my code. Am I supposed to write…
7
votes
2 answers

How to know what to test in TDD?

I've heard about TDD more than one year ago, but until now I didn't manage to get myself started with it. Indeed, one of my greatest doubts is always what to test. The examples given always shows test to verify if some business rule is being…
user1620696
  • 4,867
  • 7
  • 32
  • 46
1
2 3