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)

0
votes
2answers
124 views

whats the relationship between integration testing, TDD and Agile methodology? [closed]

I recently attended an interview and was asked whats the relationship between integration testing, TDD and Agile methodology? I am still puzzled how to answer the question !!
7
votes
2answers
167 views

Cross-language Test-Driven Development

The short question: How do you follow Test-Driven Development on a project that spans multiple languages? Specifically, I'm writing a web application that uses JavaScript and PHP, and I want to ...
33
votes
7answers
4k views

Is there a need to keep tests for simple (self-contained) functions?

Consider this: public function polynominal($a, $b, $c, $d) { return $a * pow($x, 3) + $b * pow($x, 2) + $c * $x + $d; } Suppose you write various tests for the above function and prove to ...
2
votes
1answer
242 views

Testing private methods as protected

I was reading this answer about testing private methods and it mentioned several possibilities: extract methods as public to another class make them public separate the env of test and production ...
1
vote
5answers
52 views

TDD, configuration management, configuration patterns (PHP)

I'm writing a PHP application, following test driven development principles. I want two different configurations: one for development, and one for production. I will be continually expanding the ...
3
votes
1answer
55 views

GUI functional acceptance tests, making them less brittle / obstacle to further development

(Background - skip to bold statement for the crux) I'm working through the book "Growing Object-Oriented Software, Guided by Tests" by Freeman & Pryce, while applying it to a project I'm ...
1
vote
1answer
46 views

Behat/Mink: best practice for testing strings in a web application's GUI

I'm writing acceptance tests for a web application using Behat/Mink. I want to know best practice for testing strings in the GUI. For example: say I want to test that a link exists on the homepage ...
-1
votes
3answers
130 views

Who should write Unit Tests? [duplicate]

Should unit tests be written by the developer who wrote the code or someone else ? And how effective is writing units tests as a method of learning a new system ?
0
votes
1answer
102 views

Step-by-step functional testing automation

I have a basic class in C# from which I create inherited classes for databinding scenarios. You can think of it as a substitute for .NET's DataRow class. I want to automate testing of a typical row's ...
0
votes
1answer
85 views

Unit testing implementation vs behaviour

Is it possible to write a unit test (as opposed to an integration test) in the following scenario: I have a list of Foo objects, some of which already exist in the database, some don't I want to ...
81
votes
12answers
10k views

Is testable code better code?

I'm attempting to get into the habit of writing unit tests regularly with my code, but I've read that first it's important to write testable code. This question touches on SOLID principles of writing ...
2
votes
1answer
94 views

Javascript unit testing - mocks or fixtures?

Interested in some opnion... I'm introducing unit testing of JS into a team, it'll largely be testing modules with many dom interactions and updates. Traditionally I've always used mocks and spys ...
4
votes
2answers
81 views

How to decide what forms the System Under Test

Ok, so we started with the initial version of "The Art Of Unit Testing" and we do unit tests for classes where every test covers one aspect of one method. This has the drawback of high maintenance ...
2
votes
2answers
170 views

Example of writing unit test for a method

I am writing unit tests for an iOS application. I clearly understand the benefits of writing unit tests & TDD, but I am confused about what kind of tests you can write for methods like this; ...
6
votes
3answers
332 views

Advantage/Disadvantage of having all variables declared in a JUnit Test

I've been writing some unit tests for some new code at work, and sent it off for a code review. One of my co-workers made a comment about why I was putting variables that are used in a number of those ...
0
votes
0answers
70 views

how to do test driven development for cgi / lua script

I'm new to cgi and just finished writing my test website using cgi / lua for an embedded device. Now I'd like to try writing some scripts to automate the testing of the various functions I have in my ...
1
vote
2answers
92 views

TDD'ing an external interface

In order to create a very testable codebase, I abstracted away a certain external dependency. To be precise, this dependency is actually implemented by a vendor SDK and it communicates directly with a ...
83
votes
15answers
8k views

TDD Red-Green-Refactor and if/how to test methods that become private

as far as I understand it, most people seem to agree that private methods should not be tested directly, but rather through whatever public methods call them. I can see their point, but I have some ...
2
votes
2answers
176 views

Unit testing and reusing extracted class

Currently I have 3 service classes, they all have a similar pattern, and I need to make a 4th service class which amalgamates the functionality of the other three. Current three classes public class ...
3
votes
2answers
461 views

How do you unit test \ use TDD methods for ETL's and reporting projects?

ETL projects are projects created using an ETL (Extract - Transform - Load) tool such as SSIS, PowerCenter,etc These typically involve reading data from an external source, loading it to a staging ...
0
votes
0answers
108 views

Test-first iterative development in Common Lisp environment

Given: I want to practice proper test-first, continuous delivery-style software development in Common Lisp environment. Problem: How each red-green-refactor iteration of the process should look ...
0
votes
2answers
138 views

Why not using questions in TDD tests descriptions [closed]

I've been a (small) while (ten months more or less) doing TDD for my own applications, trying to improve my skills following this workflow. Thus I am comfortable writing tests, stubbing, mocking, etc. ...
0
votes
1answer
84 views

Test logic with external data [duplicate]

I have a site programmed in PHP where I make more call to external server that return me big xml of data. For each record of the xml I have to make other external call to get other data. So my ...
4
votes
4answers
247 views

Filling the gap between Conception and Unit Test

I am stuck trying to do TDD. I'd rather seek the counsel of others who have gone before rather than waste time with trial and error. QUESTION: What diagrams / exercises / development processes can ...
13
votes
6answers
1k views

Is creating the objects you think you will need ok in a first test in TDD

I'm fairly new to TDD and I have trouble when creating my first test when it comes before any of the implementation code. Without any framework to the implementation code I am free to write my first ...
2
votes
3answers
340 views

Is TDD the best software development philosophy? [closed]

Question: Why not just use BDD-style acceptance tests and do away with unit tests, integration tests, functional tests and all other tests? I have been doing some research into the differences ...
0
votes
6answers
211 views

Cheap implementations in fundamental TDD

This is a question concerning the fundamental approach of TDD, so the example below is as simple as possible which might make it seem a little useless; but of course the question applies to more ...
4
votes
1answer
216 views

Going TDD in the middle of the project

They want us to develop new features of a product with TDD. I know that they don't usually write tests for legacy code of already developed modules. But yet, what if new features have to be added to ...
0
votes
1answer
180 views

MockRepository vs Test Database for Unit Testing

Before starting, this question is not the same as this one. Comming from a PHP background, my experience is in CakePHP, which is a framework that supports Unit Testing by setting up a local test ...
5
votes
1answer
371 views

How do you write tests for methods that interact with data in system files?

I'm trying to be proactive about writing an iOS app in a test-driven manner. However, I'm stumped as to how to test a method that is to interact with real system files. For those familiar with iOS, ...
4
votes
4answers
643 views

How to test a method which is not as much as a unit, because it is more of a 'orchestrator' / 'process' / 'controller' / 'coordination' class [duplicate]

I want to test a method which is not as much as a unit, because it is more of a 'orchestrator' / 'process' / 'controller' / 'coordination' class. This is the case: I have four unit tested classes: ...
2
votes
1answer
228 views

Test driven development workflow for two programmers

We are currently starting with TDD and we want to work in parallel in two programmers - one for writing test (Programmer A) and one for writing actual code (Programmer B). Problem is, how to ...
2
votes
0answers
73 views

Writing a gem supporting compiled languages with Rake. How to test?

I want to create a gem that extends the functionality of Rake, creating commands for compiling .NET code.* Basically, I want to be able to write a Rakefile like this: desc "Build main executable" ...
1
vote
1answer
385 views

How to write unit tests for a piece of code that has a data context?

I am new to unit testing and using Microsoft's unit testing library for following piece of code. When I execute the code normally it executes fine, however when I run unit test written for this code I ...
1
vote
2answers
220 views

TDD and Writing Tests for File Processing

These questions are very similar: TDD for batch processing: How to do it? and TDD: how to test file outputs? but I'm still left wondering some things The app processes files/pdfs. It takes them from ...
2
votes
1answer
116 views

What TDD/BDD tests should be writen to test an ORM

So I'm writing an ORM for NodeJS and using Mocha + Chai to test it. What I want to know is, what tests I should write to it, insertion tests should also have a querying test so I can check if the ...
5
votes
1answer
190 views

How to test network connectivity API using TDD?

I'm currently trying to add TDD on my workflow. I fail to create tests where I can easily test a library that requires remote connections. More precise, my program uses snmp4j library. Currently I'm ...
1
vote
2answers
125 views

Refactoring: reducing duplication without creating flags

I don't know how to refactor a piece of code that differs from other in the number of conditions checked on an if clause. Let me show you a real world example I'm facing right now. The only ...
0
votes
1answer
98 views

Starting a big application with unit testing [closed]

I am learning test driven develeopment and read some books about TDD. I learned rules of unit testing. How can I write unit test, how can I select test method names, Act, Assert, Action and like this. ...
2
votes
2answers
382 views

TDD with repository pattern

In my new project, I decided to try with TDD. And in very beginning I encountered a problem. First thing that I want to do in my application is to give ability to read data from data source. For this ...
4
votes
2answers
181 views

Test Driven Development when the specifications change

These days, it's fairly common for me to be tasked to make a change that actually breaks the prior spec. I know that one of the major ideas behind TDD is to have a suite that verifies all your changes ...
1
vote
1answer
205 views

Unit test approaches other than test-first and test-last? And what about variants of them? [closed]

I'm wondering if there are other approaches, old or new, to writing unit tests, and how viable they are, other than the traditional and tdd unit testing approaches. I know there is behavior-driven ...
1
vote
3answers
115 views

Generating test data for a search application

I have a general question about testing search applications, and what I'm looking for is pointers to resources on the topic that I can go and research on my own. I've tried semi-informed, ...
1
vote
2answers
173 views

Should you mock key-value stores/aggregators

I've always been taught that your tests should run in isolation, and other than a db for ActiveRecord etc., your tests should not rely on any external software/services. e.g. I always mock my other ...
0
votes
2answers
66 views

Unit testing the variables passed to the view from the controller

Let's say I want to test a controller that gets some value from a service and then pass some of all of those values to the view. Do you test that the view gets the result that the controller took ...
7
votes
6answers
610 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 ...
9
votes
4answers
875 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 ...
0
votes
3answers
224 views

What's the idea behind mocking data access in unit tests [duplicate]

I understand that you're not actually supposed to hit the database or disk when doing unit tests... Why is that? Also, taking something like Moq, what is it actually supposed to mock and where? For ...
2
votes
1answer
296 views

2 questions about TDD

I'm just starting to get to grips with TDD, and I have 2 quick questions; I'm assuming that if I were writing software for a software company, that TDD would work alongside the software design? i.e ...
0
votes
1answer
120 views

More appropriate to validate a dependency filter parameter by mock+stub or by expression compile?

My lead is enforcing TDD on our project. He says he's following Uncle Bob (Robert Martin) and SOLID principles. One of the rules he's reinforcing is what I call "the single cog rule"--there should be ...