Interface test coverage rate statistical method
By building a formal model of interface communication protocol and configuring coverage statistics elements, the problem of failure to count special value point data and abnormal data in the existing technology is solved, and the refined statistics and accuracy of interface test coverage is achieved, and clear test supplementary work goals are provided.
Patent Information
- Application Number
- CN202411848842.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-05-02
AI Technical Summary
The existing interface test coverage statistical methods fail to include the test coverage of special value point data and abnormal data in the statistical scope of test coverage, resulting in the statistical interface test coverage that cannot reflect the real interface test coverage.
An interface test coverage statistics method is adopted. By building a formal model of the interface communication protocol, it supports configuring field attributes and coverage statistics, and automatically performs coverage analysis statistics, and outputs refined coverage statistics with fields as granularity.
It realizes a refined statistics on the coverage of interface tests, can display accurate test uncovered content, meets the interface test coverage acquisition requirements under different test requirements, and provides clear work goals to guide subsequent interface supplementary testing.
Smart Images

Figure CN119917405A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software evaluation, and in particular to an interface test coverage statistics method. The method is applicable to RS422, RS232, 1553B bus, CAN bus and other interfaces with universal protocol structures, and is particularly suitable for high-security interface testing with abnormal test coverage requirements and special value point test coverage requirements. Background Art
[0002] In view of the high reliability and high security requirements of equipment software, the focus of equipment software interface testing is the consistency of software interface implementation with communication protocol requirements and the completeness of software interface implementation. Therefore, interface testing should include two aspects: one is the consistency and correctness of software receiving and parsing normal data, and the other is the completeness of software receiving, identifying, and processing special value point data and abnormal data, so as to ensure the reliability and security of the software. The existing interface test coverage statistics methods do not include the test coverage of special value point data and abnormal data into the test coverage statistics, but only include the test coverage of normal data. This one-sided method of statistical interface test coverage obviously cannot reflect the actual interface test coverage. Summary of the invention
[0003] The purpose of the present invention is to provide an interface test coverage statistics method. The formal model can configure coverage statistics elements according to specific software requirements. Therefore, the verification assessment elements can be configured based on application layer requirements and security requirements (such as field abnormal data, out-of-range and out-limit data, and data with specific change requirements). This customized assessment element method can meet the interface test coverage collection requirements under different test requirements. The formal model of this method formalizes the communication protocol into a displayable and operable field format, and supports the configuration of field attributes. The interface templates defined by the formal model have the characteristics of versatility, reusability and flexible matching. After inputting data into the formal model, the model automatically performs coverage analysis and statistics, and outputs refined coverage statistics results with field granularity. The statistical results can show accurate test coverage content to guide subsequent possible supplementary testing work.
[0004] The technical solution of the present invention is: a method for statistically analyzing interface test coverage, and the specific steps are as follows:
[0005] Step 1: Construct a formal model of the interface communication protocol;
[0006] Establish a user-level general format model for common equipment embedded software interface types and conduct formal modeling. Use the formal model to display the general fields of the communication protocol and realize the displayable and editable functions for users.
[0007] Step 2: Customized configuration of communication protocol;
[0008] The formalized model supports the modification, addition and deletion functions of each field; the communication format in the formalized model is configured according to the communication protocol format requirements to complete the modeling of the communication protocol data model; the basic attributes and requirements of each field of the communication protocol configuration are analyzed, and the attributes of each field are configured into the communication protocol data model;
[0009] Step 3: Configure coverage statistics elements;
[0010] Based on the software application layer requirements and specific functional requirements, the frame header, frame count, data length, data content, frame tail, checksum, and coverage statistical elements of each field are configured. The coverage statistical elements include normal values, abnormal values, boundary values, and specific elements designed according to the protocol characteristics and the specific usage requirements of the software;
[0011] Step 4: Set the coverage statistics rules in the formal model;
[0012] For each field, design the rules to be included in the coverage statistics, including: including the normal value and abnormal value of the data frame header in the frame header field coverage statistics rules, designing the continuity verification of frame count and the coverage statistics rules for the rollback and reset verification when reaching the maximum value;
[0013] Step 5: Input the interface test data into the formal model;
[0014] Use the formal model to load all interface test data. The formal model interprets each interface test data in the protocol format and analyzes the test coverage of the test data through coverage statistical elements and rules.
[0015] Step 6: Formalize the model to output coverage statistics;
[0016] Through the input of step five, the formal model outputs coverage statistics in units of fields and lists the elements not covered by the interface test data.
[0017] Furthermore, the commonly used equipment embedded software interface types described in step one include RS422, RS232, 1553B bus, and CAN bus.
[0018] Furthermore, the basic attributes of each field in step 2 include name, field length, data type, data domain, data resolution and data calculation method.
[0019] The beneficial effects of the present invention are:
[0020] 1. The formal model can configure coverage statistical elements according to specific software requirements (such as field abnormal data, out-of-range and out-limit data, and data with specific change requirements). This customized assessment method can meet the interface test coverage collection needs under different testing requirements.
[0021] 2. After configuring the communication format and assessment elements into the formal model, the formal model can automatically perform coverage analysis and output statistical results. And its statistical results are refined analysis results with fields as the granularity. It provides a clear work goal for subsequent interface supplementary testing.
[0022] 3. The formal model of this method formalizes the communication protocol into a displayable and operable field format, which greatly satisfies the convenience of user operation. The formal model can be built with a variety of application layer general templates for interfaces, which is universal and reusable. The formal model provides field attribute configuration, which is flexible and easy to use. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a flow chart of the interface test coverage statistics method;
[0024] Figure 2 To construct a schematic diagram of the formal model of the interface communication protocol;
[0025] Figure 3 Customized configuration diagram for communication protocol;
[0026] Figure 4 This is an example of configuring the RS422 protocol coverage collection elements;
[0027] Figure 5 This is a schematic diagram for configuring coverage statistics rules;
[0028] Figure 6 Judge schematics for field coverage;
[0029] Figure 7 Schematic diagram for interface test coverage statistics. DETAILED DESCRIPTION
[0030] The present invention will be further described below in conjunction with the accompanying drawings.
[0031] like Figure 1 The 6-step application principle of the interface test coverage statistics method shown is as follows:
[0032] 1. Construct a formal model of the interface communication protocol (see Figure 2): Common interface types for equipment embedded software include RS422, RS232, 1553B bus, CAN bus, etc. (interface types can be expanded according to needs). Each communication interface has its own unique general format regulations. The general format model of various types of interfaces in the application layer is analyzed and extracted, and presented in the form of formal models to achieve user-displayable and editable functions. At the same time, the specification of interface templates can support the universality and reusability of formal models.
[0033] 2. Customized configuration of communication protocol (see Figure 3 ): The formal model supports the modification, addition, and deletion of each field. Configure the communication format in the formal model according to the communication protocol format requirements to complete the modeling of the communication protocol data model. Analyze the basic attributes of each field in the communication protocol configuration (name, field length, data type, data domain, data resolution, data calculation method) and its requirements, and configure the attributes of each field into the communication protocol data model.
[0034] 3. Configure coverage statistical elements: Configure the coverage statistical elements of each field such as frame header, frame count, data length, data content, frame tail, checksum, etc. based on the specific requirements of the software application layer and functional requirements. The coverage statistical elements generally include normal values, abnormal values, boundary values, and specific elements designed according to the characteristics of the protocol and the specific usage requirements of the software. Figure 4 Displays several coverage statistical elements of a RS422 protocol, among which the gray background part is a special element designed in combination with application requirements and software function requirements. Other methods for testing coverage statistics of interfaces do not use this part as a statistical element.
[0035] 4. Set the coverage statistics rules in the formal model: The formal model has a built-in common rule library. The statistical rules can be selected from the built-in rule library or customized in the formal model. The statistical rules are combined with the coverage collection elements to form the judgment coverage rules. The connection between the test data and the coverage collection elements is established through the judgment coverage rules. For each field, design the rules to be included in the coverage statistics, such as the normal value and abnormal value of the data frame header are included in the frame header field coverage statistics rules, and design the continuity verification of the frame count and the coverage statistics rules for the rollback and reset verification when the maximum value is reached.
[0036] 5. Input interface test data into the formal model: Use the formal model to load all interface test data. The formal model interprets the interface test data through the protocol model and automatically uses the coverage judgment rule to judge all test data of each field. If the judgment passes, the corresponding coverage collection element is marked as collected, that is, the element has been covered by the test data. The principle of field coverage judgment is shown in Figure 6 .
[0037] 6. Formal model outputs coverage statistics: Based on the above input, the formal model outputs coverage statistics in units of fields and lists the elements not covered by the interface test data. For details on the coverage statistics principle, see Figure 7 .
[0038] In the present embodiment, a method for statistical coverage of interface tests is used. The formal model can configure coverage statistical elements according to specific software requirements. Therefore, the verification and assessment elements can be configured based on application layer requirements and security requirements (such as field abnormal data, out-of-range and out-limit data, and data with specific change requirements). This customized assessment element method can meet the interface test coverage collection requirements under different testing requirements. The formal model of this method formalizes the communication protocol into a displayable and operable field format, and supports the configuration of field attributes. Each interface template defined by the formal model has the characteristics of versatility, reusability and flexible matching. After inputting data into the formal model, the model automatically performs coverage analysis and statistics, and outputs refined coverage statistical results with field granularity. The statistical results can show accurate test coverage content to guide subsequent possible supplementary testing work.
[0039] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for statistically analyzing interface test coverage, characterized in that: The specific steps are as follows: Step 1: Construct a formal model of the interface communication protocol; Establish a user-level general format model for common equipment embedded software interface types and conduct formal modeling. Use the formal model to display the general fields of the communication protocol and realize the displayable and editable functions for users. Step 2: Customized configuration of communication protocol; The formalized model supports the modification, addition and deletion functions of each field; the communication format in the formalized model is configured according to the communication protocol format requirements to complete the modeling of the communication protocol data model; the basic attributes and requirements of each field of the communication protocol configuration are analyzed, and the attributes of each field are configured into the communication protocol data model; Step 3: Configure coverage statistics elements; Based on the software application layer requirements and specific functional requirements, the frame header, frame count, data length, data content, frame tail, checksum, and coverage statistical elements of each field are configured. The coverage statistical elements include normal values, abnormal values, boundary values, and specific elements designed according to the protocol characteristics and the specific usage requirements of the software; Step 4: Set the coverage statistics rules in the formal model; For each field, design the rules to be included in the coverage statistics, including: including the normal value and abnormal value of the data frame header in the frame header field coverage statistics rules, designing the continuity verification of frame count and the coverage statistics rules for the rollback and reset verification when reaching the maximum value; Step 5: Input the interface test data into the formal model; Use the formal model to load all interface test data. The formal model interprets each interface test data in the protocol format and analyzes the test coverage of the test data through coverage statistical elements and rules. Step 6: Formalize the model to output coverage statistics; Through the input of step five, the formal model outputs coverage statistics in units of fields and lists the elements not covered by the interface test data.
2. The interface test coverage statistics method according to claim 1, characterized in that: The commonly used equipment embedded software interface types described in step 1 include RS422, RS232, 1553B bus, and CAN bus.
3. The interface test coverage statistics method according to claim 1, characterized in that: The basic attributes of each field described in step 2 include name, field length, data type, data domain, data resolution and data calculation method.