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
1answer
33 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
42 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 ...
75
votes
12answers
9k views

Is testable code better code? [duplicate]

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
65 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
66 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
157 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
244 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
60 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
86 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
7k 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 ...
0
votes
0answers
103 views

DBUnit alternatives to test DAO layer

We have a lot of DAO tests written with DBUnit and (it's ugly) datasoure. It's not that hard to edit it and add some new entries but it's annoying. Worse is that we have only one datasource for all ...
2
votes
2answers
170 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
190 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
99 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
131 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
73 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
235 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
320 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
205 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
210 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
142 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
270 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, ...
5
votes
4answers
617 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
216 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
345 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
178 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
113 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
168 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
113 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 ...
-1
votes
1answer
90 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
303 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
176 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
181 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
105 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
146 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 ...
6
votes
6answers
553 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
822 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
197 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
295 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
117 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 ...
4
votes
2answers
305 views

Whose responsibility is it to create the interface and/or acceptance testing? Developer or QA?

I am a backend developer and always create tests for my applications. Recently I study and apply the interface tests (using selenium), but I doubted whether I who should create these tests, developer ...
0
votes
2answers
84 views

Should I put the name of the method I'm testing in the Unit Test method's name/assert message?

Given that a method's name might change in time, is it a good idea to specify the name of the method whose return value I am asserting as a part of the Unit Test method's name? What about the message ...
9
votes
3answers
1k views

In TDD should I have to write Test first or Interface first?

I am learning TDD using c#, as far as I know test should drive the development, that is first write a failing test after write the bare minimum code to pass the test then do refactoring. But it is ...
-1
votes
1answer
97 views

Do you spend your effort to reuse obsolete unit tests or rewrite them entirely? [closed]

I have this javascript project which has a unit test suite(about 200unit tests) that covers about 11.31% of the code that it was testing. The project has evolved greatly but the unit tests where never ...
2
votes
5answers
327 views

TDD: how to test file outputs?

I'm really new to TDD, so I guess this question is pretty basic. We're building a website, and part of the functionality is generating some files (binary files: Excel, PDF, whatever). How should I ...
5
votes
5answers
585 views

If we have TDD and BDD why do we need QA for? [duplicate]

If we have TDD and BDD why do we need QA for? Isn't the job of the developer to write bugs or failing tests? If this is true how a QA fit in? Thanks.
1
vote
0answers
65 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 ...