tdd

Does Test Driven Development take the focus from Design?

I have mixed feelings about TDD. While I believe in testing I have a issues with the idea of the test driving my development effort. When you code to satisfy some tests written for an interface for requirements you have right now, you might shift your focus from building maintainable code, from clean design and from sound architecture. ...

Dependency Injection and Circular reference

I am just starting out with DI & unit testing and have hit a snag which I am sure is a no brainer for those more experienced devs : I have a class called MessageManager which receives data and saves it to a db. Within the same assembly (project in Visual Studio) I have created a repository interface with all the methods needed to access...

How to mock object construction?

Is there a way to mock object construction using JMock in Java? For example, if I have a method as such: public Object createObject(String objectType) { if(objectType.equals("Integer") { return new Integer(); } else if (objectType.equals("String") { return new String(); } } ...is there a way to mock out...

Developing UI in JavaScript using TDD Principles

I've had a lot of trouble trying to come up with the best way to properly follow TDD principles while developing UI in JavaScript. What's the best way to go about this? Is it best to separate the visual from the functional? Do you develop the visual elements first, and then write tests and then code for functionality? ...

Single most important thing to impart when teaching TDD

I'm collaborating with a group of professionals to put on an event to help teach the practice of TDD to people who are interested, but have no experience (novices). We're trying to come up with labs, workshops, etc and I'm trying to think of the single, biggest thing that we need to impart upon these individuals to help them be successf...

Adversarial/Naive Pairing with TDD: How effective is it?

A friend of mine was explaining how they do ping-pong pairing with TDD at his workplace and he said that they take an "adversarial" approach. That is, when the test writing person hands the keyboard over to the implementer, the implementer tries to do the bare simplest (and sometimes wrong thing) to make the test pass. For example, if t...

Unit Testing Guidelines

Does anyone know of where to find unit testing guidelines and recommendations? I'd like to have something which addresses the following types of topics (for example): Should tests be in the same project as application logic? Should I have test classes to mirror my logic classes or should I have only as many test classes as I feel I ne...

Is it feasible to introduce Test Driven Development (TDD) in a mature project?

Say we have realized a value of TDD too late. Project is already matured, good deal of customers started using it. Say automated testing used are mostly functional/system testing and there is a good deal of automated GUI testing. Say we have new feature requests, and new bug reports (!). So good deal of development still goes on. Note...

What not to test when it comes to Unit Testing?

In which parts of a project writing unit tests is nearly or really impossible? Data access? ftp? If there is an answer to this question then %100 coverage is a myth, isn't it? ...

How do you integrate a TDD approach with VisualStudio?

I am interested in hearing about experiences using TDD and unit testing for C++ in general with Visual Studio 2005 (Professional) First some background. We have a fairly large project and much of it has been developed on Linux using CppUnit for the unit tests. The project is divided into several libraries, each with their own set of tes...

Can TDD Work in a Architect/Implementer Environment?

This has been on my mind lately as I can clearly see the benefits of TDD. I can very easily see how tests could drive a good design if the developer has an idea of what the functionality should be. This may be an overly simplistic statement, but from everything that I’ve read, TDD advocates that you have no design beyond your project arc...

Best Practices of Test Driven Development Using C# and RhinoMocks

In order to help my team write testable code, I came up with this simple list of best practices for making our C# code base more testable. (Some of the points refer to limitations of Rhino Mocks, a mocking framework for C#, but the rules may apply more generally as well.) Does anyone have any best practices that they follow? To maximiz...

In which cases do you test against an In-Memory Database instead of a Development Database?

When do you test against an In-Memory Database vs. a Development Database? Also, as a related side question, when you do use a Development Database, do you use an Individual Development Database, an Integration Development Database, or both? Also++, for unit testing, when do you use an In-Memory Database over mocking out your Reposito...

How do you unit test web page authorization using ASP.NET MVC?

Let's say you have a profile page that can only be accessed by the owner of that profile. This profile page is located at: User/Profile/{userID} Now, I imagine in order to prevent access to this page by other users, you could structure your UserController class's Profile function to check the current session's identity: HttpContext.C...

What would you like to see in a TDD demo?

I am going to be giving a presentation on TDD and I always struggle with what to put in the demo when giving this presentation. I usually only have about an hour to do the actual coding portion of the demo so it can't be too extravagant. However, using a "classic" example (stack,queue) is a bit simplistic for most developers. It leaves t...

Developing N-Tier App. In what direction?

Assuming the you are implementing a user story that requires changes in all layers from UI (or service facade) to DB. In what direction do you move? From UI to Business Layer to Repository to DB? From DB to Repository to Business Layer to UI? It depends. (On what ?) ...

TDD. When you can move on?

When doing TDD, how to tell "that's enough tests for this class / feature"? I.e. when could you tell that you completed testing all edge cases? ...

Is there something like ZenTest/Autotest for Java and JUnit

I've used ZenTest and autotest to work on Ruby projects before, and I used to using them for test-driven development a la this configuration. I have a project that I'm currently working on in Java, and I was wondering if there is something similar in the Java world to achieve the same effect. ...

Is Test Driven Development good for a starter?

Expanding this question on how I learnt to pass from problem description to code Two people mentioned TDD. Would it be good for a starter to get into TDD ( and avoid bad habits in the future ? ) Or would it be too complex for a stage when understand what a programming language is? ...

Handling TDD interface changes

I've begun to use TDD. As mentioned in an earlier question the biggest difficulty is handling interface changes. How do you reduce the impact on your test cases as requirements change? ...