tdd

BDD or TDD? Which do you prefer? and why?

I see many developers disagree on which style of test to use while starting a new project. I'd like to know why you choose this particular style over the other. ...

Testing bash scripts

We have a system that has some bash scripts running besides Java code. Since we are trying to "Test Everything That Could Possibly Break" and those bash scripts may break, we want to test them. The problem is it is hard to test the scripts. Is there a way or a best practice to test bash scripts? Or should we quit using bash scripts and...

How to TDD functionality in a base mixin class from one of many leaf classes?

Hi guys, following on from this question (Developing to an interface with TDD), I'm still having some issues. I test-drove two classes into existence, both of which ended up shared some identical functionality. I refactored a common base class into existence, and all the tests still passed. So far, so tdd-tastic. I needed a third cla...

How do you unit test templating code?

For example, I have a piece of code that's generating a SQL*Loader control file from this template (using Python): template = """ LOAD DATA INFILE '%(file_path)s' APPEND INTO TABLE %(table_name)s FIELDS TERMINATED BY "%(delimiter)" OPTIONALLY ENCLOSED BY "" (\n%(column_specifications)s\n) """ There are only two ways that I can think o...

How do I get webrat / selenium to "wait for" the CSS of the page to load?

When I use webrat in selenium mode, visit returns quickly, as expected. No prob. I am trying to assert that my styles get applied correctly (by looking at background images on different elements). I am able to get this information via JS, but it seems like the stylesheets have not loaded and/or gotten applied during my test. I see that...

Test -> Code -> Refactor, when should we start a refactoring?

The TDD circle is: "Write failing Test" -> "Write Code to fit a Test" -> "Refactor" At "Coding" step we are assumed to write code as simple as possible, just to fix a failing test. We should not write complex code until it is really required. The next step is Refactor. Should we refactor just written code? I think there is no real se...

Can I aim for TDD or BDD in my started project?

I have decided to give a try to TDD and BDD on my already started project, encouraged by answers to questions like this: http://stackoverflow.com/questions/294909/should-i-start-using-tdd-on-a-project-that-doesnt-use-it-already I am struggling to really start with it. My project (opensource, hosted in http://gitorious.org/rubots) is gam...

Trying out Test-Driven Development

After reading this post I kinda felt in the same position as the guy who asked the question. I love technology and coming up with new ideas to solve real world problems just gets my neurons horny, but the other part of the equation - actually getting things done (fast) - is normally a pain in the ass to accomplish, specially when I'm doi...

Gallio Icarus vs. Testdriven.net

What are the differences between using a VS integrated tool like Testdriven.net or using a GUI test runner like Icarus or NUnit GUI? What do you prefer and why? So far i've found that reports are better in Icarus than in td.net, which only features a commandline output. However td.net is faster to use, i can execute single tests more e...

How to start unit testing or TDD?

I read a lot of posts the convinced me I should start writing unit test, I also started to use dependency injection (Unity) for the mater of easier mocking, but I'm still not quite sure on what stage I should start writing the unit tests and mocks, and how or where to start. Would the preferred way be writing the unit tests before the m...

ASP.NET MVC - Unit testing overkill? (TDD)

So I'm starting to catch the TDD bug but I'm wondering if I'm really doing it right... I seem to be writing A LOT of tests. The more tests the better, sure, but I've got a feeling that I'm over doing it. And to be honest, I don't know how long I can keep up writing these simple repetitive tests. For instance, these are the LogOn action...

How to find references when refactoring rails application with textmate?

I have been practicing TDD in C# for several years now and recently have moved to Ruby on Rails full time. I am continuing the practice of TDD with RSpec. My question is regarding the process of finding references while refactoring. In Visual Studio I was addicted to Resharper's "find all references" when renaming or replacing methods. ...

How do you make the unit test sleep for a period of time within the database pro version of visual studio?

using visual studio (database pro) 2008, i have created a unit test (using the SQL unit test) that tests several stored procedures in order. The solution is designed to call each SP after a period of time, not within the same second. Thus the unit test fail and requires a short pause between each call. Any ideas? is there a standard...

Can TDD be a valid alternative to overkill data validation?

Consider these two data validation scenarios: Check everything everywhere Make sure that every method that takes one or more arguments actually checks them to ensure that they're syntactically valid. Pros Very fine check granularity. If the code that is being written is for some kind of library we make sure to limit the damage that ...

How should I handle eventual consistency in SimpleDB, particularly in relation to unit testing?

We're building a web app on top of the Amazon Web Services stack, and I'm loving it so far. We're also making full use of test driven development and that is also proving to be fantastic. I'm just hoping someone can help me out with an issue I've come across which relates to Amazon SimpleDB's "eventual consistency". The best example o...

TDD with IronPython

Can anyone recommend tools or articles that help me to learn how to TDD IronPython code? ...

How to get started on TDD with Ruby on Rails?

I am familiar with the concepts (took testing classes in college), but I am not sure how to really use them yet since I never worked on a "real" TDD project. I am about to start the development of a project using Ruby on Rails (most likely using 2.3). This application will be used to manage data, users and some files. It won't be too co...

TDD: Adding a method to test state

So, I'm starting to write some logic for a simple program (toy game on the side). You have a specific ship (called a setup) that is a ship + modules. You start with an empty setup based off a ship and then add modules to that setup. Ships also have a numbered array of module positions. var setup = new Setup(ship); // ship is a stub (...

Is it a Test Driven Development approach ?

Hi, Suppose the following model public class Product { private Integer requiredQuantity; private Integer allowedQuantity; // getters and setters } public class Order { public void allowsOrder(List<Product> productList) throws AppException { Integer allowedQuantity = 0; Integer requiredQuantity = 0...

What is the best description of TDD?

There are lots of questions on SO about TDD, and a lot of misconceptions. Where can I point people to when trying to answer questions? ...