“Move Fast and Break Things” – Facebook’s Old and Very Catchy https://prodperfect.com/wp-content/uploads/2021/09/breaking-2-min.jpeg Motto
“Move Fast with Stable Infra” – Facebook’s New, Less Catchy https://prodperfect.com/wp-content/uploads/2021/09/breaking-2-min.jpeg motto
Continuous testing is the holy grail of software quality assurance. Get it right, and you get to both move fast and also not break things. But it’s not only the holy grail because it will give your application everlasting life quality, but because it’s elusive, requires a lot of work—work which might end up killing you (think: Indiana Jones and the Last Crusade).
Continuous Testing Complements Development
More specifically, it’s a practice that pairs with continuous development (whether or not your team is deploying continuously). Briefly, continuous testing means that you’re developing continuously and testing every commit as you develop. Slightly more specifically, in continuous development, every developer should be committing fairly small changes, very frequently. Every time a developer commits work to remote, a regression testing suite (at the Unit, API, and E2E levels) runs to make sure nothing in the application has broken. This testing can either occur on a feature branch (perhaps during a pull request) or after the feature branch has been merged on a pre-production environment. If the developer is modifying or introducing workflows, each workflow also gets tested end-to-end. That’s continuous testing.
Here’s why (beyond the obvious benefits of testing generally) it’s so great: your developer has just committed code when it gets tested. Not only have they just committed it, but what they committed is necessarily a fairly small amount of code. Your developers, therefore, get instantaneous feedback while they are still contextually aware of what they just wrote—it’s fresh. And because it’s a small amount of code, there are only so many places to look to find out what went wrong. Your developers can thereby rapidly find, understand, and fix the bug. It doesn’t get to production, it doesn’t make it to a JIRA list, and it doesn’t languish for weeks. It gets fixed in minutes, before production, and generally becomes a non-event.
“Dan, how do I drink the soul-nourishing waters from this mythical cup?”
First, you need to have the infrastructure and culture to support continuous deployment. This is hard and we don’t want to trivialize it, but we won’t focus on it here. If you have the infrastructure and culture to support continuous deployment, then you’re ready for continuous testing.
The biggest challenge to continuous testing specifically is that your tests need to be comprehensive in scope yet also run quickly. These tests ideally need to cover the entire application, and they also need to finish running in minutes. It would conventionally seem like you need to choose between runtime and comprehensiveness, but focus can get you both.
Improving Browser Testing Runtime
By far the slowest part of your testing suite will be your browser tests, so this is where you need to do the most work to limit the number and parallelize. We discuss how to assess which user flows to focus on for browser (E2E) testing here, but in brief: focus on the core workflows your users are actually following frequently in your application. This maximizes bang-per-buck and lets you cover everything important without extending runtime so much that it gets in the way of continuous testing. After you’ve built the E2E tests you want, parallelize the ones you can, using a parallel-friendly framework such as TestCafe.
What if my Needs Are Complex?
If you want to test for edge cases, test cross-browser and cross-device, or otherwise have a very large browser testing suite, you may need to prioritize which tests get run with every build and which tests get run out of band, perhaps every few hours. This will allow you to make sure no regressions get to production that would affect core user flows, and any edge cases or low-impact regressions are caught a few hours later at worst.
All of this requires a lot of work even when you have “made it.” It can feel like a truly gargantuan task to get there if you’re not close. Read on, and we’ll be able to help you break the process into discrete steps.