Legacy Apps and Things You Are To Be Aware Of To Test Them Right

You are here

Legacy Tests

Old womanLegacy applications also require attention. Sometimes they are even more demanding then new ones. This may happen due the code was originally written a while ago by different developers and may not even be solid by today standards. How may you determine than one bug fix will not lead to series of other crashes taking place here and there?

Unit tests seem like the most reasonable solutions to such kinds of tasks. But they may be hard to implement hence your legacy code may have been written long before this practice was wide spread or the code may not be designed to meet unit test requirements. Still, this is not a reason abandon something as useful as Unit Tests.

Logic in the model

Your developers should create their very own models, especially that many frameworks are encouraging them to do so. Models, that are independent of other parts of the legacy app. Such an approach makes unit testing easier due code has much fewer dependencies. Such an approach allows developers and testers to focus on validating logic and business requirements. Meaning unit tests may be used instead of functional tests which are nice.

If logic is placed into a layer model there are several possible ways of using it as well, which is nice. If the model contains most business logic than other models are responsible for passing data as well as displaying that logic and this, in turn, may be easily transformed into API components.

Outside libraries

Logic is often included in views and controllers making legacy tests more difficult as these functions require the involvement of other app components. The reasonable solution lies in outside library creation. Such libraries require being accessed by the view or controller.

One more thing you can’t afford forgetting is the difficulty developers may experience while covering all the code with tests due framework usage. Frameworks make such tests more difficult but are not making testing impossible. If a unit test fails, go for functional tests and you will end up with a valid legacy app.

Created: 09 Feb 2015