NPR: 3 Things We Learned about Testing Legacy Web Applications
Legacy applications can present a difficult challenge of many organizations -- while they may not represent the latest and greatest work that the team has produced, they can challenging and expensive to ignore or replace entirely.
But that doesn't mean that they don't have value: “When people talk about legacy applications, it’s almost like a bad thing. It implies that something is out of date or needs replacing. Maybe that’s one way to look at it, but I prefer a different definition: this is an application that’s in production, is scaled, and is touching people’s lives,” said Paul Miles, a software development manager at National Public Radio (NPR).
Paul recently gave his take on maintaining legacy applications during a recent webinar hosted by Rainforest QA. Here are three key takeaways on testing legacy apps that Paul shared during the webinar.
Start Writing Tests from the Top Down
While it might be intuitive to start from the bottom of the pyramid and write unit tests, Paul suggests that legacy app owners start at the top with critical UI tests:
“The goal here isn’t to cover every single feature, and it isn’t to create the most perfect test suite in the world. What you really want to do is step back and ask the question, ‘if we release this software out into the world, what are the key things that have to work?’”
Getting tests up and running as quickly as possible will help you move the dial on coverage and quality. You can add tests later as needed. Paul says that testing automation can be a huge timesuck. By using tools like the Rainforest platform to build and maintain critical tests, you can ensure that key functionality of your legacy app stays stable and regression-free.
2. Approach Existing Tests Methodically
While it’s tempting to dive in and start fixing any tests that already exist, this might more of a time and resource sink than they’re worth. “If you’re walking into a legacy application that you’ve never laid eyes before, you might find out that there are a lot of tests that might already exist, and no one’s running them and nobody knows that state of them. Run them, and if any of them are failing, just ignore them,” says Paul.
Run the unit tests that do pass with every build and integrate them into whatever tool you’re using to surface reports -- whether that’s Hipchat or Slack, or a build server. Your goal is to leverage existing tests to get as much information as possible.
3. Leverage Static Quality Analysis
Paul adds that beyond writing tests, static quality analysis is an often overlooked but effective way to improve code quality. “There’s nothing that says that for a legacy application that you just have to focus only on user interface testing or unit testing or anything like that. A good place to start is just by looking at and scrutinizing the code that you’re writing and maintaining every day,” Paul advises.
Staying focused on the new code that you have, rather than trying to fix the “thousands and thousands of issues” that these tools might surface keeps your product moving forward. Paul recommends that teams do a “periodic paydown” and pick an outstanding issue to deal each time.
To learn more about NPR’s testing infrastructure, and to find out how teams can use Rainforest to increase test coverage on legacy applications, download and listen to the recording of Paul Miles’ webinar on QA Strategies for Testing Legacy Web Apps.