Automated COBOL Unit Test Generation via Code Segmentation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

COBOL source code often contains 'spaghetti code' where functional modules are mixed, making it difficult to identify and test individual code units, leading to complex and resource-intensive system-level testing.

Innovation Solution

Automatically extracting and generating unit tests for COBOL code units by analyzing the source code to identify functional modules, creating mock code segments to simulate interactions, and injecting stimulus input to test each unit independently.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If system-level testing is performed on complete COBOL software packages, then overall functionality can be validated, but testing complexity and resource requirements increase significantly

Engineering Contradiction:
Improveoverall functionality validationVSAvoidtesting complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent applies segmentation by automatically dividing COBOL source code into distinct code units based on functional modules. The system analyzes COBOL code structure to identify boundaries between modules and extracts individual testable units, transforming a monolithic testing approach into a modular unit-testing approach. This reduces testing complexity while maintaining validation effectiveness.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an automated code analysis system as an intermediary between the COBOL source code and the testing process. This intermediary automatically parses COBOL code, identifies functional modules, generates code units, and creates corresponding tests, eliminating the need for manual testing planning and reducing resource requirements.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of operation

If manual identification of code units is performed in COBOL source code, then functional modules can be tested independently, but time and personnel resources increase

Engineering Contradiction:
Improveindependent unit testingVSAvoidtesting preparation time
Core Design Contradiction:
Ease of operationVSLoss of time

Solution Approach 1:

The patent implements self-service by enabling the COBOL code to effectively test itself through automated analysis. The system automatically parses COBOL source code, identifies functional modules based on code structure and conventions, extracts code units, and generates corresponding tests without requiring manual intervention. This self-organizing capability dramatically reduces time and personnel resources while enabling independent unit testing.

Inventive Principle:
Principle #25Self-service

3Measurement precision

If COBOL source code is analyzed to extract code units, then testing granularity is improved, but analysis processing time increases

Engineering Contradiction:
Improvecode unit identification precisionVSAvoidcode analysis time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent applies parameter changes by optimizing the code analysis process to balance precision and speed. The system uses COBOL-specific parsing rules and heuristics to quickly identify functional module boundaries with high precision. By tailoring the analysis parameters to COBOL's structured syntax and conventions, the system achieves accurate code unit extraction without excessive processing time.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS9983983B2Auto-generation of testable units for COBOL code
Publication Date: 2018.05.29 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US9983983B2 patent drawing
  • US9983983B2 patent drawing
  • US9983983B2 patent drawing

AI summary

A computer implemented method of automatically generating tests for COBOL code units, comprises using at least one hardware processor adapted to designate a COBOL source code comprising a plurality of code lines, extract automatically a plurality of code units each comprising a subset of the code lines for executing one or more functionalities of the COBOL source code, the code units are identified by analyzing the plurality of code lines, generate automatically one or more tests for testing each of the code units by generating an input stimulus for each of the code units, and create one or more mock code segments to simulate interaction of each code unit with one or more external code segment comprising code lines not included in the code unit and testing each code unit using the one or more test(s).