Faster Builds with NUnit-3 and Rake Multitask

Our team supports nine applications out of the same code base (achieved by a combination of configuration, feature toggles and CSS magic). This code base has been evolving continuously over the last five years and we do at least one release every week and often more than that. Given this scenario, you can imagine how vital a role that unit tests play.

We depend a lot on our unit tests (among other things, of course) to ensure that releases go smoothly and that, when we add that shiny new feature that enables the customer to change her seat, it does not break the feature that lets her get the ticket on her mobile! To achieve this, our team adheres strictly to TDD and we have over 10,000 unit test cases that are run every time a commit is pushed to github and this number keeps on growing with every new feature development that we do.

How could we run our unit tests faster?

OK, so we have great unit-test coverage. However, the side effect of this is that it usually took more than 5 minutes to run the unit tests. Now that is not a very big number by itself but it does become an irritant when we run tests on our developer boxes multiple times a day before we push our commits to git. On a given day, a developer could have spent 15-30 minutes waiting for the tests to run and the build to finish. So how could we spped up this process?

It turns out that NUnit-3 test engine has the ability to run tests in parallel. We hoped that it would reduce our test execution time. In addition, we looked at how Rake Multitask could help us reduce our overall build times. Read on to see what happened…

Continue reading

The scientific approach to increasing conversion

We wouldn’t dream of running an A/B or Multivariate test without a solid hypothesis in place. These little statements are the tiny hearts that power an idea through to completion.

But what is it about this statement that makes it so invaluable? And how specifically has it helped us? I’m hoping this article will give you an answer to these questions, as well as convince you to use them in your testing program (if you’re not already doing so, that is).

Best of all, I’ll be using a real example as a case study! Continue reading

Dockerize your WebdriverIO environment to run everywhere

With functional tests being an integral part of a webapp workflow, we should always try to find ways to make them run smoother and make our lives easier.

My dilemma

I’ve been working with Selenium Webdriver/WebdriverIO for years now, but I have always thought: “Wouldn’t it be great not to need a Selenium server running before starting my tests?”

This may seem like a minor problem, but it means having another tab open in my terminal, starting/stopping that process, and it all gets far more difficult when you try to automate it in a CI environment. In addition to that, you need Java installed to run the Selenium server (or you can use the selenium-standalone npm package, which removes the dependency from Java but still needs to be started/stopped). Continue reading

Microservices with API Gateway, AWS Lambda and JVM languages

At Trainline we use AWS Lambda [1] in conjunction with API Gateway [2] for some of our microservices. Different teams use different languages, but in the Data Engineering team we use Clojure [3] – which is a JVM based functional programming language. Here we share some of the experiences we’ve had developing and deploying REST based APIs using JVM based Lambdas.

Although we normally use Clojure, in this blog post we will present a Java based example (for the benefit of a wider audience). However, we expect that the same results would apply to all JVM based languages (Clojure, Scala, Groovy, etc.) Continue reading

Comment nous avons basculé vers la nouvelle API SNCF sans rien casser

(click here for the English version)

En janvier, nous avons appris que la SNCF souhaitait mettre à jour son système tarifaire, c’est-à-dire l’ensemble des règles qui déterminent le prix d’un billet. Elle laissait tomber les prix des périodes d’affluence des TGV, elle diminuait les changements de prix brusques, elle offrait tant de cadeaux aux porteurs de cartes de réduction que ça sentait bon Noël.

Mais ces nobles objectifs s’accompagnent de grands défis. Tout comme une princesse doit combattre un dragon pour délivrer son prince charmant, la SNCF devrait combattre son système tarifaire actuel pour en extraire une perle de ses cendres. Le sang de ce combat ne pouvait éviter de couler sur leurs partenaires : les guichetiers, les agences de voyage, les GDS, et nous.

Un chevalier sur un train

Les systèmes tarifaires n’ont qu’à bien se tenir !

Continue reading

How We Switched Without A Hitch To A New API

(cliquez ici pour la version française)

Back in January, here at Trainline Europe, we learnt that SNCF, the main French railway company, wanted to update their fare system — that is, the set of rules which determine their ticket prices. The plan was to scrap congestion pricing on TGVs (France’s high-speed trains), reduce sudden price increases, introduce so many offers to discount card owners that it would feel like Christmas!

However, those goals were not without challenges. Just as a princess must defeat a dragon to free her Prince Charming, SNCF had to fight the complexity of its current fare system to extract a pearl from its ashes. The blood from this fight had to drip onto their partners: counter agents, travel agencies, GDSes … and yours truly.

Un chevalier sur un train

Fighting fare systems requires extensive equipment.

Continue reading

Trainline Environment Manager – Now Open Source!

Background

Trainline is Europe’s leading independent Rail ticket retailer, selling £2.3bn tickets per year and enabling our customers to make more than 100,000 smarter journeys every day. We have 150 development staff who are constantly improving our user experiences, and our need to innovate means that we cannot allow the underlying infrastructure to be a constraint on time to market.

This desire for infrastructure agility recently led us to migrate 100% of our Development, Staging, UAT and Production environments from legacy private data-centre to Amazon’s public Cloud. Simply lifting and shifting components into the Cloud would have improved agility somewhat, but for us this was just the starting point. Continue reading

An Introduction to XUnit, Moq and AutoFixture

When it comes to unit testing .NET applications, there are various frameworks, test runners and libraries available. Teams often undergo meticulous efforts to write the right testing strategy for their applications. We in the Odyssey Team, here at Trainline, have been experimenting with a combination of XUnit, Moq and AutoFixture. These technologies fulfil our needs for writing test suites that are much easier to understand, are robust and are quicker to write.

This short walkthrough will give you a brief introduction to each technology and show you how we’ve been working with them. Continue reading

How we implemented a single-page application using React

BuyNowWeb is our latest offering for Train Operating Companies in the UK to sell train tickets. The solution consists of white-labelled web and mobile applications. This post will look into how we implemented a React-based, white-labelled, single-page application.

Nowadays user devices are much more performant. This has made it possible to run application logic on the client side. JavaScript support in modern browsers has come a long way and websites are providing rich user experience comparable with native applications. Because single-page applications can provide a very engaged user experience, we have architected our application to utilise the capabilities of user devices. React became our technology choice because it is a simple and deterministic way of building a user interface composed of small reusable components. Continue reading