Automated Test Generation for Model-Based Code Coverage

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current coverage analysis techniques for programming code and executable models often fail to ensure comprehensive testing, as they lack automated methods to verify user-defined coverage criteria, leading to incomplete or inconsistent test cases.

Innovation Solution

An automated test generation system that translates graphical models into executable code, instruments the code to collect coverage data, and iteratively generates and improves test cases to meet user-defined structural and functional coverage criteria, ensuring all possible outcomes are tested.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If automated test generation is implemented, then code coverage completeness is improved, but system complexity increases

Engineering Contradiction:
Improvecode coverage completenessVSAvoidsystem complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent introduces an intermediate representation (IR) as a mediator between the source code and the test generation process. The IR serves as a simplified, structured form that captures essential program semantics while being easier to analyze systematically. This intermediary layer enables automated test case generation by providing a standardized format for identifying coverage criteria and generating corresponding test cases, thereby improving code coverage without directly complicating the overall system architecture.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent replaces manual test case creation and coverage analysis with automated computational processes. Instead of relying on manual inspection and ad-hoc testing methods, the system uses algorithmic analysis of the intermediate representation to automatically generate test cases that satisfy specified coverage criteria. This substitution of mechanical/manual processes with automated systems improves coverage completeness while the modular automation framework actually reduces long-term system complexity.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Reliability

If comprehensive coverage criteria are enforced, then testing thoroughness is improved, but test generation time increases

Engineering Contradiction:
Improvetesting thoroughnessVSAvoidtest generation time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent implements a flexible coverage criteria system that allows users to specify partial coverage requirements rather than demanding complete coverage of all possible code paths. The system can enforce specific coverage criteria (such as statement coverage, branch coverage, or custom criteria) selectively based on project needs. This partial enforcement approach ensures testing thoroughness for critical areas while avoiding the excessive time consumption that would result from attempting to achieve exhaustive coverage of entire codebases.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The patent divides the codebase into manageable segments through the intermediate representation, which organizes code into structured units with clear semantics. This segmentation allows the test generation process to focus on specific code regions and coverage criteria independently. By breaking down the overall testing task into smaller, manageable segments with their own coverage requirements, the system achieves comprehensive testing thoroughness without the prohibitive time cost of treating the entire codebase as a single monolithic unit.

Inventive Principle:
Principle #1Segmentation

3Adaptability or versatility

If manual test case creation is used, then flexibility in test design is maintained, but coverage consistency deteriorates

Engineering Contradiction:
Improvetest design flexibilityVSAvoidcoverage consistency
Core Design Contradiction:
Adaptability or versatilityVSStability of the object's composition

Solution Approach 1:

The patent performs preliminary analysis of the source code to generate an intermediate representation that captures all relevant program semantics, control flow, and data dependencies before test cases are created. This preliminary structuring of code information establishes a consistent foundation that ensures uniform coverage analysis across all test cases. By preparing this comprehensive intermediate representation in advance, the system maintains coverage consistency while still allowing flexible test design, as the structured IR can be queried and analyzed in multiple ways to generate different test scenarios.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS9665350B1Automatic test generation for model-based code coverage
Publication Date: 2017.05.30 MATHWORKS INC
  • US9665350B1 patent drawing
  • US9665350B1 patent drawing
  • US9665350B1 patent drawing

AI summary

A computer-implemented method includes obtaining a first representation of a system, obtaining a set of test obligations, and automatically generating one or more test cases from the first representation based on the set of test obligations. The method further includes obtaining a second representation that is related to the first representation, obtaining an analysis criterion for the second representation, and assessing the analysis criterion using the one or more test cases applied to the second representation. Based on the assessing, one or more additional test obligations may be identified and a second set of one or more test cases may be generated based on the one or more additional test obligations.