An automated testing method based on model interface
By extracting and comparing model interface information, the interface comparison test report is generated, and the problem of low degree of automation of traditional model interface testing is solved, and test efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202011513539.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-18
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2040-12-18
AI Technical Summary
Traditional model interface testing requires manual comparison, low degree of automation, low efficiency, time-consuming and labor-intensive, and it is difficult to effectively count, check and analyze interface test data.
By extracting model interface information from the test model, a model interface information table is generated, and compared with the interface information table in the software detailed design document, and a text comparison algorithm is used to generate an interface comparison test report to achieve automated testing.
Improve test efficiency, reduce artificial errors, save time and cost, and ensure the accuracy and interface quality of the detection.
Smart Images

Figure CN114647567B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of software interface testing, and in particular relates to an automatic testing method based on a model interface. Background Art
[0002] Due to the rapid development of embedded systems, the complexity of embedded software is increasing, the types of interfaces are increasing, the requirements change frequently during iterative development, and the parameters of interface signals change with the application scenarios. Traditional model interface testing requires testers to compare interface information one by one according to the test model and software detailed design documents. It has low automation, low inspection efficiency, and consumes a lot of time and energy. There are irregular operations in the testing process, and it is impossible to effectively count, inspect and analyze interface test data. The model interface is a bridge for the tested software to interact with external devices and environments. It is a key component for the system to reflect functions and performance externally. How to ensure the quality of the interface in the model is related to the normal release of the entire software. Summary of the invention
[0003] Based on the above defects, the present invention provides an automated testing method based on a model interface, which effectively solves the problems of low automation, low inspection efficiency and large amount of time and energy consumed when manually testing the model interface in the prior art.
[0004] The present invention is achieved through the following technical solutions:
[0005] An automated testing method based on a model interface, comprising:
[0006] Step 1: extract model interface information from the test model and store the model interface information in a model interface information table;
[0007] Step 2: According to the preset test verification items and test rules, at least one test case is assigned to each model interface in the model interface information table to detect the correctness of the model interface information;
[0008] Step 3: Execute all test cases generated in the model interface information table and output the first test report;
[0009] Step 4: extracting document interface information from the software detailed design document, and storing the document interface information in a document interface information table; wherein the parameter fields in the document interface information table and the model interface information table are consistent;
[0010] Step 5: According to the test verification items and test rules preset in step 3, at least one test case is assigned to each document interface in the document interface information table to detect the correctness of the document interface information;
[0011] Step 6: Execute all test cases generated in the document interface information table and output the second test report;
[0012] Step 7: Use the text comparison algorithm to compare the same parameter field signal in the model interface information table with that in the document interface information table, and generate a compared interface comparison test report.
[0013] Furthermore, the model interface information includes: model interface name, model interface data type, model interface data sampling time, model interface data minimum value and model interface data maximum value.
[0014] Preferably, the test verification items include: the interface name can only contain letters, numbers, and underscores, the interface name cannot exceed 31 characters, the first character of the interface name cannot have spaces, underscores, and carriage returns, interface data type and data range verification, and interface data sampling time and model running time verification.
[0015] Preferably, the test rules include: equivalence class partitioning method and boundary value analysis method, and the test rules complete the normal check of the default value of fixed value data, the traversal check of enumeration data and the data range type check item by item, and the data range type check includes the upper and lower boundary value check of the boundary range data.
[0016] Preferably, the interface comparison test report includes a report in a digital form, a report in a graphical form, or a report in a digital and graphical form.
[0017] Compared with the prior art, the present invention has the following beneficial technical effects:
[0018] The present invention solves the problem of low work efficiency and easy error caused by the need to manually compare model interface information one by one in traditional technology. Compared with the existing technology, the present invention extracts model interface information in the test model and document interface data information in the software detailed design document, that is, the target data information of the software design, and generates corresponding information tables, which are then compared one by one through a text comparison algorithm, and finally an interface comparison test report is generated, thereby realizing batch automatic comparison, saving labor costs, ensuring the accuracy of detection, and improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 This is a schematic diagram of the model interface automation test process of the present invention;
[0021] Figure 2 This is a schematic diagram of the structure of the model interface automation test system of the present invention;
[0022] Figure 3 This is a schematic diagram of the interface test inspection items of the present invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0024] Figure 1 A schematic diagram of a model interface automated testing process provided by an embodiment of the present invention; Figure 1 As shown, the method includes:
[0025] Step 1 S1: import the model, extract the corresponding interface information from the model, the interface information at least includes the interface name, interface data type, interface data sampling time, interface data minimum value, interface data maximum value, and store the interface information in the model interface information table;
[0026] Step 2 S2: Testers can use equivalence class partitioning and boundary value analysis methods to generate corresponding test cases according to preset test rules to verify the correctness of the interface information in the model;
[0027] Step 3 S3: according to the preset test verification items, wherein the test verification items include: the interface name can only contain letters, numbers, and underscores, the interface name cannot exceed 31 characters, the first character of the interface name cannot have spaces, underscores, and carriage returns, interface data type and data range verification, interface data sampling time and model running time verification; output model interface information table test report;
[0028] Step 4 S4: extracting a document interface information table from the software detailed design document, wherein the interface information is consistent with the interface parameters in the model interface information table;
[0029] Step 5 S5: According to the test verification items in step 3, at least one test case is assigned to each parameter in the document interface information table to verify the correctness of the interface information in the document;
[0030] Step 6 S6: Generate a test report of the document interface information table;
[0031] Step 7 S7: Use a text comparison algorithm to compare the parameters of the same signal field in the model interface information table and the document interface information table to generate an interface test comparison report.
[0032] The above method can be further optimized as follows:
[0033] The equivalence class division described in step 2 S2 is to divide all interface information into two categories: valid equivalence class and invalid equivalence class; boundary value analysis can be divided into three categories: upper boundary value, lower boundary value, and boundary value; in practice, for different test items, the tester selects representative test cases to complete the interface test work with the least test case set and test time;
[0034] The test case execution results must generate a summary interface test report for easy viewing by testers. Specifically, the interface test report can be displayed in a digital manner or in a graphical manner such as a pie chart or histogram, so that testers and designers can understand the test results more intuitively and quickly.
[0035] The technical solution of the present invention is specifically described below with examples.
[0036] This example is based on the existing vehicle model and the corresponding software detailed design. The interface test is performed according to the following steps:
[0037] Step 1: The tester imports the object to be tested, i.e. the control model, into the system through the GUI human-computer interaction interface.
[0038] Step 2: Extract the interface information of the model, including interface name, interface data type, interface data sampling time, interface data minimum value, interface data maximum value, and store the interface information in the model interface information table.
[0039] Step 3: Testers use equivalence class partitioning and boundary value analysis methods to verify that the interface names in the model interface information table can only contain letters, numbers, and underscores, that the interface names cannot exceed 31 characters, that the first character of the interface name cannot have spaces, underscores, or carriage returns, that the interface data type is consistent with the data range, and that the interface data sampling time is consistent with the model running time. At least one test case is generated for each test item.
[0040] The test case allocation example is as follows:
[0041] Test case 1: The valid equivalence class is that the input signal contains normal characters;
[0042] Test case 2: Invalid equivalence class is when the input signal contains illegal characters;
[0043] Test case 3: Valid equivalence class and lower boundary input interface signal name is 30 characters;
[0044] Test case 4: Valid equivalence class and boundary value input interface signal name is 31 characters;
[0045] Test case 5: Invalid equivalence class and upper boundary input interface signal name is 32 characters.
[0046] Assume that the VPF_st input interface signal is checked:
[0047] Verification Item 1: The VPF_st signal name field can only contain letters, numbers, and underscores;
[0048] Check item 2: The first character of the VPF_st signal name field cannot be a number or an underscore;
[0049] Check Item 3: The VPF_st signal name field cannot exceed 31 characters;
[0050] Check item 4: The data type of the VPF_st signal can only be uint8;
[0051] Check Item 5: The VPF_st signal data range, i.e. the minimum and maximum values, cannot exceed the range defined by the data type;
[0052] Verification Item 6: If it is a calibratable parameter, whether its default value is within the defined data range.
[0053] Step 4: Execute the test cases of the above inspection items and output the model interface information table test summary report in the form of numbers and pie charts.
[0054] Step 5: Obtain the definition of interface information in the software detailed design and store it in the document interface information table.
[0055] Step 6: Use the test method of step 3 to test each check item of the same interface parameter field in the document interface information table and the model interface information table.
[0056] Step 7: Execute the test cases of the above inspection items and output the test summary report of the document interface information table in the form of numbers and pie charts.
[0057] Step 8: Use the text comparison algorithm to import the model interface information table and the document interface information table through the human-computer interaction interface to detect the consistency of different parameter attributes in the same interface signal in the two tables.
[0058] Assume that the same signal VPF_st interface in two documents is compared and verified:
[0059] Verification item 1: Whether the interface name is consistent;
[0060] Verification item 2: Whether the interface data type is consistent;
[0061] Verification item 3: Whether the interface data range remains consistent;
[0062] Verification item 4: Whether the interface sampling time is consistent;
[0063] Verification item 5: If it is a calibrable parameter, whether its default value remains consistent;
[0064] Verification Item 6: If it is a constant interface, whether its default value remains consistent;
[0065] Step 9: Execute the test cases of the above inspection items and output the test summary report of the model interface information table and the document interface information table in the form of numbers and pie charts.
[0066] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An automated testing method based on a model interface, characterized in that: include: Step 1: extract model interface information from the test model and store the model interface information in a model interface information table; Step 2: According to the preset test verification items and test rules, at least one test case is assigned to each model interface in the model interface information table to detect the correctness of the model interface information; Step 3: Execute all test cases generated in the model interface information table and output the first test report; Step 4: extracting document interface information from the software detailed design document, and storing the document interface information in a document interface information table; wherein the parameter fields in the document interface information table and the model interface information table are consistent; Step 5: According to the test verification items and test rules preset in step 3, at least one test case is assigned to each document interface in the document interface information table to detect the correctness of the document interface information; Step 6: Execute all test cases generated in the document interface information table and output the second test report; Step 7: Use the text comparison algorithm to compare the same parameter field signal in the model interface information table with that in the document interface information table, and generate a compared interface comparison test report; The model interface information includes: model interface name, model interface data type, model interface data sampling time, model interface data minimum value and model interface data maximum value; The test verification items include: the interface name can only contain letters, numbers, and underscores, the interface name cannot exceed 31 characters, the first character of the interface name cannot have spaces, underscores, and carriage returns, interface data type and data range verification, interface data sampling time and model running time verification; The test rules include: equivalence class partitioning method and boundary value analysis method. The test rules complete the normal check of the default value of fixed value data, the traversal check of enumerated data and the data range type check item by item. The data range type check includes the upper and lower boundary value check of the boundary range data.
2. The automated testing method according to claim 1, characterized in that: The interface comparison test report includes a digital form report, a graphical form report, or a digital plus graphical form report.
Citation Information
Patent Citations
Automatic test case generation method and device, computer equipment and storage medium
CN111506498A
System and method for equivalence class analysis-based automated requirements-based test case generation
US20170228309A1