Tdd

Facebook Twitter

Linq

Unittesting. Mockobjects. Userstories. Guide: Writing Testable Code. To keep our code at Google in the best possible shape we provided our software engineers with these constant reminders.

Guide: Writing Testable Code

Now, we are happy to share them with the world. Many thanks to these folks for inspiration and hours of hard work getting this guide done: Also thanks to Blaine R Southam who has turned it into a pdf book. Flaw #1: Constructor does Real Work Warning Signs. NHibernate 2.0, SQLite, and In-Memory Databases. For anyone who is having issues with in-memory SQLite databases and NHibernate 2, check this post out! I have been playing around recently with a bit of code that I needed a database to hit against to test it. The code was using NHibernate to directly access the database, so I couldn’t just mock a layer and fake it, I really needed a relational database to access.

So, I began to look around the net, and I found several posts (including this one by Oren Eini) where people have referenced using an in memory SQLite database to test against. Unhandled Exceptions » Blog Archive » UnitTest Utility Library U. A number of readers of this blog have let me know that they have adopted the UnitTestBase and DatabaseUnitTestBase classes that I originally demonstrated from the Summer of NHibernate screencast series as a simple means of facilitating their writing of unit tests.

Unhandled Exceptions » Blog Archive » UnitTest Utility Library U

This is great news as I’m glad others have been finding value in the library and I had of course encouraged anyone interested to try it out and adopt it if it met their needs. These abstract base classes (from which consumers would derive their concrete test fixture classes) provide several convenience facilities that make it slightly easier for a developer to write tests that leverage the RhinoMocks mock objects framework as well as significantly easier to write tests that leverage the NDbUnit database-state-management framework when writing database-interaction unit tests (ok, technically these are integration tests, but you get the point). Some of these conveniences are… TDD and Hard to Test Areas, Part1 - Ian Cooper [MVP] I wanted to talk about the issues that people get when they begin working with TDD, the same issues that tend to make them abandon TDD after an initial experiment.

TDD and Hard to Test Areas, Part1 - Ian Cooper [MVP]

Those are the ‘hard-to-test’ areas, the things production code needs to do, that those presentations and introductory books just don’t seem to explain well. In this post we will start with a quick review of TDD, and then get into why people fail when they start trying to use it. Next time around we will look more closely at solutions. Review Clean Code Now. xUnit.net - Unit Testing for .NET - Release: xUnit.net 1.0.2. TDD Tips: Test Naming Conventions & Guidelines. The idea behind test driven development is that you are writing the test first. Since all code must reside in a method, the very first step before you can write any code, is to name the test.

If you're new to TDD, you'll find this to be a very difficult thing to do. Don't let this discourage you, I'd go so far to say that out of all the tasks a developer must accomplish, finding names for things is perhaps the most difficult. W.H. Auden's statement show's that this "meta" thing transcends development: TDD and Dependency Injection with ASP.NET MVC. One of the guiding principles in the design of the new ASP.NET MVC Framework is enabling TDD (Test Driven Development) when building a web application.

TDD and Dependency Injection with ASP.NET MVC

If you want to follow along, this post makes use of ASP.NET MVC CodePlex Preview 4 which you’ll need to install from CodePlex. I’ll try and keep this post up to date with the latest releases, but it may take me time to get around to it. This post will provide a somewhat detailed walk-through of building a web application in a Test Driven manner while also demonstrating one way to integrate a Dependency Injection (DI) Framework into an ASP.NET MVC app. At the very end, you can download the code. I chose StructureMap 2.0 for the DI framework simply because I’m familiar with it and it requires very little code and configuration. Index at XUnitPatterns.com.