Unit Testing Automation Hits Shift Left Instead of Ctrl-Alt-Delete Cash
March 3, 2021 Nick Blamey
In this time of the coronavirus pandemic, with its dual pressures of the uncertainty of the economy at a small and global scale and the fever pitch need to rapidly modernize applications, it is hard to know where to start. Given this scale of change, as a supplier of application modernization tools that are derived from both a strong IBM i heritage and the youth and strength of open source, you might think that ARCAD Software would be most interested in selling customers its entire toolbox.
Not necessarily – the answer all depends on your starting point. There is an alternative to a big-bang transformation, a progressive path to a fully automated and modern development toolchain, yielding incremental returns. Start with unit testing automation.
Even for those companies that have automated portions of their application development cycle – source code management, the build process, impact analysis, and application deployment, just to name a few key steps – then by definition one of the next big bottlenecks that will slow down the whole process is the lack of automation of unit testing. Unless companies do a no-no and skip proper unit testing on changes made to the code.
Either way, unit testing needs automation to keep the whole development process from bogging down. Those IBM i shops that are still unit testing by hand or with scripts written by heaven only knows who are now under growing pressure to accelerate and secure application delivery with dedicated tooling around the unit testing phase.
A unit test is simple enough in concept: It is a means by which a programmer verifies that an application (or a portion of code within it, more likely in an increasingly modularized software world) that has been created works the way it is intended to do, and importantly, if that application (or any portion of it) changes, does it still work the way it was intended to? While programmers spend a certain amount of time to create code, it can take as much or more time to create unit tests to check to see if code actually works as intended.
No matter how much or how little time each unit test takes, that is engineering effort wasted that cannot be reused again, and it is engineering effort that could be used to actually modernize the applications themselves.
ARCAD iUnit is designed to automate this unit testing effort to get that time back and to expand unit testing to cover more of the code than is possible with manual unit testing – and to do so with less effort than covering less code, using manual unit testing methods, takes. If you don’t have a tool like ARCAD iUnit, programmers have to trace application data values of variables, which is incredibly time consuming. Coding up mocks that eliminate dependencies between chunks of code – basically, simulating the environment surrounding a piece of code so it thinks it is running within the application – is a lot of effort. Even if it only takes 15 minutes for a fairly simple piece of code, that unit test – all of its data and parameters acting as inputs to simulate real inputs to the new code – gets trashed when the test is done. This is incredibly wasteful, and it is bad engineering.
Here is what the process looks like if customers automate the creation and running of unit tests:
With ARCAD iUnit, the unit tests are automagically corrected as the tool detects inputs and outputs of code chunks and traces the values of variables, and equally importantly, the tool creates user defined functions and stored procedures and puts the whole shebang into an ARCAD iUnit repository so the unit test can be pulled again to test code when it is updated again.
Now, for those who want to deploy more pieces of the ARCAD toolbox, ARCAD Observer can be used to show the interdependencies of code in complex, microservices-style applications coded in RPG, COBOL, or C and therefore can figure out where unit tests are necessary in the complete stack of code.
Time is always money in this world, and that means saving time will take a little investment in tools such as ARCAD iUnit – but the amount of time and money gained can be orders of magnitude larger than this investment. The cost curves for software defects looks something like this at most shops:
This is where the “shift left” part of unit testing comes into play. As you can see, most of the defects are added into applications when they are initially coded or when code chunks are altered to add new or extended functions. Because unit testing is difficult, code is not tested thoroughly and only a portion of the application stack is subject to unit testing. Those bugs are still in the code as it goes through function tests and system tests, goes live, and then enters the after release phase. Because errors become harder and harder to fix as the code goes into release and beyond, having all of those errors remaining in production code is very expensive directly (in terms of the cost to fix the errors) and indirectly as code that is not working correctly has an adverse impact on the business, possibly a loss of revenue but at the very least causing additional rework and unnecessary development cycles.
More widely deployed unit testing – carried out as code is being created or tweaked – is what we mean when we talk about shifting left in the development cycle. Automation means a lot less grief and far wider test coverage, allowing for more errors to be found earlier in the development cycle. This is a virtuous feedback loop, indeed, and not only improves the quality of the code created, but allows for programming teams to create more actual business value in the same time.
In a world hell-bent on application modernization and in the development of modern, modularized applications and perhaps even fine-grained microservices interlinked into applications, this is all vital. And best of all, those who invest in ARCAD iUnit today will be positioning themselves to snap right into a full continuous integration/continuous development pipeline using more of the ARCAD toolbox.
To find out more about unit test automation: ARCAD iUnit datasheet
This content is sponsored by ARCAD Software.
Nick Blamey is director of sales for northern Europe for ARCAD Software.
RELATED STORIES
It’s Time For An Application Healthcheck
The New Economy Presents New Opportunities For IBM i
Creating Web Services APIs Can Be Easy On IBM i
Jenkins Gets Closer IBM i Hooks, Courtesy Of ARCAD
DevOps Transformation: Engage Your IBM i Team
The All-Knowing, Benevolent Dictator Of Code
Software Change Management Has To Change With The DevOps Times
Attention Synon Users: You Can Automate Your Move To RPG Free Form And DevOps
Git Started With GitHub And ARCAD On IBM i
One Repository To Rule The Source – And Object – Code
Data Needs To Be Anonymized For Dev And Test