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.
19
votes
3answers
10k views
Programming SOLID Principles
Over time I could understand two parts of SOLID – the “S” and “O”.
“O” – I learned Open Closed Principle with the help of Inheritance and Strategy Pattern.
“S” – I learned Single Responsibility ...
50
votes
13answers
4k views
When is it appropriate to not unit test?
I work in a small company as a solo developer. I'm the only developer at the company in fact. I have several (relatively) large projects I've written and maintain regularly, and none of them have ...
61
votes
16answers
5k 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 ...
10
votes
2answers
386 views
Software Testing Techniques [closed]
What kinds of software testing do you know? I've heard about Test-Driven Development, Unit tests etc, but can't understand their importance and difference. For example, why are we using regression ...
77
votes
10answers
2k views
TDD vs. Productivity
In my current project (a game, in C++), I decided that I would use Test Driven Development 100% during development.
In terms of code quality, this has been great. My code has never been so well ...
58
votes
16answers
4k views
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 ...
30
votes
9answers
2k 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 ...
25
votes
5answers
3k views
What are the disadvantages of test-first programming?
It's all the rage nowadays. "Everyone" recommends it. That in and of itself makes me suspicious.
What are some disadvantages you have found when doing test-first (test-driven) development? I'm ...
18
votes
7answers
1k views
Are “TDD Tests” different to Unit Tests?
I read this article about TDD and unit testing:
http://stephenwalther.com/blog/archive/2009/04/11/tdd-tests-are-not-unit-tests.aspx
I think it was an excellent article.
The author makes a ...
27
votes
7answers
1k views
Unit testing newbie team needs to unit test
I'm working with a new team that has historically not done ANY unit testing. My goal is for the team to eventually employ TDD (Test Driven Development) as their natural process. But since TDD is ...
45
votes
17answers
2k 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 ...
23
votes
5answers
1k views
How do you convince management to “invest” in unit tests?
How did you convince your manager to let you unit test?
By "use", I mean being allowed to develop, check-in to source control and maintain the unit tests over time, etc.
Typical management ...
17
votes
11answers
946 views
At what point would you drop some of your principles of software development for the sake of more money?
I'd like to throw this question out there to interestingly see where the medium is.
I'm going to admit that in my last 12 months, I picked up TDD and a lot of the Agile values in software ...
24
votes
11answers
1k views
Writing the minimum code to pass a unit test - without cheating!
When doing TDD and writing a unit test, how does one resist the urge to "cheat" when writing the first iteration of "implementation" code that you're testing?
For example:
Let's I need to calculate ...
17
votes
8answers
878 views
What are the disadvantages of writing code before writing unit tests?
I have always seen the recommendation that we should first write unit tests and then start writing code. But I feel that going the other way is much more comfortable (for me) - write code and then the ...
11
votes
10answers
720 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, ...
8
votes
5answers
751 views
What is a normal “functional lines of code” to “test lines of code” ratio?
I'm pretty new to TDD approach and my first experiments say that writing 1 line of functional code means writing about 2-3 lines of testing code. So, in case I'm going to write 1000 LOC, the whole ...
5
votes
4answers
419 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 ...
4
votes
1answer
284 views
Is wrapping a third party code the only solution to unit test its consumers?
I'm doing unit testing and in one of my classes I need to send a mail from one of the methods, so using constructor injection I inject an instance of Zend_Mail class which is in Zend framework.
Now ...
126
votes
23answers
6k views
Why does automated testing keep failing in my company?
We have tried to introduce developer automated testing several times at my company. Our QA team uses Selenium to automate UI tests, but I always wanted to introduce unit tests and integration tests. ...
53
votes
18answers
3k views
Why does TDD work?
Test-driven development (TDD) is big these days. I often see it recommended as a solution for a wide range of problems here in Programmers SE and other venues. I wonder why it works.
From an ...
45
votes
5answers
12k 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 ...
37
votes
11answers
5k 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 ...
33
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 ...
20
votes
11answers
3k views
Has test driven development (TDD) actually benefited a real world project?
I am not new to coding. I have been coding (seriously) for over 15 years now. I have always had some testing for my code. However, over the last few months I have been learning test driven ...
34
votes
6answers
4k views
Good example of complex code using TDD
What would be a good example of the use of TDD in large, real-life, complex, projects? All the examples I've seen so far are toy projects for the purpose of a book or a paper...
Can you name an ...
26
votes
6answers
2k views
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 ...
28
votes
5answers
2k views
Test driven development - convince me! [closed]
I know some people are massive proponents of test driven development. I have used unit tests in the past, but only to test operations that can be tested easily or which I believe will quite possibly ...
12
votes
8answers
345 views
Alternative to “Passing/Broken build” indicator?
When having a continuous integration executing the tests at each commit, a common best practice is to have all the tests passing at all times (aka "do not break the build").
I find some problems with ...
28
votes
4answers
890 views
Always and only TDD
Test driven development. I get it, like it.
But writing tests does require overhead. So should TDD be used universally throughout the code base, or are there areas where TDD provides a high ROI and ...
25
votes
5answers
1k views
Why is it often said that the test cases need to be made before we start coding? [duplicate]
Why is it often said that the test cases need to be made before we start coding?
What are its pros and what the cons if we don't listen to this advice?
Moreover, does that advice refer to black box ...
11
votes
7answers
514 views
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 ...
15
votes
6answers
1k views
how much time do you spend on Unit testing?
In a company I used to work for, executives insisted that the code coverage with unit tests must be 99% or more. This resulted in writing more tests than code. It took us literally 3 days to write ...
14
votes
5answers
803 views
Whats the real overhead of TDD once the entire team is used to it?
What percentage of time is saved and costed doing TDD.
I assume this percentage of cost and reward changes during a projects life-cycle.
I'd imagine the initial phase has a lot more cost but little ...
8
votes
4answers
571 views
How do you keep your unit tests working when refactoring?
In another question, it was revealed that one of the pains with TDD is keeping the testing suite in sync with the codebase during and after refactoring.
Now, I'm a big fan of refactoring. I'm not ...
14
votes
7answers
2k views
Difference Between Unit Testing and Test Driven Development
From reading the descriptions, I understand that in TDD tests are done prior to writing the function and in Unit Testing, its done afterwards.
Is this the main difference, or the two terms can't even ...
9
votes
3answers
463 views
What to do when your colleagues don't value code maintainability [duplicate]
I've been working in the same software development department for a few years now. In that time, the average stay of a developer has been 6-9 months. A handful have been around for over 2 years, but ...
4
votes
3answers
325 views
In TDD, if I write a test case that passes without modifying production code, what does that mean?
These are Robert C. Martin's rules for TDD:
You are not allowed to write any production code unless it is to
make a failing unit test pass.
You are not allowed to write any more
of a unit test than ...
4
votes
2answers
253 views
Can I start with a passing unit test?
Uncle Bob's rules for TDD are specified here.
You are not allowed to write any production code unless it is to
make a failing unit test pass.
You are not allowed to write any more
of a unit test ...
9
votes
5answers
467 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 ...
5
votes
5answers
299 views
An alternative to requiring red in TDD: reverting code change?
According to this answer to this question, a good reason for always starting with a failing test ("Red") is to make sure that the test is working and that the code that will be written is what makes ...
2
votes
2answers
155 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 ...
