Unleashing automated testing for a smooth user experience
Imagine you (and a team of people) have just built a simple currency conversion application that allows you to convert just the top 10 currencies. You test it manually a few times with common currency conversions - euros to pounds, pounds to dollars, dollars to yen - and everything works well. You make it live, and launch it to the entire world. Users are excited, everyone is happy. Suddenly, you receive a handful of complaints. There's a bug with a specific conversion - Swiss Franc to Chinese Yuan. You clench your fist into a ball and punch the closest wall. How did this happen? Okay, so you probably won't be that dramatic about it, but you wouldn't be happy.
All this could have been avoided with some automated end-to-end testing.
Automated what?
Let's get the technical jargon out of the way. I've never put together a theatre production before, but I could imagine if I did, I would want to make sure that everything goes smoothly on opening night. So, I would get all the actors, musicians, and lighting team to do a full run-through of the entire play from start to finish, in proper costume and full makeup. That's what end-to-end testing is: a rehearsal for your application, but one that happens automatically, at the push of a button.
End-to-end tests mimic real user scenarios by pretending to be a user. The browser gets opened, buttons get clicked, and details get typed into an input field as if a real user is doing it. But it's not a real user; it's a robot that moves ten times faster than you or I and so can test more of the site in less time than if someone were to do it manually.
What does that look like?
As a developer at Caution Your Blast Ltd (CYB) we have experience designing, building, and supporting modern cloud-based applications. We mainly use technologies Typescript, NodeJS, and AWS, but we're open to experience with other similar technologies and are experts in cloud architecture and key technologies like CloudFormation, Lambda, SQS, S3, and EC2. We are also knowledgeable in modern development tools and practices, such as CI/CD, DevOps, observability, pair programming, and TDD, in case you were wondering. Nevertheless, for this article I’m going to focus on a specific project I’ve worked on recently to highlight the benefits of this practice.
I've spent the last few months working on a project for the UK Foreign, Commonwealth and Development Office (FCDO) with the catchy name of "Find a Professional Service Abroad" or FAPSA for short. I kid, no one calls it FAPSA; that's just something I made up, but I'm going to run with it.
FAPSA helps British nationals abroad find English-speaking services in the country they're in, like a lawyer, translator, or even funeral director. When I joined, I was delighted to find out it was built with automated end-to-end testing from the ground up, which was great. If I added a new feature to the project, ran the tests, and something failed, I knew I'd messed up something important, so I would make sure I fixed it. If I was lazy and didn't run the tests, they would run automatically in the cloud. If they failed, my changes would be prevented from going live.
Automated testing frees up my time as a developer to focus on writing better code, improving existing features and developing new ones, since it can automatically catch bugs and other issues during the development process. As an example, we recently added multiple forms that allow users to complain about specific service providers, and allow service providers to request their details to be changed. I don’t believe we would have been able to finish these features when we did if we were spending time fixing bugs that were introduced by previous features.
This leads to a better overall product quality, and a more satisfied user base. By investing in automated testing, we can help provide our users with a reliable and enjoyable experience, ultimately leading to higher satisfaction and retention rates.
To achieve this, we use a tool called Cypress (not to be confused with the country Cyprus), written in a format called Gherkin which makes it super easy to write new tests for things I add. The tests run in the cloud with the power of CircleCI, but this could be any automation tool.
Final words
If all of our projects going forward implemented automated testing this could lead to higher user satisfaction, increased customer loyalty, and ultimately greater business success. By automating testing with modern cloud-based technologies and development practices, we can spend more of our time designing, developing and delivering high-quality software that meets the needs of our users.