Trainline replatforming: our front-end journey

screen-shot-2016-12-16-at-12-47-28

We recently started working on rebuilding the desktop version of the Trainline website. It is a big deal for the front-end engineering team because we have to make sure every choice is justified so that the user experience is never compromised. I am writing this blog post to explain how we went about selecting our front-end tech stack and why we made these choices. 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

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

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

Use proxyquire to mock your React components

Testing React components has become trivial as more and more of them are now stateless functions.

The new shallow renderer and tools like Enzyme make it possible to render a component “one level deep” when testing, without even rendering it in some sort of DOM, while still having a great api to traverse the components’ output and assert facts on its behaviour.

Given all these great tools that we have, what happens when we have a container component that renders sub-components (child components) based on some sort of rule/logic?
How do we handle those dependencies to keep our unit tests free from dependencies?

Continue reading

On-boarding at Trainline

I originally posted this blog on my personal website at dannybrown.net but I thought it might also be relevant here on the Trainline Engineering blog.

Trainline Homepage

Trainline Homepage

I’m now entering the sixth week of my time at Trainline. It’s been quite the experience, due to it being my first full-time job and it being a time of significant changes at Trainline in terms of technology, branding and even an expansion into the European rail market. Continue reading

I’m a Database Developer, this is what I think about data

You are sitting at your screen reading a blog about the death of monolithic databases:

comicshopguy

Monolithic databases are so 80s, inflexible, they are an obstacle to change. Referential integrity stops us implementing service orientated architecture, and they cannot be harmonised with continuous delivery”.

 

And you agree.

Well, you may be right, sometimes, but I assume you don’t agree with the following two statements: Continue reading

Foreign keys – don’t go there.

You’re probably a medium-to-large-sized company, you run a medium-to-large application. You apply all the industry best practices, using micro-/plain-old-service architecture, compartmentalise your system into nice tidy chunks. As they usually do, your DB admin doesn’t like to maintain multiple databases and so you’ve been restricted to run everything under one fairly large database.

One fine day, you decided your data is important, it needs integrity. You decided the best thing to do is to introduce foreign keys.

 

You may have just made a big architectural mistake

Continue reading

Keeping New Relic new

Paul, @pkiddie wrote a great blog about how we’ve made our customers happier – and engineers using New Relic. We were also given the opportunity to present some of these ideas at a recent New Relic User Group meetup in London.

New Relic London Meetup May 2015 trainline slides.

Now with New Relic ticking along nicely, and dashboards all up next to our product teams so they can see the error rate, revenue and response times. We wanted to make sure we kept up to date with the latest features from New Relic. (Those updates have been arriving up to twice a month for the .Net APM agent we’re using.) As a cloud hosted platform, New Relic is continuously updated and improved, and we want to get the most out of our investment in it by keeping up to date with each release. It also makes our product teams happy when they get to play around with the latest new features. Continue reading