Upgrading old customized unit tests to TestNG

We maintain a LOT of old tests written in several ‘almost’ JUnit3-like formats (just shy of 540,000 lines of test code).  You see, these tests were written long enough ago, that they did not benefit from some of the features of modern day test frameworks.  Developers would either write their own, or extend JUnit3’s TestCase class to add some additional stuff, because they could, they probably needed to, and because it was the wild west.  No coding standard applied to test code, it was considered different than product code.  Now we know this approach is sub-optimal.  But back in the wild west days, anything went…

Luckily some of what we need to convert can still be done with the Eclipse TestNG plugin.  Some however, will have to be carefully hand-converted…  Yuck!  We are hoping the end result will be worth it though, to be able to take advantage of many of the existing and future features of TestNG.

My shout-outs…  Yeah to user-defined groups!  Yeah to flexibly including or excluding tests directly with annotations in test source code!  We did some of this in our own proprietary ways, but now can standardize the approach.  Yeah to some form of modernization of our test base, and though it will be some effort, it affords us the opportunity to reconsider and cull unnecessary tests, rework and improve some of our test output, and read and understand some legacy test code that we didn’t write, but need to be able to maintain.

At this point, I remain optimistic.  Ask me again how I feel after a few hundred thousand lines of code are scoured and upgraded.

Advertisements
Upgrading old customized unit tests to TestNG