tdd

ASP.NET MVC TDD with LINQ and SQL database

I am trying to start a new MVC project with tests and I thought the best way to go would have 2 databases. 1 for testing against and 1 for when I run the app and use it (also test really as it's not production yet). For the test database I was thinking of putting create table scripts and fill data scripts within the test setup method an...

In TDD, what is the advantage of running the tests before even writing an empty method?

I see lots of TDD practitioners following this cycle: 1) Write your test as if the target objects and API already exists. 2) Compile the solution and see it break. 3) Write just enough code to get it to compile. 4) Run the test and see if fail. 5) Write just enough code to get it to pass. 6) Run ...

TDD, What are your techniques for finding good tests?

I am writing a simple web app using Linq to Sql as my datalayer as I like Linq2Sql very much. I have been reading a bit about DDD and TDD lately and wanted to give it a shot. First and foremost it strikes me that Linq2Sql and DDD don't go along too great. My other problem is finding tests, I actually find it very hard to define good te...

TDD Spider Solitaire

Another question about TDD from me. I have read some articles and book chapters about TDD and I understand why you should TDD and I understand the simple examples but it seems when I am trying this out in the real world I get stuck very easy. Could you give me some simple TDD examples if you were to program the well known Spider Solitai...

Full Search testing in LINQ (custom filter query)

I have a table that has a list of restaurant names and links to another table that holds the cuisine type. I want to provide a search box on my web page that when typing, each word is searched for in the database and results returned. I was looking for a solution that doesn't involve setting up sql full text search as I want to be able ...

Eclipse Plug-in Development with TDD

I want to add a view to a perspective without having access to the source code of the perspective. Is this possible? Is there a good tutorial for plug-in development using TDD? [edit] I think I have a good starting point with TDDing in plugin development Automating unit tests (junit) for Eclipse Plugin development [edit 02/17/09] I wa...

Unit-tests and validation logic

I am currently writing some unit tests for a business-logic class that includes validation routines. For example: public User CreateUser(string username, string password, UserDetails details) { ValidateUserDetails(details); ValidateUsername(username); ValidatePassword(password); // create and return user } Should my t...

Unit-testing private methods: Facade pattern

Lots of developers think that testing private methods is a bad idea. However, all examples I've found were based on the idea that private methods are private because calling them could break internal object's state. But that's not only reason to hide methods. Let's consider Facade pattern. My class users need the 2 public methods. They ...

How to encourage implementation of TDD?

In a consulting company where the general thought of TDD and automated testing as a whole is appreciated by the programmers but thought of as "been there, done that, doesn't work" by management, how would you convince the powers that be to approve the investment of time and resources to implement such an approach? So, to be specific, th...

Testing Frameworks for C

After doing some work with Ruby, Rails, and RSpec last summer and I learned to TATFT. Now I can't write code without writing tests first. I'm taking a programming course in C next year, and I would like to learn to write C test-driven. Is it a good idea (or even possible) to do TDD with C? If so, are there any good testing frameworks co...

Unit and Functional testing iPhone code?

I just sat in on a seminar about developing apps for the iPhone. The speaker told me that there is NOTHING available for writing unit tests or functional tests for your iPhone software. Is this true? Is there really no testing story for the iPhone as of now? ...

How can I best write unit test cases for a Parser?

I am writing a parser which generates the 32 bit opcode for each command. For example, for the following statement: set lcl_var = 2 my parser generates the following opcodes: // load immdshort 2 (loads the value 2) 0x10000010 // strlocal lclvar (lcl_var is converted to an index to identify the var) 0x01000002 Please note that lcl_...

What Unit Test would you start with?

When you've come up with an overall design / idea for how a part of a system should work, how do you decide where to start when doing TDD, or rather, how do you decide your first test to start with? ...

TDD: How would you work on this class, test-first style?

Hi there, I am writing a small app to teach myself ASP.NET MVC, and one of its features is the ability to search for books at Amazon (or other sites) and add them to a "bookshelf". So I created an interface called IBookSearch (with a method DoSearch), and an implementation AmazonSearch that looks like this public class AmazonSearch : ...

Does TDD(test driven developement) always outweigh cost associated with it?

I am just curious. ...

Basic unit test and C, how do I get started?

Hi After reading quite some threads here at StackOverflow, I have come to the conclusion that I should adopt to some form of test driven development/unit test (or at least explore the area). And since we are talking about c code under Linux, I decided to give check a try (I don't know if this is the right choice but if it's no goo...

What steps would you recommend to move from TDD to BDD?

If you want to move your development process from Test-Driven Development to Behavior-Driven Development what path would you take or recommend? What are the possible challenges that you might face? Moving the development process will be a huge task itself as the paradigm changes, a shift happens in the thought process and the outlook o...

What is a "Stub"?

So, carrying on with my new years resolution to get more in to TDD, I am now starting to work more with Rhino Mocks. One thing I am keen to do is to make sure I really grok what I am getting in to, so I wanted to check my understanding of what I have seen so far (and I thought it would be good to get it up here as a resource). What is ...

Do you TDD for debugging fix?

Hi, I know there's a lot of stuff on TDD and i'm trying to pick up the practice too. But i wonder is it a good idea to to TDD your bug fix too? I was thinking along the lines of find the bug and narrow it down. Write unit test to ensure that it will now pass whatever problem that it previously caused. Write more unit test for other brea...

Rhino Mocks, void and properties

Just starting out with Rhino Mocks and im having a very simple problem, how do I mock a class with a void which sets a property? class SomeClass : ISomeClass { private bool _someArg; public bool SomeProp { get; set; } public SomeClass(bool someArg) { _someArg = someArg; } public void SomeMethod() ...