tdd

Is test driven development a normal approach in game development?

Just curious since all TDD examples I have seen is web programming related. And if its not a normal approach, why is it not? ...

Can I mock a super class method call?

Sometimes, you want to test a class method and you want to do an expectation on a call of a super class method. I did not found a way to do this expectation in java using easymock or jmock (and I think it is not possible). There is a (relative) clean solution, to create a delegate with the super class method logic and then set expectati...

TDD for a medium complexity method

I've been out of touch with TDD for some time, and am very rusty. I'd appreciate some suggestions on how to TDD the method described below. The method must find a web.config file in a user supplied application directory. It must then extract and return a connection string from that config file. It returns null if for any reason t...

Stubbing objects with input arguments

So, I'm trying to stub a database connector in order to write tests for it. The problem is that the database connector is a pretty thin layer, and the queries to it are somewhat open-ended. I want my code to be able to ask for a variable from the database, and the connector should be OK with this. The signature for this call looks someth...

Space Fill Addin / Macro for VS2008

I am looking for a way to fill in the blanks when naming test functions. I have seen this demo'd at a few Test Driven Presentations. Can some point me to an addin or let me know how i can create such macro in Visual Studio 2008 [TestMethod] void test login page with failed user(){...} to [TestMethod] void test_login_page_with_failed_...

Test Probabilistic Functions

I need a function which returns an array in random order. I want to ensure that it is randomish but I have no idea how one would go about writing the tests to ensure that the array really is random. I can run the code a bunch of times and see if I have the same answer more than once. While collisions are unlikely for large arrays it i...

Test Driven Development is the way to go. But how should it be done?

A number of developers are designing their applications using Test Driven Development (TDD) but I would like to know at which stage should I incorporate TDD into my projects? Should I first design my classes, do some unit tests and determine what methods are needed or design methods first and then do some unit tests after? What is the ...

What should I consider when choosing a mocking framework for .Net

There are lots of mocking frameworks out there for .Net some of them have been superseded by others that are better in everyway. However that still leaves many mocking frameworks that have different styles of usage. The time it takes to learn all of them well enough to decide witch to use is unreasonable. I don’t believe that we have ...

Rhino Mocks - How to assert a mocked method was called n-times?

How can i assert that a method on a mocked object was called exactly called n-times? Here is the code snippet from a controller action, i like to test: for (int i = 0; i <= newMatchCommand.NumberOfMatchesToCreate; i++) { serviceFacade.CreateNewMatch("tester", Side.White); } The "service facade" object is the (strict) mock and wil...

How do you Mock IUnityContainer?

I'm trying to Mock the IUnityContainer using Moq 3.0 I'm getting a BadImageFormatException, but not when debugging. From the looks of it I'm not the only one that's ran into this problem. here And its a registered issue for Moq here I'm just curious if anyone has found a solution... closest I've found is a nice solution that uses Rh...

Stubbing Chained Methods with Rspec

I want to call a named_scope that will only return one record, but the named_scope returns an array, that's not a big deal as I can just chain it with .first: Model.named_scope(param).first and this works, what I am struggling with is how to stub the chained call. Does anyone have a reference or an answer on how I would go about achie...

(Mis)Understanding Smalltalk and TDD

I'm trying to learn Smalltalk by doing, so I'm getting a grip on the syntax and style by buiding a simple "Matrix" class. First of all, I'd be grateful if linked to a good Smalltak tutorial (although this is totally optional), preferably one that doesn't involve using the GUIs (I'd rather type my .sts than fish around the hierarchy expl...

How to Test-drive GWT development?

Just googling 'TDD' and 'GWT' easily lead to this article where the author explained how he can test GWT app without container. However, I think his example is not test-driven as he has all the design first and than write the test afterwards, not 'test-first'. This leads me to think that is it possible to have 'test-first' development o...

Can Java annotations be unit tested?

I've recently started creating my own annotations and to sport TDD/BDD, I'd want to unit test my annotations to create a clear specification for them. However since annotations are basically merely fancy interfaces which to my knowledge can't be really instantiated directly, is there any way short of reflection to unit test an annotation...

TDD and Service (class what do something but nothing returns back)

I'm trying to follow TDD (i'm newbee) during development of Service class which builds tasks passed by Service clients. The built objects are then passed to other systems. In other words this service takes tasks but returns nothing as a result - it passes built tasks to other Services. So I'm wondering how can I write test for it because...

Which version control programs can enforce running & passing of tests before integration of changes?

At my work we currently use Aegis version control/SCM. The way we have it configured, we have a bunch of tests, and it forces the following things to be true before a change can be integrated: The full set of tests must have been run. All tests must have passed. With test-driven development (TDD) these seem like sensible requirements...

TDD in Visual Studio 2008 add-ins

I am trying to create an addin for Excel using Visual Studio 2008 and I would like to use Test Driven Development (TDD). Pure TDD would start from an empty solution. The following methods are autogenerated when creating a shared addin project: public class Connect { public Connect(){ } public void OnAddInsUpdate(ref System.Ar...

Where can I find beginners video tutorials to TDD / UnitTesting using ASP.NET Webforms?

I am very interested in changing the way I tackle applications to integrate TDD / UnitTesting.. But I don't want to go down the MVC route just yet, and would like to see via Video a beginners guide to using TDD. How you set it up, use it in VS2008 etc... ...

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

MbUnit Rollback

I'm testing the MbUnit Framework and want to keep my test database in a persistent state after each test. How can I accomplish this? This is what I'm trying, but my table is filled after the test is completed. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using Gallio.Framew...