Dealing with Legacy Code! Behat on…
So testing is important these days. In fact I wouldn’t be able to release any code that isn’t backed by automated tests. But as a contractor I often land in situations where there is no trace of any testing frameworks, let alone automated testing. So how do you tackle that?
Turns out behat is perfect for the job. Since behat sits outside of the tech stack being used, it can easily be applied on top of any web application.
Testing is all about building confidence in your work. In the legacy world, you may not have the luxury to automate all possible areas of a website, but you can at least cover the core journeys pretty quickly. Once you have that, you’re laughing. Go ahead and make that change that you wanted from day 1, because these tests have got your back now.
Zoopa Tip!: The strategy of “Lets redo it all, but better this time” is really just a way of deceiving yourself in thinking you know the best that the web has to offer this time. This strategy is never going to be successful. By the time you’ve got your new version, it be the next legacy code to deal with. The problem is the strategy taken to develop i.e the monolith. Start off by taking things apart. Try out creating API’s and microservices, which also have the benefit of having isolated test packs that are super fast to run amongst other benefits.
Go through these articles to get yourself going