How to use nUnit TestCase to simplify near-identical test cases

Often a situation faced by coders, especially when following test-driven development, is the writing of very similar test cases, changing only in, for example, the expected and actual values, along with some set up parameters. We often end up writing dozens, nay hundreds of near identical test cases, and end up with a test class that looks that it has suffered from a terminal case of copy-paste. This blog post shows a little-known technique for making this sort of test class a little more readable using the nUnit TestCase attribute.

Continue reading

Using Visual Studio 2010 to target .NET 3.5

In common with other big systems, thetrainline’s systems use a variety of technologies under the hood. Most of our code is written for the .NET framework, although there are bits of other technology stacks in there as well.

Recently, working with a project targeting version 3.5 of the .NET framework using Visual Studio, I came across a rather subtle gotcha.

Visual Studio 2010 was released in April 2010 and by default will target version 4 of the .NET framework. Version 4 of .NET came with, amongst other things, the following features.

  • The Parallel extensions library.
  • Dynamic dispatch.
  • Named parameters.
  • Optional parameters.

It was this last feature – optional parameters – that was the original source of this gotcha, leading to ‘error CS0241: Default parameter specifiers are not permitted’.

Continue reading

Trainline Engineering at Silicon Milkroundabout 5.0

The Trainline Engineering team attended Silicon Milkroundabout 5.0, the tech hiring event held at the Old Truman Brewery on Brick Lane on Sunday, May 12th, 2013. It was a great event, well organised and with excellent turnaround of quality job seekers.

thetrainline at Silicon Milk 2013

thetrainline at Silicon Milk 2013 – I’m on the left 🙂

The event’s participants are mostly startups, but also more established companies attended like StackExchangeyammer, king and us at This year many startups gravitated towards recruiting mobile applications development skills alongside more traditional javascript, php and design skills. It was an excellent opportunity for informal conversations with fellow companies, which resulted in several invitations to present at meet-up events.

Continue reading

Writing Automated Tests Using Page Object Design Pattern

A few years ago, I was working on a project where we decided to use Selenium as our automation tool. Writing automated tests was easy and very soon we ended up copying & pasting code and at times hardcoding values in tests and using xpath to get the job done. Although such tests were quick to write and were giving us results that we wanted at the time, as our test suite grew, we could see ourselves getting into a test code maintenance nightmare. We fixed this problem by using the Page Object Design Pattern.

Continue reading