test-first

How do you unit test a unit test?

I was watching Rob Connerys webcasts on the MVCStoreFront App, and I noticed he was unit testing even the most mundane things, things like: public Decimal DiscountPrice { get { return this.Price - this.Discount; } } Would have a test like: [TestMethod] public void Test_DiscountPrice { Product p = new Product(); ...

Is there a difference between TDD and Test First Development (or Test First Programming)?

Both ideas sound very similar to me, but there might be subtle differences or the exact same thing, explained in different ways. What is the relationship between TDD and Test First Development/Programming? ...

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 : ...

Test writing strategy advice

So, I'm getting more and more engulfed with test driven development these days and the more code I write while thinking tdd, the more decisions it's seems as though I have to make about the extent of testing that I should write. I would like to set kind of a personal policy as to how much unit testing I should write for my own projects, ...

Test-First development tool for SQL Server 2005?

For several years I have been using a testing tool called qmTest that allows me to do test-driven database development for some Firebird databases. I write a test for a new feature (table, trigger, stored procedure, etc.) until it fails, then modify the database until the test passes. If necessary, I do more work on the test until it f...

Starting a new project - where do I start?

I am going to start a project of my own, which will be ASP.NET MVC + Fluent NHibernate. I want to use test-first approach as much as I can. So, where exactly do I start from? Database schema? Domain model? Mapping domain model classes to the database? ...

Tips and tricks for test-first development.

Just read this blog post - Help! I’m Terrible At Migrating/Restructuring Code In A Test-First Manner. I've had similar experiences, and thought I'd try an open it up to the wider community ... ...

How to develop a StopWatch class test first?

I'm currently trying to implement a StopWatch class. The interface is something like: interface IStopWatch { void Run(); void Stop(); int SecondsElapsed { get; } int MinutesElapsed { get; } } Basically my app will need to use a StopWatch, but for testing purposes it'd be nice to have a way of artifially modifing a Stop...

Couple of questions about unit-testing

Let's assume we are designing a Stack class test-first (TDD): public class Stack<T> { private T[] elements = new T[16]; private int size = 0; ... } This Stack makes use of a size 16 internal array to store its elements. It will work fine until you need to add a 17th element. As I might need a 17th element, I decided to add...

How to conciliate TDD with SUT interface's contracts?

Assuming we are implementing using TDD a Stack class, we would need, for each bit of functionality of our Stack class, to add a new test that exercises it: [TestMethod] public void Should_Be_Empty_After_Instantiation() [TestMethod] public void Should_Not_Be_Empty_After_Pushing_One_Item() ... Now, on the other hand, when doing Unit-Tes...