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)

7
votes
8answers
765 views

Why isn't TDD part of programming lessons at school [closed]

My daughter and my son are learning Java with BlueJ. I really don't understand why the first thing they learn isn't to write code to bring a testcase to green light.
7
votes
4answers
2k views

End-to-end tests versus unit tests, should tests be decoupled?

At our company we typically make sure that we write an end-to-end test for our websites/web apps. That means we access a URL, fill in a form, submit the form to another URL and check the results of ...
7
votes
1answer
364 views

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 ...
7
votes
4answers
743 views

Unit testing and Test Driven Development questions

I'm working on an ASP.NET MVC website which performs relatively complex calculations as one of its functions. This functionality was developed some time ago (before I started working on the ...
7
votes
4answers
307 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 ...
7
votes
5answers
5k views

Learning Test Driven Development [closed]

If I want to learn TDD on my own, where would I start apart from the usual Google Search? Are there any books that you would recommend or any method that you followed to learn it on your own? I am ...
7
votes
5answers
683 views

BDD/TDD vs JAD?

I've been proposing that my workplace implement Behavior-Driven-Development, by writing high-level specifications in a scenario format, and in such a way that one could imagine writing a test for it. ...
7
votes
5answers
702 views

TDD: Mocking out tightly coupled objects

Sometimes objects just need to be tightly coupled. For example, a CsvFile class will probably need to work tightly with the CsvRecord class (or ICsvRecord interface). However from what I learned in ...
7
votes
4answers
374 views

How would a new language look if it was designed from scratch to be easy to TDD?

With the some most common languages (Java, C#, Java, etc) it sometimes seems that you are working at odds with the language when you want to fully TDD your code. For example, in Java and C# you will ...
7
votes
3answers
685 views

Can you use UML in a TDD project?

If so, at what stage? or it is also an iterative process? If iterative, how formal? Also, how useful is UML for a solo programmer doing open source? While I like to see a picture of the system, it ...
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 ...
7
votes
5answers
590 views

Is it typical for a unit test suite to be larger than the code it tests? [duplicate]

Possible Duplicate: What is a normal “functional lines of code” to “test lines of code” ratio? I've found that more often than not, when you write lots of unit ...
7
votes
3answers
642 views

TDD Mock call verification - is it an anti-pattern?

I've been doing TDD for year now, I feel pretty good about it, I love my test suites and all. However I've noticed that lately I've been doing a lot of mock call verification. For example I'd have a ...
7
votes
1answer
299 views

Who should initialize dependencies in a TDD application?

I'm trying to learn implementing TDD with mocking/fake objects. One of the questions I have is how to initialize a dependency in an application which implements TDD? An example from this article ...
7
votes
1answer
564 views

When does TDD fail? [duplicate]

Possible Duplicate: TDD negative experience I would like to read about negative experience related to developing in the TDD style. Looks like it is very difficult to find this kind of ...
6
votes
6answers
502 views

“Software features that can't be demonstrated by automated tests simply don't exist”— Is it too extreme a statement?

Kent Beck famously said that Software features that can't be demonstrated by automated tests simply don't exist But is this too extreme? I mean, I can't demonstrate that my UI really works, ...
6
votes
5answers
843 views

Questions about TDD and unit testing

I am a junior software developer and I have been researching some of the practices in the industry to make myself better. I have been looking at unit testing briefly and I cannot see how the extra ...
6
votes
3answers
775 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 ...
6
votes
4answers
648 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 ...
6
votes
5answers
517 views

How to do Test Driven Development

I have just 2+ years of experience in application development. In those two years my approach towards development was as following Analyze requirements Identity Core component/Objects, Required ...
6
votes
1answer
760 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 ...
6
votes
3answers
429 views

Are “Stocks” a TDD/Unit testing anti pattern?

From Martin Fowler's Mocks Aren't Stubs he states that Stubs provide canned answers to calls made during the test while Mocks objects pre-programmed with expectations which form a specification of the ...
6
votes
3answers
1k 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 ...
6
votes
2answers
843 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
2answers
549 views

Unit test SHA256 wrapper queries

I have the following SHA256 wrapper. public static string SHA256(string plainText) { StringBuilder sb = new StringBuilder(); SHA256CryptoServiceProvider provider = new ...
6
votes
2answers
1k views

Helper static methods in TDD

I am creating an application which will be testable(unit + integration). In this application I have a FileHelper static class, public static class FileHelper { public static void ...
6
votes
3answers
5k views

How to test the data access layer?

I have a DAO method that utilizes Spring for JDBC access. It calculates a seller's success rate of selling an item. Here is the code: public BigDecimal getSellingSuccessRate(long seller_id) { ...
6
votes
7answers
366 views

Do you write unit tests for all the time in TDD?

I have been designing and developing code with TDD style for a long time. What disturbs me about TDD is writing tests for code that does not contain any business logic or interesting behaviour. I know ...
6
votes
2answers
986 views

How would you TDD the functionality of getting the corresponding process of a running windows service?

Purpose Over the last year or more I've been learning unit testing via books I've read recently like The Art of Unit Testing, Working Effectively with Legacy Code, and others. I've also been using ...
6
votes
2answers
443 views

Ruby Koans: depth and usefulness? [closed]

Several people have suggested Ruby Koans to me over just following a book, and this seems like a much better prospect. As there is no question regarding the entirety of Ruby Koans, what do SO users ...
6
votes
2answers
742 views

Unit Test Friendly Domain Driven Design

Many of the readings I've done on DDD, both in books and online, seem to represent code that, often times, is difficult or impossible to unit test. For example, there are numerous samples with static ...
6
votes
3answers
2k views

How do you handle increasingly long compile times when working with templates?

I use Visual Studio 2012 and he have cases where we added templates parameters to a class "just" in order to introduce a "seam point" so that in unit-test we can replace those parts with mock objects. ...
5
votes
4answers
535 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 ...
5
votes
6answers
404 views

I'm confused about which is the correct way to work with TDD

I'm trying to grasp what's the idea behind TDD and how a team is supposed to work with it. I have the following test case with NUnit + Moq (just writing by memory, it is not assured the example ...
5
votes
2answers
1k views

A weakness of the TDD method?

This is in summary the TDD method: Write a test check if thes test fails write production code run test I think that TDD as presented works only in ideal circumstances. I'll take a simple ...
5
votes
3answers
2k views

Who should be responsible to write test cases? [duplicate]

Should tests in some project be written by the actual person that does the coding (usually senior in our team) or it can be done by junior coders with less experience?
5
votes
3answers
486 views

How much to test in TDD?

I am newbie to TDD (writing first project following TDD practices). I have fairly basic interface IProfiler and an implementation Profiler. interface IProfiler { bool IsBusy {get;} long Elapsed ...
5
votes
10answers
472 views

Is is possible to do TDD without a test tool?

We want to implement a fairly rough outline of test driven development which involves a developer asking themselves the tests at each stage of the development process. I have read here that its ...
5
votes
2answers
375 views

Tools that can catch “fake coverage”?

Hypothetical scenario: codebase is exercised by unit tests run by a TeamCity build-bot, that also uses the built-in dotCover tool to provide coverage metrics. The build will fail if less than X% of ...
5
votes
2answers
395 views

Write tests for unit tests in TDD?

In an answer to another question, I suggested creating a randomized value for input to a specific method. In my experience this has been useful for making tests more readable and it lets you skip the ...
5
votes
5answers
332 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 ...
5
votes
4answers
281 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 ...
5
votes
1answer
377 views

The use of Test-Driven Development in Non-Greenfield Projects?

So here is a question for you, having read some great answers to questions such as "Test-Driven Development - Convince Me". So my question is: "Can Test-Driven Development be used effectively on ...
5
votes
6answers
424 views

Sporadic unittests or TDD?

I've read some basics about unit tests and TDD, but I find it hard to convince myself why TDD can have an advantage over only selected unittests. I've read common arguments for TDD, but don't see the ...
5
votes
4answers
8k views

What does Software Engineer in Test do? [closed]

Normally unit tests were written by developer who write the code, i.e. Test Driven Development. So what does Software Engineer in Test do?
5
votes
1answer
152 views

Testing that an attribute does not exist cannot fail when writing tests before code

I have been taught to follow the Red->Greeen->Refactor pattern when doing TDD. There have been situations where this pattern have not been applicable though. For instance, a test to make sure that a ...
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 ...
5
votes
1answer
172 views

Managing false positives in TDD or BDD

I'm relatively new to TDD and have been thinking a lot about how to manage the perpetually growing pool of tests that comes with it. One of my biggest concerns is about false positives. In my ...
5
votes
5answers
412 views

Is it possible to be agile without use cases and tests?

Rhetoric teaches us that the answer is probably yes. However I feel that we would no longer relate to the vast majority of Agile success stories. I think that my upper management read the benefits ...
5
votes
5answers
459 views

Test driven vs Business requirements constant changing

One of the new requirement of our dev team set by the CTO/CIO is to become test driven development, however I don't think the rest of the business is going to help because they have no sense of ...