A general system for implementing instruction computing model testing

CN122673083APending Publication Date: 2026-09-01JIANGNAN ELECTROMECHANICAL DESIGN INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610600155.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-30
Publication Date
2026-09-01

AI Technical Summary

Technical Problem

[0003]但是在实现测试的过程中,即使是相同的指令计算模型,在不同的协议和场景下都需要准备不同的代码,且完成功能测试需要运行大量测试用例;进行单拍测试时,还需要根据测试结果不断调整参数,对测试结果进行比对;当对某些测试用例产生疑问时需要反复执行时,每执行一次测试用例都需要手动查找,因此测试过程需要大量人力重复劳动,而且容易出错

Benefits of technology

[0014] According to the present invention, a large amount of code copying and pasting work can be reduced, the accuracy of interface code implementation can be improved, thus saving a lot of testing tool debugging time, and the test results can be recorded and test conclusions can be given, thereby improving testing efficiency and traceability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122673083A_ABST
    Figure CN122673083A_ABST
Patent Text Reader

Abstract

This invention discloses a general system for testing instruction calculation models, comprising an information interaction module, an interface generation module, a test case execution module, a protocol conversion module, and a model invocation module. The information interaction module determines the instruction calculation model, initiates the test, and displays the test results. The interface generation module generates a parameter interface, providing an environment for the information interaction module to initiate the test. The test case execution module reads test cases and outputs the test case items to the model invocation module. The protocol conversion module generates input / output interface code. The model invocation module displays input parameters on the parameter interface, loads and runs the instruction calculation model, displays the test results, generates a test result file, and interacts with the test case execution module. Based on this technical solution, a significant amount of code copying and pasting work can be reduced, saving considerable debugging time for testing tools and improving testing efficiency, accuracy, and traceability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software testing, and more specifically, to a general system for implementing instruction calculation model testing. Background Technology

[0002] The instruction computation model is a dedicated functional unit that receives input instructions and associated parameters based on a specified protocol, performs deterministic calculations according to the protocol rules, and outputs results. It is not universally applicable. Testing the instruction computation model primarily involves writing interface code for its input and output interfaces according to the protocol, and then integrating this interface code into the input and output interfaces of the testing tool. During testing, test cases for multiple scenarios are prepared according to the protocol. Parameter values ​​are input through the testing tool, and these values ​​are then passed to the instruction computation model via the testing tool's interface functions. After calculation, the model's results are then transmitted to the testing tool's interface for display via the interface functions, thus achieving visualization and standardization of the testing process.

[0003] However, during the testing process, even with the same instruction calculation model, different code needs to be prepared under different protocols and scenarios. Furthermore, completing functional testing requires running a large number of test cases. When performing single-shot testing, parameters need to be continuously adjusted based on the test results, and the test results need to be compared. When questions arise about certain test cases and they need to be executed repeatedly, each execution of a test case requires manual searching. Therefore, the testing process requires a lot of repetitive manual labor and is prone to errors.

[0004] Therefore, a technical solution is needed to implement universal testing of instruction calculation models, which can be compatible with different protocols and control the calling rhythm of test cases according to requirements and test results, so as to achieve the accuracy and traceability of the test execution process. Summary of the Invention

[0005] To achieve the above objectives, this application provides a general system for testing instruction calculation models, including an information interaction module, an interface generation module, a test case execution module, a protocol conversion module, and a model calling module; The information interaction module is used to determine the instruction calculation model, start the test, and display the test results. The interface generation module is used to generate parameter interfaces based on input and output interface codes, providing an environment for the information interaction module to start testing; the input and output interface codes are generated by the protocol conversion module based on standard interface files. The test case execution module is used to read test cases, output the test case items to the model call module, and determine the execution rhythm of the test cases. The protocol conversion module is used to generate input / output interface code for the instruction calculation model based on the standard interface file; The model invocation module is used to display input parameters in the parameter interface, load and run instructions to calculate the model, display test results, generate test result files, and interact with the test case execution module.

[0006] The test cases include logical state change test cases and model calculation test cases; The test case file for logical state change test cases includes the call rhythm sequence number and sequence content; the call rhythm sequence number reflects the order of the multi-beat call instruction calculation model, and the sequence content includes the input and output parameters for each beat, and the output parameter information also includes the expected value. In the test case file of the model calculation test cases, one input parameter corresponds to one column of data, and one row of data corresponds to the value of all input parameters of the model in the current step when running one instruction.

[0007] The standard interface file includes a parameter data structure, which includes: "element name", "element identifier", "data type", "unit and limit value / range!". In the specific content of the standard interface file, each line is used to define an element.

[0008] Furthermore, when the protocol conversion module generates input / output interface code, it reads the original interface protocol, calculates the number of elements, generates pagination code according to the number of elements that can be displayed per page in the pre-set parameter interface, calculates the number of page numbers and page-turning components, and generates corresponding type edit boxes or drop-down boxes according to data types; and implements page turning and the display of elements on the current page in the page-turning component.

[0009] When the test is started, the model calling module loads the parameter interface and calls commands to calculate the model to form the test environment; When the test is executed in the test environment, the model calling module calls the test cases, displays the relevant input parameter values ​​in the parameter interface, inputs the parameter values ​​into the instruction to calculate the model through the transmission channel, and after the instruction to calculate the model is completed, the test results are displayed by the parameter interface and the test results are output to the test case execution module for comparison with the expected calculation results, and output the test conclusion.

[0010] The test conclusions output by the test case execution module determine the validity of the run test cases, whether they need to be run again, and control the execution pace of the test cases.

[0011] Furthermore, the process of generating the test environment specifically includes the following steps: Load the parameter generation interface and test cases to display parameter data; Loading the instruction calculation model includes: mounting the program file of the instruction calculation model in the interface function, binding the elements of the parameter interface, recompiling the entire project, and generating the instruction calculation model and the interface model interaction channel that matches the standard interface file.

[0012] When executing tests, if the test case file is a logical state change type test case file, the execution process includes: Based on the input parameter names in the test case, iterate through the model input parameters. When the parameter names match, assign a value to the input parameter according to the parameter value in the test case. The command is invoked to calculate the model according to the number of cycles specified in the test case. At the end of each cycle, the output parameters of the model are traversed according to the output parameter names in the expected result column of the test case. When the parameter names are consistent, the output parameter name and the calculation result of the current cycle are written into the actual result column. Compare the expected results column with the actual results column. If the actual results are consistent with the expected results, write "pass" as the test conclusion; otherwise, write "fail". After a test case is executed, an initialization process is initiated to initialize the parameters of the instruction calculation model, and then the next test case is executed, and the implementation process is repeated.

[0013] When executing tests, if the test case file is a model calculation type test case file, the execution process includes: After reading the model calculation test case file, assign values ​​to the input parameters of the instruction calculation model according to the corresponding input parameters. Each line of parameters represents the instruction to be called to calculate the model. After each calculation, the parameters are output to the test result file. After each file is executed, the error between the calculation result and the expected output parameter value is output to the test result file, and a test conclusion of "pass" or "fail" is given according to the given allowable error. After executing one file, the instruction calculation model is initialized once, and then the next file is called, repeating the process until all files have been executed.

[0014] According to the present invention, a large amount of code copying and pasting work can be reduced, the accuracy of interface code implementation can be improved, thus saving a lot of testing tool debugging time, and the test results can be recorded and test conclusions can be given, thereby improving testing efficiency and traceability. Attached Figure Description

[0015] Figure 1 This is a schematic diagram of a general system structure for implementing instruction calculation model testing according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the content of a standard interface file provided according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the parameter generation interface process of the model calling module according to an embodiment of the present invention; Figure 4 is a schematic diagram of the test process of executing a model calculation class test case file according to an embodiment of the present invention; Figure 5 is a schematic diagram of the test process of executing a logical state change class test case file according to an embodiment of the present invention. Detailed Implementation

[0016] The specific implementation of the present invention will now be described in detail with reference to the accompanying drawings.

[0017] The general system architecture for implementing instruction computation model testing provided by this invention is as follows: Figure 1 As shown, it includes: P100 information interaction module, P110 interface generation module, P120 test case execution module, P130 protocol conversion module and P140 model calling module.

[0018] The P100 information interaction module is used to interact with the administrator terminal, obtain test requirements, determine the instruction calculation model corresponding to the test requirements, obtain test instructions, start the test, and display the test results.

[0019] The P130 protocol conversion module responds to the testing requirements of the information interaction module by generating input / output interface code for the instruction calculation model based on the standard interface file. The standard interface file is determined based on the original interface protocol and implemented through a table file, such as... Figure 2 As shown, the standard interface file includes a data structure, which includes "element name", "element identifier", "data type", "unit and limit value / range!". In the specific content of the standard interface file, each line is used to define an element.

[0020] The protocol conversion module generates input / output interface code according to the specified programming language and the standard interface file specifications; the input / output interface code is used by the interface generation module to generate the parameter interface.

[0021] When generating input / output interface code, the original interface protocol is read, the number of elements is calculated, and code for pagination is generated according to the number of elements that can be displayed per page in the pre-set parameter interface. The number of page numbers and page turning components are calculated, and corresponding type edit boxes or drop-down boxes are generated according to the data type. Page turning and the display of elements on the current page are implemented in the page turning component.

[0022] When generating code for an edit box or drop-down box of the corresponding type based on the data type, the interface page handle corresponding to each parameter is generated in a loop from the second line to the last line of the standard interface file, and the corresponding type function is called. For input parameters, the Fd_StringToDouble function is called when the "data type" is double, the Fl_StringToInt function is called when the "data type" is unsigned short, the Fl_StringToInt function is called when the "data type" is unsigned char and the value range includes 0xXX type numbers, and the Fuc_StringToHex function is called when the "data type" is other. For example, an input parameter element is identified as D_RdZ1_0T, the "data type" is double, located on line 80, and should be displayed on page 3 of the interface, that is, the generated code is: "zljsin.D_RdZ1_0T=Fd_StringToDouble(m_Pages[2],ID++)"; For output parameters, when the "data type" is double, the Fs_DataToString function is called and the input parameter representing the type in the function is set to 2; when the "data type" is short\unsigned short\unsigned char\long, the Fs_DataToString function is called and the input parameter representing the type in the function is set to 3; when the "data type" is other, the Fs_DataToString function is called and the input parameter representing the type in the function is set to 1. For example, an output parameter element is identified as D_Numbers1, the "data type" is double, located on line 40, and should be displayed on page 2 of the interface, that is, the generated code is: "m_PagesOut[1]->SetDlgItemText(ID++,Fs_DataToString(zljsou.D_Numbers1,2))".

[0023] When generating code for pagination and page-turning components, the code iterates through the page numbers to generate an array of handles for each page, and then calls the UI update function. For example, the update code for four page numbers is generated as follows: “m_Pages[0]->UpdateData(TRUE); m_Pages[1]->UpdateData(TRUE); m_Pages[2]->UpdateData(TRUE); m_Pages[3]->UpdateData(TRUE)” The P110 interface generation module is used to generate parameter interfaces for test cases based on input and output interface codes, and to prepare the environment for starting tests of the information interaction module; the input and output interface codes are generated by the protocol conversion module based on standard interface files (original interface protocols).

[0024] The process of generating the parameter interface is as follows Figure 3 As shown, it includes: reading input / output interface code, determining input parameters, output parameters, and the total number of each parameter, generating tabs based on the display range of each page (e.g., 36 elements per page); executing input / output interface code, generating static parameter edit boxes, generating editable edit boxes based on data types, limiting the data types supported by the edit boxes, and annotating all parameters.

[0025] When generating an editable edit box, it supports generating drop-down lists and checkboxes: if the input parameter has a range of values, a drop-down list type edit box is generated, and all values ​​are displayed in the drop-down list for selecting the input or output parameter; when generating a checkbox, parameter values ​​are defined for the checkbox.

[0026] After generating comments for all parameters, add dynamic client-side code to support mouse events. For example, when the mouse hovers over a parameter on the interface, the detailed explanation of the parameter is displayed in real time as a label, and disappears when the mouse moves away.

[0027] The P120 test case execution module is used to read test cases and output the test case items to the model call module. The test cases include: logical state change test cases and model calculation test cases. Different test cases have different test case file contents. 1) For test cases involving logical state changes, the test case file includes the call rhythm sequence number and sequence content. The call rhythm sequence number reflects the order of the multi-step call instruction calculation model, and the sequence content includes the input and output parameters for each step. The output parameter information also includes the expected value.

[0028] Specifically, the input parameter information for each beat includes the rhythm number, the input parameter number, and the corresponding parameter value, separated from the rhythm by a separator; for example: "Input parameter 1 for beat 1: parameter value 1; Input parameter 2: parameter value 2; ... Input parameter n: parameter value n; ... Input parameter 1 for beat n: parameter value 1; Input parameter 2: parameter value 2; ... Input parameter n: parameter value n"; The output parameter information includes: the output parameter number and the corresponding expected value; for example: "output parameter 1: expected value 1; output parameter 2: expected value 2; ... output parameter n: expected value n".

[0029] 2) For model calculation test cases, in the test case file, one input parameter corresponds to one column of data, and one row of data corresponds to the value of all input parameters of the model in the current step when running one instruction.

[0030] Before starting the test, the test case execution module provides the test case file to the model calling module to prepare specific parameter data for starting the test. After the test is started, the test case execution module obtains the test results output from the model calling module, compares them with the expected values ​​of the output parameters in the test case, and gives the test conclusion; based on the test conclusion, it determines the execution rhythm of the test case, such as whether it needs to be executed again.

[0031] The P140 model calling module is used to display input parameters in the parameter interface, load and run instructions to calculate the model, display test results, generate test result files, and interact with the test case execution module.

[0032] When the information interaction module starts testing, the model call module loads the parameter interface and calls commands to calculate the model to form the test environment. The process of generating the test environment is implemented together with the test case execution module, and specifically includes the following steps: 1) Load the parameter generation interface and test case display parameter data; 2) Loading the instruction calculation model, including: mounting the program file of the instruction calculation model in the interface function, recompiling the entire project, binding the elements of the parameter interface, and generating the instruction calculation model and the interface model interaction channel that matches the standard interface file (interface protocol).

[0033] When executing tests in the test environment, test cases associated with the test requirements are invoked. The relevant input parameter values ​​are displayed in the parameter interface. These values ​​are then transmitted to the instruction calculation model via a transmission channel. After the instruction calculation model completes its calculation, the test results are displayed in the parameter interface and output to the test case execution module. These results are compared with the expected calculation results (the expected values ​​of the output parameters) to output the test conclusion. The test conclusion determines the validity of the runnable test cases and whether they need to be repeated, thus controlling the execution pace of the test cases.

[0034] When executing the test, first extract the test case file, where each line in the file represents a test case. In the parameter interface of the test environment, display the input parameters and their corresponding values, as well as the output parameters and their expected values. If a test case requires multiple calls to the instruction to calculate the model, the test case content should be written in the format: "Step 1: Input parameter 1: Parameter value 1; Input parameter 2: Parameter value 2; ... Input parameter n: Parameter value n; ... Step m: Input parameter 1: Parameter value 1; Input parameter 2: Parameter value 2; ... Input parameter n: Parameter value n".

[0035] If the test case file is a logical state change type test case file, the instruction calculation model is called to execute the test cases, the test results are recorded, and the test conclusions are given; the implementation process is as follows: Figure 5 As shown, it includes: 1) Iterate through the model input parameters according to the input parameter names in the test case. When the parameter names match, assign a value to the input parameter according to the parameter value in the test case. 2) Call the instruction to calculate the model according to the number of cycles specified in the test case, and at the end of each cycle, traverse the model output parameters according to the output parameter names in the expected result column of the test case. When the parameter names are consistent, write the output parameter name and the calculation result of the current cycle into the actual result column. 3) Compare the expected results column and the actual results column. If the actual results are consistent with the expected results, write "pass" as the test conclusion; otherwise, write "fail".

[0036] 4) After a test case is executed, the initialization process is started to initialize the parameters of the instruction calculation model, and then the next test case is executed, and the implementation process is repeated.

[0037] If the test case file is a model calculation test case file, the command is invoked to calculate the model, execute the test cases, generate a test result file, and provide the test conclusions; the implementation process is as follows: Figure 4 As shown, it includes: 1) After a file is read in, the input parameters of the instruction calculation model are assigned according to the corresponding input parameters. Each line of parameters represents the instruction calculation model that needs to be called for one calculation. After each calculation, the parameters are output to the test result file. 2) After each file is executed, the error between the calculation result and the expected output parameter value is output to the test result file, and the test conclusion of "pass" or "fail" is given according to the given allowable error. 3) After executing one file, initialize the instruction calculation model once, then call the next file and repeat the process until all files have been executed.

[0038] Compared to the traditional method of manually binding interface controls and manually writing interface code according to communication protocols, this invention provides a simple and universal system: when the interface protocol changes, only the standard interface file needs to be modified, without rewriting the interface code, which reduces a lot of code copying and pasting work; if parameters change, only the changed parts of the code are needed, such as the code connecting the interface and the model, which can be automatically generated by a code generation tool, improving the accuracy of the interface code implementation and saving a lot of debugging time for testing tools; at the same time, compared to the original test case execution method that required a lot of instrumentation and breakpoints, which could only view the test results immediately and required repeated execution when there were doubts about certain test cases, this invention provides a solution that can automatically execute all test cases, record test results, and provide test conclusions. When backtracking is needed, the test records can be viewed, which greatly improves testing efficiency and traceability.

[0039] The above-disclosed embodiments are merely a few specific examples of the present invention. However, the present invention is not limited thereto, and any variations that can be conceived by those skilled in the art should fall within the protection scope of the present invention.

Claims

1. A general system for testing instruction computation models, characterized in that, It includes an information interaction module, an interface generation module, a test case execution module, a protocol conversion module, and a model invocation module; The information interaction module is used to determine the instruction calculation model, start the test, and display the test results. The interface generation module is used to generate a parameter interface based on the input / output interface code, providing an environment for the information interaction module to start testing; wherein, the input / output interface code is generated by the protocol conversion module based on the standard interface file; The test case execution module is used to read test cases, output the test case items to the model calling module, and determine the execution rhythm of the test cases. The protocol conversion module is used to generate input / output interface code for the instruction calculation model based on the standard interface file. The model calling module is used to display input parameters on the parameter interface, load and run instructions to calculate the model, display test results, generate test result files, and interact with the test case execution module.

2. The general system for implementing instruction calculation model testing according to claim 1, characterized in that, The test cases include logical state change test cases and model calculation test cases; The test case file of the logical state change test case includes the call rhythm sequence number and sequence content; wherein, the call rhythm sequence number reflects the order of the multi-beat call instruction calculation model, and the sequence content includes the input parameters and output parameters corresponding to each beat, and the output parameter information also includes the expected value; In the test case file of the model calculation test cases, one input parameter corresponds to one column of data, and one row of data corresponds to the value of all input parameters of the model in the current step when running one step of the instruction.

3. The general system for implementing instruction calculation model testing according to claim 1, characterized in that, The standard interface file includes a parameter data structure, which includes: "element name", "element identifier", "data type", "unit and limit value / range!". In the specific content of the standard interface file, each line is used to define an element.

4. The general system for implementing instruction calculation model testing according to claim 1, characterized in that, When the protocol conversion module generates input / output interface code, it reads the original interface protocol, calculates the number of elements, generates pagination code according to the number of elements that can be displayed per page in the pre-set parameter interface, calculates the number of page numbers and page-turning components, and generates corresponding type edit boxes or drop-down boxes according to data types; and implements page turning and the display of elements on the current page in the page-turning component.

5. The general system for implementing instruction calculation model testing according to claim 1, characterized in that, When the test is started, the model calling module loads the parameter interface and calls commands to calculate the model to form the test environment; When the test is executed in the test environment, the model calling module calls the test cases, displays the relevant input parameter values ​​in the parameter interface, inputs the parameter values ​​into the instruction calculation model through the transmission channel, and after the instruction calculation model completes the calculation, the test results are displayed by the parameter interface and the test results are output to the test case execution module for comparison with the expected calculation results, and the test conclusion is output.

6. The general system for implementing instruction calculation model testing according to claim 5, characterized in that, The test conclusions output by the test case execution module determine the validity of the run test cases, whether they need to be run again, and control the execution rhythm of the test cases.

7. The general system for implementing instruction calculation model testing according to claim 5, characterized in that, The process of generating the test environment specifically includes the following steps: Load the parameter generation interface and test cases to display parameter data; Loading the instruction calculation model includes: mounting the program file of the instruction calculation model in the interface function, binding the elements of the parameter interface, recompiling the entire project, and generating the instruction calculation model and the interface model interaction channel that matches the standard interface file.

8. The general system for implementing instruction calculation model testing according to claim 5, characterized in that, When performing the test, if the test case file is a logical state change type test case file, the execution process includes: Based on the input parameter names in the test case, iterate through the model input parameters. When the parameter names match, assign a value to the input parameter according to the parameter value in the test case. The command is invoked to calculate the model according to the number of cycles specified in the test case. At the end of each cycle, the output parameters of the model are traversed according to the output parameter names in the expected result column of the test case. When the parameter names are consistent, the output parameter name and the calculation result of the current cycle are written into the actual result column. Compare the expected results column with the actual results column. If the actual results match the expected results, write "pass" as the test conclusion; otherwise, write "fail". After a test case is executed, an initialization process is initiated to initialize the parameters of the instruction calculation model, and then the next test case is executed, and the implementation process is repeated.

9. The general system for implementing instruction calculation model testing according to claim 5, characterized in that, When performing the test, if the test case file is a model calculation type test case file, the execution process includes: After reading the model calculation test case file, assign values ​​to the input parameters of the instruction calculation model according to the corresponding input parameters. Each line of parameters represents the instruction to be called to calculate the model. After each calculation, the parameters are output to the test result file. After each file is executed, the error between the calculation result and the expected output parameter value is output to the test result file, and a test conclusion of "pass" or "fail" is given according to the given allowable error. After executing one file, the instruction calculation model is initialized once, and then the next file is called, repeating the process until all files have been executed.