A Test Case Generation Method Based on a System Digital Model

By using a test case generation method based on a system digital model, conditional statements are automatically identified and a minimum set of test cases is generated, solving the problem of long test time in MC/DC testing and achieving efficient test coverage and resource saving.

CN117033182BActive Publication Date: 2025-10-28LEIHUA ELECTRONICS TECH RES INST AVIATION IND OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310888630.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-19
Publication Date
2025-10-28
Estimated Expiration
2043-07-19

AI Technical Summary

Technical Problem

In existing technologies, MC/DC test case generation is time-consuming, incurs high costs in terms of manpower, material resources, and financial resources, and has low test coverage.

Method used

Based on the system's digital model, the system automatically identifies the conditional statements at conditional branches, generates a minimal test case set using MC/DC rules, and automatically generates test case files through a template library, supporting the generation of test case files in Python.

Benefits of technology

It effectively reduces the number of test cases, ensures 100% condition branch coverage, improves testing efficiency and coverage, and reduces the consumption of human, material, and financial resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117033182B_ABST
    Figure CN117033182B_ABST
Patent Text Reader

Abstract

A test case generation method based on a system digital model includes: Step 1, importing the system's digital model; Step 2, automatically identifying the conditional statements at each conditional branch of the digital model; Step 3, comparing the conditional statements with expression templates in a module library to determine if an expression template exists; if so, proceed to Step 4; otherwise, proceed to Step 5; Step 4, generating the system's minimum test case set based on the MC / DC minimum test case set in the template library, proceeding to Step 7; Step 5, generating a blank test case set; Step 6, designing test cases on the blank test case set starting from the first conditional statement, until the test case design for the last condition is completed, proceeding to Step 7; Step 7, binding the conditional statements to variables and matching test keywords with variables; Step 8, generating a test case file by calling keywords according to the assignment table in the minimum test case set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of system testing technology, specifically relating to a method for generating test cases based on a system digital model. Background Technology

[0002] With the widespread application of model-based systems engineering processes in the development of complex avionics systems, model-based development technologies and tools have played a significant role in system development.

[0003] Compared to traditional document-based system development, model-based systems engineering offers significant advantages in communicating system requirements and enables rapid system verification. Furthermore, because it digitizes the system, making it a testable and verifiable digital model, it greatly mitigates the impact of human factors on insufficient system verification, thereby enhancing the reliability and consistency of system verification.

[0004] Traditional system test cases are often designed using the white-box method, also known as the structured method or logic coverage method. Its basic idea is to treat the system's digital model as a collection of program paths. In this way, testing the system becomes testing certain paths in the program, trying to ensure that "everywhere" in the program is executed, so that errors lurking in every corner of the program have a chance to be exposed. Therefore, the white-box method is actually an analysis method that selects input data through a specified path.

[0005] White-box testing allows for statement coverage, decision coverage, condition coverage, decision-condition coverage, multiple condition coverage, path coverage, and basic path coverage. Test coverage rate can be used as a quantitative measure of test thoroughness in white-box testing. C / DC and MC / DC are two important rules for logical coverage in white-box testing.

[0006] C / DC stands for Condition / Decision Coverage. This rule combines the requirements of decision coverage and condition coverage. It requires enough test cases to switch the decision result between true and false, as well as to switch each condition value between true and false.

[0007] MC / DC stands for Modified Condition / Decision Coverage. It requires that each input and exit point in the program be called at least once, each condition has taken at least all possible results, and each condition in a decision is shown to independently affect the decision result by changing the condition while keeping it fixed.

[0008] Currently, C / DC and MC / DC rules are widely used in system testing. Among them, MC / DC has a higher accuracy rate in testing errors. However, since MC / DC has stricter requirements for finding test cases than C / DC, it takes more time to find test cases in order to ensure test coverage. As a result, the triple expenses of human, material and financial resources will increase directly, which is very costly and has a long cycle.

[0009] This application is made in view of the aforementioned technical deficiencies.

[0010] It should be noted that the above background information is only used to assist in understanding the inventive concept and technical solution of this application, and it does not necessarily belong to the prior art of this patent application. In the absence of clear evidence that the above information was disclosed on the filing date of this application, the above background information should not be used to evaluate the novelty and inventiveness of this application. Summary of the Invention

[0011] The purpose of this application is to provide a test case generation method based on a system digital model to overcome or mitigate at least one of the known technical defects.

[0012] The technical solution of this application is:

[0013] A method for generating test cases based on a system digital model, comprising:

[0014] Step 1: Import the system's digital model;

[0015] Step 2: Automatically identify the conditional statements and conditions at each conditional branch of the digital model, and construct a list of conditional statements;

[0016] Step 3: Compare the conditional expression with the expression template in the module library to determine if an expression template exists. If yes, proceed to Step 4; otherwise, proceed to Step 5.

[0017] Step 4: Based on the MC / DC minimum test case set in the template library, generate the minimum test case set for the system, and proceed to Step 7;

[0018] Step 5: Generate a blank test case set;

[0019] Step Six: Starting from the first condition, design test cases on the blank test case set based on the MC / DC rule until the test cases for the last condition are designed, then proceed to Step Seven.

[0020] Step 7: Bind the judgment conditions to project variables or ICD variables, and match the test keywords with the variables;

[0021] Step 8: Based on the assignment table in the minimum test case set, use keywords to generate test case files.

[0022] According to at least one embodiment of this application, in the above-described test case generation method based on a system digital model, step one, importing the system's digital model, specifically involves:

[0023] Design the human-computer interface and import the system's functional model, including the functional model activity diagram.

[0024] According to at least one embodiment of this application, in the above-described test case generation method based on a system digital model, in step six, starting from the first judgment condition, test cases are designed on a blank test case set based on the MC / DC rule until the design of the test case for the last judgment condition is completed, and a prompt wizard indicates completion.

[0025] According to at least one embodiment of this application, in the above-described test case generation method based on a system digital model, step eight involves calling keywords to generate a test case file based on an assignment table in the minimum test case set, specifically generating a test case file based on the Python language. Attached Figure Description

[0026] Figure 1 This is a schematic diagram of the test case generation method based on the system digital model provided in the embodiments of this application. Detailed Implementation

[0027] To make the technical solution and its advantages of the present application clearer, the technical solution of the present application will be described in further detail below in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only some embodiments of the present application and are only used to explain the present application, not to limit the present application. It should be noted that, for ease of description, only the parts related to the present application are shown in the accompanying drawings, and other related parts can refer to the general design. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other to obtain new embodiments.

[0028] In addition, unless otherwise defined, the technical or scientific terms used in the description of this application should have the ordinary meanings understood by those of ordinary skill in the art to which this application belongs. The words "upper," "lower," "left," "right," "center," "vertical," "horizontal," "inner," and "outer" used in the description of this application are only used to indicate relative directions or positional relationships, and do not imply that the device or component must have a specific orientation, be constructed, or operate in a specific orientation. When the absolute position of the described object changes, its relative positional relationship may also change accordingly. Therefore, they should not be understood as limitations on this application. The words "first," "second," "third," and similar terms used in the description of this application are used only for descriptive purposes to distinguish different components and should not be understood to indicate or imply relative importance. The words "one," "an," or "the" used in the description of this application should not be understood as absolute limitations on quantity, but should be understood as meaning the presence of at least one. The words "include" or "comprises" used in the description of this application mean that the element or object listed before the word includes the elements or objects listed after the word and their equivalents, but does not exclude other elements or objects.

[0029] In addition, it should be noted that, unless otherwise clearly stipulated and limited, the words "install", "connect", "connect" and similar terms used in the description of this application should be understood in a broad sense. For example, the connection can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, an indirect connection through an intermediate medium, or a connection between two components. Technical personnel in the field can understand their specific meanings in this application according to the specific circumstances.

[0030] The following is in conjunction with the appendix Figure 1 This application will be described in further detail.

[0031] A test case generation method based on a system digital model, such as Figure 1 As shown, it includes the following steps.

[0032] Step 1: Import the digital model of the system, which can be used to design the human-computer interface; import the functional model of the system, which can mainly be the functional model activity diagram.

[0033] Step 2: Automatically identify the conditional statements and conditions at each conditional branch of the digital model, and construct a list of conditional statements;

[0034] Step 3: Compare the conditional expression with the expression template in the module library to determine if an expression template exists. If yes, proceed to Step 4; otherwise, proceed to Step 5.

[0035] Step 4: Based on the MC / DC minimum test case set in the template library, generate the minimum test case set for the system, and proceed to Step 7;

[0036] Step 5: Generate a blank test case set;

[0037] Step Six: Starting from the first condition, design test cases on the blank test case set based on the MC / DC rule until the test cases for the last condition are designed. Proceed to Step Seven, which can be completed by the tester according to the prompts.

[0038] Step 7: Bind the judgment conditions to project variables or ICD variables, and match the test keywords with the variables;

[0039] Step 8: Based on the assignment table in the minimum test case set, use keywords to generate test case files based on the Python language.

[0040] The test case generation method based on the system digital model provided in this application mainly relies on the system's digital model to identify the conditional statements at each conditional branch, and designs and generates test cases based on MC / DC rules. This can effectively reduce the number of test cases and ensure 100% coverage of conditional branches.

[0041] The test case generation method based on the system digital model provided in this application automatically matches the expression templates in the module library by identifying each conditional judgment in the digital model, automatically generates a test case set that meets the MC / DC rules, and can also generate a blank test case set for testers to fill in the test cases themselves. Finally, it automatically matches the condition variables and generates a Python test case file.

[0042] The test case generation method based on the system digital model provided in this application can design a corresponding system including two modules: a human-computer interface and an MC / DC test case set template library, with the following functions:

[0043] a) Supports importing the system's digital models from the user's existing model management platform;

[0044] b) Supports obtaining version information of the system's digital model and automatically associating it with the version of the generated minimum use case set;

[0045] c) Supports the recognition of branch condition expression and branch condition;

[0046] d) Provide an MC / DC template library and compare the recognized expressions with the expression templates in the library;

[0047] e) When the conditional expression of the system's digital model matches an expression in the template library, a minimum set of test cases is automatically generated;

[0048] f) Supports the generation of blank test case sets and prompts testers to manually complete the design of test case sets through the MC / DC wizard;

[0049] g) Based on the minimum test case set, provide testers with an interface to associate judgment conditions with engineering variables or ICD variables, and realize the instantiation of judgment conditions;

[0050] h) Supports automatic generation of Python test case files based on a minimal test case set and by calling keywords;

[0051] i) Supports test case files being referenced by complete system test cases.

[0052] The test case generation method based on the system digital model provided in this application can generate relevant test cases based on the ICD model and the system functional model, as detailed below:

[0053] a) It has an interface for data communication with ICD management tools, which can read the data information of device, bus, message, and signal parameters designed in the ICD management tools required to generate interface test cases, including: name, specification number, identifier, transmission target, transmission source, communication format, transmission cycle, length, delay, parameter bits, parameter values, etc. After obtaining complete ICD design data, it can parse the data and generate the interface test cases required in the test scenario. During the process of generating test cases, it can also create test versions, test case sets, creators, creation time, modifiers, modification time, testers, etc., based on the test project content, thereby realizing the management of interface test case data.

[0054] b) After obtaining complete system functional model sequence diagram data and ICD data, the data can be parsed and functional test cases required in the test scenario can be generated. It can support the generation of at least five functional test cases. The functional test cases are only for test cases generated from system functional model data. Based on the system functional model modeling specifications, behavioral logic models such as system use case diagrams, functional activity diagrams, and sequence diagrams are generated. One of the many completion paths of a system test case is taken as a scenario test case to verify its logical function.

[0055] c) Based on the minimum test case set design method of MC / DC rules, it provides a test case set template library and parses the branch accompanying statements of the system functional model to automatically match the minimum test case set, thereby realizing the generation of test cases;

[0056] This application introduces model-based verification technology, which can automatically generate test cases through digital models such as system interfaces (based on ICD models) and behaviors (based on system functional models), and drive the testing platform to perform relevant testing and verification work on digital or real systems, calculate coverage, and generate test reports.

[0057] The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0058] The technical solution of this application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. Those skilled in the art should understand that the scope of protection of this application is obviously not limited to these specific embodiments. Without departing from the principles of this application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of this application.

Claims

1. A method for generating test cases based on a system digital model, characterized in that, include: Step 1: Import the system's digital model; Step 2: Automatically identify the conditional statements and conditions at each conditional branch of the digital model, and construct a list of conditional statements; Step 3: Compare the conditional statement with the expression template in the module library to determine if an expression template exists. If yes, proceed to Step 4; otherwise, proceed to Step 5. Step 4: Based on the MC / DC minimum test case set in the template library, generate the minimum test case set for the system, and proceed to Step 7; Step 5: Generate a blank test case set; Step Six: Starting from the first condition, design test cases on the blank test case set based on the MC / DC rule until the test cases for the last condition are designed, then proceed to Step Seven. Step 7: Bind the judgment conditions to project variables or ICD variables, and match the test keywords with the variables; Step 8: Based on the assignment table in the minimum test case set, use keywords to generate test case files.

2. The test case generation method based on a system digital model according to claim 1, characterized in that, In step one, the digital model of the system is imported, specifically as follows: Design the human-computer interface and import the system's functional model, including the functional model activity diagram.

3. The test case generation method based on a system digital model according to claim 1, characterized in that, In step six, starting from the first condition, test cases are designed on a blank test case set based on the MC / DC rule until the test case design for the last condition is completed, and the wizard prompts the completion.

4. The test case generation method based on a system digital model according to claim 1, characterized in that, In step eight, based on the assignment table in the minimum test case set, the keyword is called to generate the test case file, specifically a test case file based on the Python language.

Citation Information

Patent Citations

  • Aircraft guidance control simulation test method and device

    CN111123889A

  • Modeling design method of digital screen cabinet for production test and matched test generation method

    CN114036733A