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.
â€˘ Webinar: Your CI/CD Pipeline Needs Automated Unit Tests
â€˘ Z DevOps User Group Meeting 2019