Category Archives: TDD

AngularJS–Part 8, More choice when testing

Introduction This is a series of posts about AngularJS and our experiences with it while migrating the client of a complex enterprise application from Silverlight to HTML5/CSS/JavaScript using AngularJS as a framework. Since the migration is a very ambitious undertaken … Continue reading 

| 1 Comment

AngularJS–Part 7, Getting ready to test

Introduction This is a series of posts about AngularJS and our experiences with it while migrating the client of a complex enterprise application from Silverlight to HTML5/CSS/JavaScript using AngularJS as a framework. Since the migration is a very ambitious undertaken … Continue reading 

| 2 Comments

Test styles and avoiding setup/teardown

Curious about NSpec, Amir Rajan posted a challenge that posited that NSpec can make your tests cleaner. The results are summarized here: https://gist.github.com/amirrajan/6701522 One thing that is in stark contrast with my tests: https://gist.github.com/jbogard/6690905 And the others is that I … Continue reading 

| 3 Comments

Elaborating on “it depends”

On the discussion on “When should I test?”, I followed up with a conversation: When it provides value. When is that? It depends. And it truly does depend. But upon what? That’s trickier to answer – and there is no … Continue reading 

| 5 Comments

Integrating and isolating the container in tests

In unit tests, an IoC container rarely enters the mix. In integration tests, or more end-to-end tests, I like to use the exact same configuration for the container as I do in production. Recreating production scenarios and environments in tests … Continue reading 

| 6 Comments

Why do TDD?

Because sometimes your test passes the first time you write it. Either you’re done writing any more code, or your understanding of how your code is supposed to work is wrong. Both paths lead to a better spot than without … Continue reading 

| 9 Comments

Are you Mocking Me?

Jimmy has had a couple posts (mocks, mocks, and less mocks) that prompted Derick to post this on his experience with tests – I’d like to add my thoughts to mix.  First, let me say I’m not offering an answer … Continue reading 

Also posted in Books | 3 Comments

Defining unit tests

I don’t know where I got off the tracks on this one, but I’m really liking Michael Feathers’ definition of a unit test: A test is not a unit test if: It talks to the database It communicates across the … Continue reading 

| 16 Comments

Putting mocks in their place

Awhile back, I talked about 3 simple rules for Rhino Mocks: Use the static MockRepository.GenerateMock method.  Don’t use an instance of a MockRepository, and don’t use the GenerateStub method. If the mocked instance method returns a value, use the Stub … Continue reading 

| 15 Comments

Capturing Rhino Mocks arguments in C# 4.0

As a quick review, a test fixture has inputs and outputs.  We set up our test fixture by configuring inputs.  We observe the results through the fixture’s outputs. Inputs and outputs can be grouped into direct and indirect variants.  Direct … Continue reading 

| 1 Comment