Mainframe Path Start learning free
Applied8 min readLesson 4 of 5

Automated testing on z/OS

A pipeline is only as safe as its tests. On the mainframe that means unit tests for individual COBOL programs, integration tests against test copies of DB2, CICS and files, and regression checks that compare today's output with a known-good run.

Three layers of tests

The test pyramid, mainframe edition
Regressioncompare batch output with a known-good run
Integrationreal DB2, CICS and datasets in a test region
Unitone program or paragraph, inputs stubbed

Test data is the hard part

Production data cannot simply be copied into test: it contains personal and financial details. Teams build small, synthetic data sets, or use masking tools that replace real names and account numbers while keeping the formats valid.

Where tests run

Some teams run tests on a dedicated test LPAR; others use emulated z/OS environments for developers and early stages, keeping the shared test LPAR for integration. Either way, each pipeline run should start from a known state, so results are repeatable.

StageTypical checkFails when
BuildCompile and linkRC 8 or higher
Unit testzUnit or similarAny assertion fails
IntegrationRun against test DB2/CICSAbend, wrong SQLCODE, wrong output
RegressionCompare batch outputUnexpected differences

Common mistakes

Only testing the happy path

Most production failures come from bad input: spaces in numeric fields, empty files, duplicate keys. Write tests for those first.

Shared, changing test data

If another team rewrites the test database, your tests fail randomly. Load a known data set at the start of each run.

Copying production data unmasked

This breaks privacy rules in most countries. Use synthetic or masked data.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← Building COBOL in a pipelineDeploying safely to production →