tdd

Can you pair program remotely?

We have a team of about 7 engineers, whom I supervise. We do not have a formal office where we all work. Instead, a handful are located outside of our city, while the rest of us are scattered around the Bay Area. Quite frequently, I find myself attempting to teach concepts like TDD or refactoring to some of our more junior (or not) deve...

Checking the results of a Factory in a unit test

I have developed some classes with similar behavior, they all implement the same interface. I implemented a factory that creates the appropriate object and returns the interface. I am writing a unit test for the factory. All you get back is an interface to the object. What is the best way to test that the factory has worked correctly?...

UI and event testing

So I know that unit testing is a must. I get the idea that TDD is the way to go when adding new modules. Even if, in practice, I don't actually do it. A bit like commenting code, really. The real thing is, I'm struggling to get my head around how to unit-test the UI and more generally objects that generate events: user controls, asynch...

Test Driven Development in PHP

I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework. I would like to start using TDD in new projects but I'm really not sure where to begin. What recommendations do you have for a PHP-based unit test...

How do I become "test infected" with TDD?

I keep reading about people who are "test infected", meaning that they don't just "get" TDD but also can't live without it. They've "had the makeover" as it were. The question is, how do I get like that? ...

What is this Icarus thing that comes with MbUnit?

I've had to install MbUnit multiple times now and it keeps coming with something called the Gallilo Icarus GUI Test Runner. I have tried using it thinking it was just an update to the MbUnit GUI but it won't detect my MbUnit tests and sometimes won't even open the assemblies properly. Perhaps I'm just overlooking it but I haven't been ...

How to convince a project sponsor that all functions in your code should have unit tests

Non technical people in most cases do not see any value in writing unit tests. They just want to have basic code completed and do not spend money and time on such things like unit tests. Later, every day they just to ask to fix a one bug more. Projects are missing deadlines and they still don't see value in good automated tests. ...

Application Testing

Is the real benefit in TDD the actual testing of the application, or the benefits that writing a testable application brings to the table? I ask becuase I feel too often the converstation revolves so much around testing, and not the total benefits package. ...

When Testing your MVC-based UI, how much of the test setup do you make common?

I'm trying to test a simple WebForms (asp.net) based UI, and follow the MVP pattern to allow my UI to be more testable. As I follow the TDD methodology for backend algorithms, I find that there are some unit test refactorings that happen in the spirit of the DRY principle (Don't Repeat Yourself). As I try to apply this to the UI using ...

What Makes a Good Unit Test?

I'm sure most of you are writing lots of automated tests and that you also have run into some common pitfalls when unit testing. My question is do you follow any rules of conduct for writing tests in order to avoid problems in the future? To be more specific: What are the properties of good unit tests or how do you write your tests? L...

Database integration tests

When you are doing integration tests with either just your data access layer or the majority of the application stack. What is the best way prevent multiple tests from clashing with each other if they are run on the same database? ...

How do you know what to test when writing unit tests?

Using C#, I need a class called User that has a username, password, active flag, first name, last name, full name, etc. There should be methods to Authenticate and Save. Do I just write a test for the methods and do I even need to worry about testing the properties since they are .net getter & setters? ...

Disadvantages of Test Driven Development?

What do I lose by adopting test driven design? List only negatives; do not list benefits written in a negative form. ...

TDD and productivity

Ignoring the obvious benefits after the code has been written, I am interested to get a rough idea how much productivity is initially lost, or how much extra time is initially required, due to the requirements of TDD. I am aware of the benefits of TDD and the productivity gains that come from writing less buggy code, I am just intereste...

Refactoring and Source Control: How To?

I am completely on board with the ideas behind TDD, Refactoring and Patterns however it does seem like there is a huge gaping whole in these ideas, mainly that they are great for dev teams of 1, but when you start refactoring code that 10 people are working on you start getting merge conflicts all over the place and most diff/merge softw...

Is there a cross-language TDD solution?

I want to write a simple colour management framework in C#, Java and AS3. I only want to write the unit tests once though, rather than recreating the unit tests in JUnit, FlexUnit and say NUnit. I have in mind the idea of say an xml file that defines manipulations of "instance" and assertions based on the state of "instance" via setup,...

What are some common misunderstandings about TDD?

Reading over the responses to this question http://stackoverflow.com/questions/64333/what-is-the-downside-to-test-driven-development I got the impression there is alot of misunderstanding on what TDD is and how it should be conducted. It may prove useful to address these issues here. ...

RhinoMocks: Correct way to mock property getter

I'm new to RhinoMocks, and trying to get a grasp on the syntax in addition to what is happening under the hood. I have a user object, we'll call it User, which has a property called IsAdministrator. The value for IsAdministrator is evaluated via another class that checks the User's security permissions, and returns either true or false ...

How to test function call order

Considering such code: class ToBeTested { public: void doForEach() { for (vector<Contained>::iterator it = m_contained.begin(); it != m_contained.end(); it++) { doOnce(*it); doTwice(*it); doTwice(*it); } } void doOnce(Contained & c) { // do something } void doTwice(Contained & c) { // do so...

Testing GUI code: should I use a mocking library?

Recently I've been experimenting with TDD while developing a GUI application in Python. I find it very reassuring to have tests that verify the functionality of my code, but it's been tricky to follow some of the recommened practices of TDD. Namely, writing tests first has been hard. And I'm finding it difficult to make my tests readable...