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

Handling API calls in Redux with Redux API middleware

The context

It is very likely that, at a given point during the development of a client-side web app, it will be necessary to communicate with the server side using a RESTful API. If your stack is based on React/Redux, you may have found yourself wondering about where the ideal spot is to call your API and how to handle your application state based on the outcome of the interaction. Continue reading

Supercharging your Production Monitoring

At Trainline our development teams have moved on a lot from what we were doing a while back to what and how we are doing things today. Here are just a few of the things that have completely changed in just the last couple of years: moving to continuous delivery, massive increase in automation testing, new infrastructure, green-blue deployments, load balancing, alerting and monitoring.

What has taken my interest in the last year is the extent of the monitoring that we have available now and how we need to choose what to look at and what not to. Continue reading

Agile and Employee Engagement

i-love-my-job

In our newly formed Agile Community of Excellence, we discussed the topics of Empowerment, Motivation and Engagement.

This is a fascinating area for me and, if borne in mind, is a subject which I think really helps to make any Agile effort a really effective one. Employee engagement matters and a worldwide Gallup poll in 2013 was an indication that no company should be complacent on this.

Empowerment and motivation – more specifically – intrinsic motivation – are key to employee engagement. At Trainline, we have already embraced Agile for lots of good reasons and I believe that employee engagement is one of those good reasons.

So how can we make a positive impact on employee engagement? Below I will share with you three perspectives and consider how Agile principles support these. Continue reading

Deadlines are not Agile! Are they?

deadline

 

Rage against deadlines

How often have you found yourself set an ‘impossible deadline’ and been left asking: “Why the heck am I having to break my neck to hit it? Where did it come from? Who came up with the date?”

Pretty often, huh? I know it’s happened to me a lot. I regularly see people getting very angry about being set a deadline. The typical response is to froth at the mouth and curse “the management”. 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

Better collaboration: Agile and Improv

IMPROVISATION

whose-line-is-it-anyway

Collaboration and creativity are vital for effective Agile Teams. If you’ve ever watched “Whose Line is it Anyway?” on the TV, you will have seen improvisation (“improv”) in action. It is all about people working together in a mutually trusting atmosphere to co-create something new and surprising: the sum of the collective imaginations of those involved and something which could not have been known beforehand. Continue reading