Test4z: Unit Testing for Mainframe, with Confidence

Usher in a new era of code change confidence and application vitality

Petr Vacula
Modern Mainframe
7 min readJan 17, 2024

--

Unit testing voids are a business liability
Unit testing voids are a liability

To me, legacy code is simply code without tests.

— Noted author Michael Feathers

Unfortunately, code without unit tests is the reality for many mainframe applications.

And code without unit tests is a business liability.

The result of poor, or non-existent, test coverage is that even modest changes take far too long and strike fear in teams who lack the confidence that a sound unit testing strategy creates.

Unit testing is the foundation of the quality process — get it right and quality code results; get it wrong and the process fails. For many, changing code can feel like being forced to remove the most precarious of Jenga® pieces.

The lack of confidence among mainframe teams is understandable. Mission-critical in most businesses, mainframe applications can’t fail. Risk mitigation is critical but on the other side of the equation, applications cannot remain static either. Product owners need even more business agility to compete and win in the fast-changing, and increasingly AI-disrupted, marketplace.

Shift-left Value Proposition

By one estimate, it’s 40 times more expensive to catch a defect during System Test rather than during Coding and it’s a whopping 640 times more expensive during the Release stage. Factor in back-and-forth handoffs and the time developers need for ‘cognitive reload’, and late detection has a devastating impact on delivery velocity too.

DevOps was born from this realization.

For many mainframe applications, unit tests are either far too broad to be effective or are missing entirely (i.e., poor coverage).

The process is failing.

So this all adds up to the unfortunate perception that the mainframe is a ‘platform of NO’.

This perception has nothing to do with the platform itself and everything to do with the lack of a simple, focused solution that facilitates unit test best practices.

It’s time for teams to reimagine unit testing for mainframe apps to accelerate software delivery and better serve their business leaders.

Test4z is the solution that enables this fundamental rethink.

Unit Testing Basics

Unit testing helps teams answer a simple question:

“Does the change perform as expected?”

And it does so with the smallest testable part of a program (i.e., the ‘unit’).

It’s a critical question because unit tests serve as quality building blocks and, therefore, are a proxy for long-term application vitality and sustainability in a fast-changing business world.

Tools used for unit testing mainframe applications today are complex, cumbersome, and GUI-driven. Why? Because they were built in the pre-DevOps, back-and-forth era when tasks were performed by different roles; the tools were designed to be used by testers as well as coders.

Developers dislike the existing tools, which is a major reason the process is broken.

And where unit tests exist, they’re far too broad. Rule #1 of unit testing is to keep tests small. Failure to do so results in myriad problems, including a lack of understanding and challenges with maintainability. Today, tests are usually far too broad to be considered true unit tests.

These problems feed on each other and block teams from realizing the benefits of shifting testing left.

And they leave application teams operating without a safety net.

So… let’s reimagine unit testing beginning with key universally-accepted best practices. Practices common in high-performing development shops.

Introducing Test4z: Unit Testing Done Right

Test4z is a unit testing solution for the modern DevOps era and beyond. By focusing laser-like on unit testing, Test4z is a simple yet highly effective solution to these seemingly intractable problems.

This short video demonstrates how simple Test4z is for developers:

Test4z Unit Testing Demo

The design of Test4z began with a set of 6 Core Principles, with Rule #1 at the top of the list:

  1. Keep Tests Small: Units should be the smallest testable part of the program. Fine-grained tests are far easier to understand and maintain and Test4z enables ‘microtests’ at the paragraph or section level.
  2. Isolation: It’s essential for tests to run in isolation from the rest of the system, without relying on the presence or behavior of other components, modules, or external dependencies. This ensures that tests remain focused on the unit’s functionality without being influenced by external factors. Test4z offers advanced mocking capabilities across code, data, and subsystems.
  3. Maintain Tests: Tests should be easy to maintain. For developers, this means making tests an extension of the source code. With Test4z, unit tests are maintained just like application code; they’re easily edited with updates to logic and variables. Templates help devs write clear, readable, and maintainable tests quickly.
  4. Continuous Integration: Whether using mainframe or distributed CI tools, automation must be simple; effective automation accelerates delivery velocity from months or weeks to hours or even minutes. Test4z offers a convenient CLI that makes automation simple for developers. Swift and repeatable execution of tests via continuous integration provides developers with a rapid feedback loop.
  5. Independence: Keeping tests independent means the outcome of one test should not affect the outcome of another. In addition to native record/replay capabilities with automatic data capture, the Test4z CLI enables tests to be self-contained and run anywhere.
  6. Code Coverage: Devs and managers should align on an appropriate level of code coverage; visibility for both is critical to this alignment. Test4z offers native coverage visibility and nothing else needs to be installed.

To summarize, these 6 Core Principles serve as the basis for unit testing excellence:

How Test4z Supports the 6 Core Principles

Test4z Developer Experience

As well-designed as Test4z is, it wouldn’t be effective unless developers actually used it.

The father of the quality movement, Edwards Deming, described quality as ‘pride of workmanship’. So how can we enable developers, in this case, to take pride in their workmanship?

The answer is simple: make it easy for them, which is why Test4z delivers an unmatched developer experience that begins with their preferred development environment. Whether they use VS Code/Code4z or Eclipse or 3270 or another IDE, they will find Test4z to be an intuitive and “friction-free” experience; one with which they can showcase their workmanship.

Those who prefer VS Code/Code4z use the Unit Test for Mainframe extension, as illustrated in the video above.

Unit Test for Mainframe VS Code extension

Those who prefer Eclipse or other IDEs use the Test4z CLI.

Those who prefer ISPF connect to Test4z directly.

With Test4z, the tests are code, co-located with the application source. Test4z offers a pairing of an API portfolio, which serves as an abstraction layer to simplify test case authoring, and a Runtime that executes tests and captures code coverage. And tests can be run on any LPAR, including ZD&T, using Team Build, which is an integral part of the solution.

Test4z Overview

Included in Broadcom’s Mainframe DevOps Suite, Test4z is simple for devs to understand and use and there are no other tooling prerequisites.

So how does unit testing, powered by Test4z, fit into the bigger SDLC?

Project Sustainability

As a foundation, the benefits of unit testing done right propagate. Test4z unit tests can be reused for integration testing, regression testing, and other forms of functional testing in a CI/CD pipeline.

For VS Code users, unit testing is a seamless part of the Code4z experience and it’s equally rewarding for developers using Eclipse and ISPF.

Following this “golden path” ensures code quality, maintainability, and overall project success and the ultimate benefit is the long-term vitality and sustainability of your applications.

Unit Testing Done Right — Call to Action

The excitement around Test4z at this early stage is remarkable, especially from developers. It presents an opportunity for mainframe teams to finally fix the unit testing problem once and for all, and that’s driving an extraordinary level of enthusiasm:

I LOVE this project!!!” — European financial services provider

Finally, a tool for the mainframe that works like the distributed world” — North American financial services provider

This is AWESOME!!!” — Large US bank

Our Principal Director was amazed by the tool and its simplicity” — North American financial services provider

You’ve got the right product, vision & talent.” — Global commercial bank

No other solution like this exists.” — Large European bank

Unit testing done right creates a solid foundation for business change

Beyond tools, successful unit testing requires a culture that values thorough testing.

By institutionalizing unit testing best practices with Test4z (i.e., the 6 Core Principles), teams fortify their code base thereby elevating confidence in code changes and inspiring product owners to find even more creative ways to leverage mainframe assets.

Together, let’s make the mainframe a platform of YES! Begin your commitment to quality today.

Visit test4z.broadcom.com for more information and the documentation is available here.

Feel free to reach out to me petr.vacula(at)broadcom.com or your Mainframe Business Specialist.

--

--

Petr Vacula
Modern Mainframe

All mainframe, DevOps, automation and testing Product Manager