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
votes
0answers
57 views

Algorithm / Coordinator or Worker / Integrator Distinction

In this article by Jakub Holý on writing maintainable and evolvable tests, the author shares his experience of a course lectured by Kent Beck and that when designing a part of the system Kent would ...
0
votes
0answers
42 views

Mixing newable and injectable in a Callable

I recently read http://misko.hevery.com/2008/09/30/to-new-or-not-to-new/ which discussed newable vs injectable objects. What would you do if you needed to make a Callable that talks to some service ...
1
vote
2answers
116 views

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

We're looking to concentrate more on testing behaviour (as opposed to every class/method individually) in all our automated tests, as espoused by various high-profile online discussions recently. I ...
1
vote
2answers
95 views

In the BDD paradigm why should the “ubiquitous language” be merely semi-formal and not completely formal?

Here's the relevant quote: A common risk with software development includes communication breakdowns between Developers and Business Stakeholders. BDD uses the specification of desired behavior as ...
4
votes
4answers
296 views

Test-Driven Design is not Unit Testing [closed]

Ran across this statement by Martin Fowler circa 2002: Unit testing in XP is often unlike classical unit testing, because in XP you're usually not testing each unit in isolation. You're testing ...
10
votes
1answer
344 views

Testing strategy for games

I've inherited a web-based educational game. Over the past year I've worked towards stabilizing the code and adding new features. Most of the logic is in the front-end, so back-end unit tests, while ...
0
votes
3answers
84 views

Is it anti-pattern to mix unit test and web test? [duplicate]

It is a language agnostic question, e.g. I have a unit test like # Unit test User user = User.create('john'); assertEquals("User name is john", "john", user.getName()); # Web test start from here ...
2
votes
2answers
43 views

Isolated Unit Tests and Fine Grained Failures

One of the reasons often given to write unit tests which mock out all dependencies and are thus completely isolated is to ensure that when a bug exists, only the unit tests for that bug will fail. ...
2
votes
1answer
106 views

How is the correct way of writing TDD for a void API?

Ok so my scenario is this: I have a third party component that offers an API for communicating with an external system. The method calls for commanding the external system to do stuff, all return ...
4
votes
2answers
117 views

Is it ok to write “extra” unit tests?

My understanding of how TDD should work is that you write a failing test for the next bit of functionality you want to add to a function or object, code until the test passes and then write the next ...
5
votes
1answer
142 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 ...
0
votes
3answers
176 views

Drawback of using static method [duplicate]

For methods that never access instance variable or static variable and they act just like a function (name-spaced) and they are deterministic base on only the input arguments , I want to ask, are ...
1
vote
1answer
68 views

Question about mocking externals [duplicate]

at company we're developing quite a big project and we're arguing at the testing strategy. The question is: should all of the tests be executed in isolation of external services like database or APIs ...
1
vote
3answers
148 views

Protected variable & protected method in the era of TDD [closed]

I understand protected method is good for unit testing since you can easily mock by the class by overriding the protected method for the sake of testing. However, protected variable is just a global ...
24
votes
6answers
2k views

Sense of unit tests without TDD

We have new (quite big) project starting, that we planned to develop using TDD. The idea of TDD failed (many business and non-business reasons), but right now we have a conversation - should we write ...
0
votes
2answers
67 views

how to write unit test for AND logic gate

I'm learning about unit tests, and have a doubt for a test i want to do, to implement an "AND" logic gate A B A^B 0 0 0 0 1 0 1 0 0 1 1 1 how can i test for a method that works ...
8
votes
2answers
184 views

Test Driven Development for Complex Games

I'm coding a game in my spare time, but I am mostly still a beginner when it comes to programming. I'm sorry if this question is off topic or if it ends up not being helpful to anyone else, but ...
3
votes
4answers
184 views

How to identify and run the most relevant automated tests?

Suppose you have a reasonably large codebase (0.5 - 1 msloc) with a large test-suite (6-7hr single-threaded runtime; with a mix of unit-tests and integration-tests built with different tools). You ...
4
votes
1answer
76 views

Keep or discard tests that use methods now private [duplicate]

When writing object-oriented code from scratch, I try to follow these steps: Write a test that fails. Write a function that makes the test pass. When enough tests and functions are complete, ...
2
votes
1answer
71 views

Wrapping function in closures to make testable functions

In my nodejs project, I have functions like this for socketio. socket.on('draw', function (data) { socket.broadcast.to(socket.room).emit('draw', data); addEvent(socket, ["draw", data]); }); ...
17
votes
4answers
824 views

How can I use unit tests and TDD to test an app that relies mostly on database CRUD operations?

At work, one of my projects is mostly about taking data passed in from an external client and persisting it in a database. It's a Java enterprise app using JPA and most of our logic revolves around ...
2
votes
1answer
160 views

acceptance test driven development in c++

Was put on hold at stack overflow: hopefully it has value here. I want to use a BDD / TDD / ATDD approach in c++. However I really want to emphasize vertical slices of end to end functionality rather ...
1
vote
2answers
69 views

Creating an Interface To a Language's Standard Library?

In the process of learning test-driven development, I've been introduced to dependency injection and the use of interfaces, and have started using these concepts in my own PHP code in order to make it ...
2
votes
2answers
173 views

Relationship between TDD and Software Architecture/Design

I'm new to TDD and have been reading the theory since applying it is more complicated than it sounds when you're learning by yourself. As far as I know, the objective is to write test cases for each ...
0
votes
1answer
85 views

How to unit test models in MVC / MVR app?

I'm building a node.js web app and am trying to do so for the first time in a test driven fashion. I'm using nodeunit for testing, which I find allows me to write tests quickly and painlessly. In this ...
9
votes
3answers
372 views

Designing unit tests for a stateful system

Background Test Driven Development was popularized after I already finished school and in the industry. I am trying to learn it, but some major things still escape me. TDD proponents say lots of ...
0
votes
1answer
108 views

How do you detect lying Stubs/Mocks?

Consider this piece of code from the PHPUnit manual(I'm using PHP only as an example): class StubTest extends PHPUnit_Framework_TestCase { public function testStub() { // Create a ...
3
votes
3answers
134 views

Using 2 Constructors: one that injects dependencies and one that instantiates them

I started using TDD for the first time on a project I started recently. I have a few objects with dependencies and structures that look something like this: public class MyClass { private ...
0
votes
1answer
120 views

Is there a name for this technique in testing? [closed]

When I've written tests for some code and want to make sure that it's actually testing what it's supposed to, I'll mess up or remove the code-under-test, and see if the tests fail. If they don't, I've ...
1
vote
4answers
172 views

Help in ensuring unit tests are meaningful

I've just written a unit test for this function, which loops through a collection of dates and sets properties equal to true or false depending on whether they're before or after a given comparison ...
3
votes
2answers
82 views

How to pick the testing values for parameterized tests for stateless functions?

When writing (parameterized) tests for stateless functions, how do I determine the most ideal set of values to test with? I'm writing a class with mathematical functions in C#, and I want to write ...
2
votes
2answers
216 views

How to know what to test in TDD? [duplicate]

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 ...
2
votes
3answers
138 views

How to test state of the object

I have a class DataImport with only two public methods public void fromStream(InputStream inputStream); public ImportCommand getImportCommand(); When I test it I send some test data to fromStream ...
1
vote
4answers
157 views

Implementing TDD for existing code [duplicate]

I've just been learning Unit Testing and I'm trying to understand how I could incorporate it with a project with existing code. Say I wanted to write tests for a specific class in that project, but ...
2
votes
2answers
223 views

Testing abstract class' behavior

I'm currently refactoring an existing design, which was created without TDD. There is a class hierarchy with one abstract base class and two subclasses. In the original design, these classes were ...
2
votes
5answers
438 views

DRY code, DRY tests?

At some point I had to create some class "Class1" and that class needs a method "method". So I have the following: Class1MethodTest: A total of N tests that check the behavior of Class1.method Class1 ...
12
votes
5answers
827 views

Types of unit tests based on usefulness

From value point of view I see two groups of unit tests in my practice: Tests that test some non-trivial logic. Writing them (either before implementation or after) reveals some problems/potential ...
1
vote
2answers
759 views

Testing ASP.NET .aspx and .ascx code behind files

I am wondering how to test .aspx.cs and .ascx.cs code behind. Can I use unit testing and if so how? Are there alternatives that will help test the functions in the code behind files? I don't know how ...
4
votes
1answer
271 views

If TDD is design, how do you know your TDD is well designed? [duplicate]

Given a large group (50+) of programmers: All given the same problem, All using Test-Driven Development (TDD), All pair programming, All doing group-based code review, I have personally seen the ...
4
votes
5answers
295 views

Are there any cases when one should not use Test Driven Development? [duplicate]

Is it recommended that TDD be always practiced in a project, or are there cases when it should be avoided? Should we all adopt TDD? Is it standard practice in major software companies?
1
vote
1answer
132 views

Which to implement first: GUI or backend? [closed]

So, I can code both, but which should I use a base for development? In terms of TDD, should minimal aspects in the GUI be used as the seed from which to grow towards backend logic? or should the ...
3
votes
2answers
243 views

Unit testing behaviours without coupling to implementation details

In his talk TDD, where did it all go wrong, Ian Cooper pushes Kent Beck's original intention behind unit testing in TDD (to test behaviours, not methods of classes specifically) and argues for ...
0
votes
2answers
125 views

Characterization in Testing: Unit test or Functional test [duplicate]

So I'm trying to push for more automated testing in my company, which focus a lot on prototype and proof of concept systems. We currently use Google Test for unit testing. This tests specific test ...
8
votes
5answers
733 views

Why write tests for code that I will refactor?

I am refactoring a huge legacy code class. Refactoring (I presume) advocates this: write tests for the legacy class refactor the heck out of the class Problem: once I refactor the class, my ...
1
vote
1answer
81 views

TDD verifying dependency method invoked correctly

I am trying to follow TDD in my proj but I can't get my head around how to verify I am calling a dependency correctly or even if I should be trying to verify it. Here's the requirement: Write an ...
15
votes
6answers
810 views

From a TDD perspective, am I a bad person if I test against a live endpoint instead of a mock?

I follow TDD religiously. My projects typically have 85% or better test coverage, with meaningful test cases. I do a lot of work with HBase, and the main client interface, HTable, is a real pain ...
0
votes
0answers
48 views

Adding unit tests to brownfield applications [duplicate]

I'm working for a company that has been developing a series of products for years with little to no unit testing in place. They want to move to TDD and unit test new code going forward. However, I'm ...
3
votes
5answers
206 views

Do I need a suite of unit tests for inner business-logic class? Since it's going to replicate the acceptance test suite for 90% [duplicate]

I'm new to TDD and wondering about methodolody. Given: A simple project which implements functionality of, for example, a console calculator. It has the following structure: Fairly simple ...
2
votes
3answers
637 views

Mocking static methods

Having recently returned from a Test Driven Development (TDD) course I had the following thought. While writing unit tests using Mockito we came up against of the problem of mocking static methods. ...
3
votes
4answers
230 views

Building complex algorithms with TDD

I'm trying to adopt TDD in my daily programming practice. I use it at work very effectively, but I'm having trouble with my personal projects where I'm using some complex algorithms. The particular ...