Close

TDD

How TDD speeds up my development

I was recently implementing an Orchard module and needed to read out a CSV file. Every line in the file contains a username and an email, with a ; in between. I read out the lines and create a User object. I used this simple piece of code: using (var reader = new StreamReader(stream)) { […]

Read More

Convincing people of TDD

Those who know me, know I’m a big proponent of unit testing. I try to write my tests first, but I don’t believe in absolutes. If you write your tests afterwards, at least you’re testing. But not everyone is even convinced of the value of automated tests (be it unit, integration, end-to-end). Frequently, this discussion […]

Read More

ngEurope: Protractor

At ngEurope, Julie Ralph and Chirayu Krishnappa gave an interesting presentation on Protractor. Protractor is a framework for end-to-end testing. The goal was not unit testing, because unit testing won’t catch everything. Like so many of the projects in the Angular and javascript space, it is heavily under development, but the 1.0 release is planned […]

Read More

RhinoMocks and Use Arg T only within a mock method call while recording exception

Ouch, pained my brain over this one for the last half hour or so, but finally found the solution. I had a call similar to: repository .Stub(x => x.TryGet(<Specification>.Matches(y => y.Something), Arg<Customer>.Out(customerToReturn).Dummy)) .Return(true); Because my first argument had a fairly large Matches call (it’s simplified here), I refactored it to: var specification = Arg<Specification>.Matches(y => […]

Read More

Unittesting javascript with QUnit

Test-driven development has become fairly standard (although not everywhere, and tests aren’t always written first). So, when we set out to build our applications and their features, we dutifully write our tests, run them everytime, yadda-yadda-yadda. Then, when we decide to add some javascript goodness to our web apps, so they feel like native apps, […]

Read More

RhinoMock AssertWasCalled vs GetArgumentsForCallsMadeOn

Someone once said something like: “Code is written once and read many times”. That is why I propose not to use RhinoMocks’ AssertWasCalled method for methods that accept parameters. Sure, it’s written faster than using GetArgumentsForCallsMadeOn, but check out the error message you get for this: var expectedMessage = “RhinoMocks baby!”; var actualMessage = “RhinoMocks […]

Read More

When do you write your tests?

After having applied TDD for several years now, and after having assumed my colleagues do the same, I have been surprised lately to hear how many developers write their tests after their code. Test-driven development is meant to be: Write a test See that it fails (and fails correctly) Write your code See that your […]

Read More