We are incredibly excited to announce that IBM Z Open Unit Test V1 is generally available. Our team has been working with Sponsor Users from all over the globe, making sure this tool meets their development needs. Our core values shine through with Z Open Unit Test: developer empowerment, accelerating releases, and embracing DevOps practices.
IBM Z Open Unit Test (or ZUnit for short) is an automated unit testing tool for batch and CICS COBOL programs. This tool provides essential capabilities such as CICS stubbing, automated data capture/recording, and ability to store test cases in any standard SCM. If you are an IBM Developer for z Systems (IDz) customer, you already have ZUnit, and IDz 14.1.6 is in sync with the capabilities in Z Open Unit Test.
But before we dive into those specific features, we’re going to take a step back. First, we’ll go over what exactly we mean by “unit testing,” what we define as a “unit” for z/OS applications, and how unit testing fits into your DevOps pipeline.
What do we mean by “unit testing?”
Traditionally, unit testing is a way of testing the smallest piece of code or application that can be logically isolated. For z/OS applications, we define a “unit” at the program level. This program-under-test is isolated from other interfaces, and we can simulate external behavior using stubs. For those not familiar, a stub is an object that holds predetermined data, which is provided in response to calls made during execution of a program. Stubs are incredibly useful when you’re not able to (or don’t want to) involve objects that answer with real data.
Where does unit testing fit into an overall DevOps pipeline?
Below, you’ll see a graphic that shows the various stages within a DevOps pipeline. To effectively practice continuous integration (CI), developers need to build and unit test their code after each change. ZUnit allows developers to do their unit testing within the “Build” phase, meaning you don’t have to deploy to perform unit testing. Thanks to stubbing capabilities, you can achieve environment isolation since you don’t need to deploy to CICS. This will greatly help teams truly “shift-left,” and get their testing done earlier on.
What does ZUnit let me do, and how?
You simply need to open the program you want to test, right-click, and select the ZUnit tool. Because ZUnit is wizard-driven you don’t need to learn a new testing language, or write within a new framework.
ZUnit then parses your program, and opens the test case editor. In the editor, you can see the input/output interfaces for your program, as well as the copybook structure associated with each interface. You can then provide the input and expected output data.
But as you can imagine, many legacy applications are large and complex. It’s difficult to truly understand all the types of data going in and out, especially for newcomers – this is where automated data capture comes in.
With the automated data capture capability, you can record data for a program from a live-run. You’ll need to press the “record” button and then run your program – this can be done from CICS or even from an API invocation. You can then import this data, which will pre-populate the test case editor with your input/output data. That way, you can easily see the types of data that flow in and out of your program, and better understand your application as a whole. You can also modify this recorded data as need be – such as changing fields for negative testing.
You can see all the above features in action in this demo:
Full ZUnit feature list
• Automated Unit Testing for COBOL and Batch PL/I programs
• Generated test cases in COBOL or PL/I programs, which can be stored in any SCM along with the programs they test
• Test case generation for COBOL CICS programs with stubbing
• Data recording and playback capabilities for Batch and CICS COBOL programs
• Ability to invoke test cases from the IDE or as part of a CI/CD pipeline
• Verification of VSAM and Sequential files
• Stubbing of VSAM and Sequential files
• Creation of file stubs by importing from notepad or spreadsheet or from an existing sequential file
• Assertions and automated Pass/Fail checking
• Support for Negative Testing
• Ability to export of test results in JUnit and SonarQube format
• Debug support of the program under test as well as the testcase
• Code coverage for validating changes are covered by tests
• Ability to export code coverage results to IBM Application Discovery and Delivery Intelligence
• Data recording capability for Batch and CICS COBOL programs, helping to get started with an initial set of data for testing a single program
Where can I get ZUnit?
If you own IBM Developer for z Systems (or IDz), you already have ZUnit. All the capabilities I’ve mentioned are available within IDz 14.1.6. You can also purchase IBM Z Open Unit Test (ZUnit) alongside IBM Z Open Development, which most notably provides Rocket Git and DBB. Together, Z Open Unit Test and Z Open Development create a powerful testing and development environment. Currently, ZUnit requires either IDz or Z Open Development to work.
You can try a free trial of IBM Z Open Development and ZUnit here.
If you’d like to know more about our roadmap, and talk about your unit testing needs, you can reach out to Korinne Alpers (Korinne.Alpers@ibm.com).
Our dedication to modern tooling is nothing new. We’ve been hard at work delivering tools that align z/OS application development with modern practices, regardless of the platform. You can see this with many of our deliveries, including:
• IBM Z Open Development, which most notably makes Git usage a reality on Z.
• IBM Wazi, a web-based IDE with essential integrations (such as z/OS Debugger and IBM DBB) as well as a Visual Studio Code extenision.
• IBM Developer for z Systems, a comprehensive Eclipse-based workbench for creating and maintaining z/OS applications.