tdd

To test or not to test - keyboard hook functionality.

Hello! I've never used TDD and unit testing "properly", but would like to learn some techniques. Could you please help me with the idea on writing test methods for this not-so-testable (in my opinion) case. The class I want to test is yet to be written (I remember, I need to write the test first), but it will have a method to hook on W...

Given a short (2-week) sprint, is it ever acceptable to forgo TDD to "get things done"?

Given a short sprint, is it ever acceptable to forgo TDD to "get things done" within the sprint. For example a given piece of work might need say 1/3 of the sprint to design the object model around an existing implementation. Under this scenario you might well end up with implemented code, say half way through the sprint, without any te...

BDD/TDD mocking data the tricky way.

So a coworker and I are in a fairly heated debate. We are beginning a new project and we are attempting to use BDD. We are both first-timers and don't fully understand what practices should be used. We've written some specs and we are now implementing the code. Things are getting pretty tricky since there is a lot of database interaction...

How to unit test reading an Excel reader?

I have an ExcelReader class in my C# application - I need to import Excel spreadsheets into database tables. My problem is that this is one of the few untested classes - I cannot use a "mock input" for it, and testing with an actual Excel spreadsheet makes the test a bit slow (about one second). I know the class is working correctly - I ...

Does TDD mean not thinking about class design?

I am making a role playing game for fun and attempting to use TDD while developing it. Many of the TDD examples I see focus on creating the test first, then creating objects that are needed to get the test to pass. For example: [Test] public void Character_WhenHealthIsBelowZero_IsDead() { // create default character with 10 health ...

TDD/BDD screencast/video resources

I've recently finished watching the Autumn of Agile screencasts and I'm looking for more material of similar scope. Basically, I'm looking for screencasts that present TDD/BDD process while developing somewhat "real life" applications (or parts of them) - so no 20 minute intros please. I'm surprised not to find anything like that though....

How Do I Describe 'Less Than Simple' Behavior (BDD) in Code?

Suppose that I am intending to draw some user-supplied text on a bitmap in C#, what sort of tests would I write up front? Is this sort of thing even possible? BDD seems very straight-forward when dealing with mathematical problems but I find it near impossible and more trouble than it's worth when dealing with custom UI controls, graph...

How to setup ASP.Net MVC solution for quickest build time

I want to find the best setup for ASP.Net MVC projects to get the quickest code-build-run process in Visual Studio. How can you set up your solution to achieve near zero second build times for small incremental changes? If you have a test project, with dependencies on other projects in your solution, a build of the test project will ...

How do you do TDD in Xcode?

Are there any good unit testing and acceptance testing frameworks that can be applied to XCode projects? I'm accustomed to doing TDD in Ruby and Python but am new to Objective-C and XCode. ...

How can I test-drive IOKit userspace driver development?

I'm about to attempt to write a USB driver for my application on OS X using IOKit. I've opted for the userspace route rather than developing a kext since it's so much easier to debug etc, but I'm having trouble working out how I could possibly test-drive my development. If possible, I'd like to find a way to insert a fake USB device i...

When to use a unit testing framework (vs. just using asserts)?

Using a small (currently at 150 loc, probably less than 500 when finished) C project I'm working on, I'm teaching myself test driven development. Based on some stuff I've found on the web - especially these slides by Olve Maudal, I've just been using asserts in my unit tests. Since I'm just learning tdd, I have thus far avoided the ove...

How to teach a training course on TDD?

I've been asked to run an internal training course for a handful of our developers on Test Driven Development. What advice do you have for me, as someone who has never given a training course before? I'd like advice on the delivery of training, as well as your thoughts on what content I should include. Anybody who has been on a similar...

Dead-simple introduction to TDD (Test driven development)

Hello. Even though there are plenty introductions to TDD (even in PHP, my primary programming language now), I'm feeling a bit stuck about it. My friend introduced me TDD a while ago, but I wasn't actually able to understand it - what's the point in writing tests to everything first - even the simplest tasks - when in the end, it looks...

TDD: Unit testing focus

Could TDD be oriented to another kind of testing different from unit testing? ...

How does TDD compare with Functional Programming Languages?

How does TDD compare with Functional Programming Languages like F# and Erlang? I haven't actually worked directly with a functional programming language yet, but from what I've seen of it, you have two sides of an equation and they have to balance like in algebra or accounting; this seems somewhat reminiscent of TDD where you define you...

How to report the effect of TDD

I am trying to become more familiar with test driven approaches. But I am embarrassed because I have to report the effect of TDD. I should report on the UT result to the superior. (I reported value of bugs, when I enforced UT(unit test).) But I can not obtain the UT(unit test) result if I try TDD. Please let me know how to report the e...

Accessing factory_girl factories in *other* factories

I'm using the factory_girl plugin in my rails application. For each model, I have a corresponding ruby file containing the factory data e.g. Factory.define :valid_thing, :class => Thing do |t| t.name 'Some valid thing' # t.user ??? end I have lots of different types of users (already defined in the user factory). If I try the foll...

How much unit-testing before start coding a method/class?

I´m starting (trying at least) to do coding using TDD principles and I have this question: how much tests do I need to write before actually start coding? Take for example a hypothetically Math class and a method Divide(int a, int b). a) Do I have to fully test all methods of Math class (Sum, Average, ...) before start coding Math? b)...

Unit Tests Execute Really Slowly in Visual Studio 2008

I downloaded the MVC Storefront source code from Codeplex (http://mvcsamples.codeplex.com/) (the "Recommended Download", not from the most recent source code). If I click the "Run all tests in solution" button in VS 2008, the tests start to run, but they take about 3 seconds EACH, and there are 194 tests which would take about 10 minut...

Team Foundation Build or TeamCity?

Hello, We are a mostly MS shop at work doing .NET LOB development. We also use MS Dynamics for our CRM app... all the devs are currently using VS/SQL Server 2008. We also use VSS, but everyone hates it at work and that is quickly on its way out. We are begining our initiative for TDD implementation across the team (~dozen ppl). I've g...