Simulation method and device for testing software function, electronic equipment and storage medium
Patent Information
- Application Number
- CN202210284271.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-22
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2042-03-22
AI Technical Summary
[0003]而当前的软件的功能和逻辑测试往往需要依赖硬件条件,但是因为软硬件研发的完成周期并不能同步,这就导致此种测试方法的开发周期较长
Smart Images

Figure CN114625659B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a simulation method, apparatus, electronic device, and storage medium for testing software functionality. Background Technology
[0002] The research and development process of semiconductor devices is divided into two parts: hardware and software. To improve the efficiency of the research and development process, software development and hardware development are often carried out simultaneously. The software development phase includes requirements design, detailed design, coding, and testing, and the software's functionality and logic need to be tested during the software development process.
[0003] Current software functional and logic testing often relies on hardware conditions. However, because the development cycles of software and hardware are not synchronized, the development cycle for this testing method is relatively long. Therefore, how to ensure that software functional and logic testing can be completed without hardware products is an urgent technical problem to be solved. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a simulation method, device, electronic device and storage medium for testing software functions. By constructing a target interface simulation file, it ensures that the testing of software functions and logic can be completed without hardware products, thereby shortening the research and development cycle.
[0005] This application provides a simulation method for testing software functionality, the simulation method comprising:
[0006] Scan the data packets of the software under test to determine if the target interface simulation file of the software under test exists;
[0007] When a target interface simulation file for the software under test exists, obtain the actual parameters generated during the runtime of the software under test.
[0008] The nodes in the target interface simulation file are traversed, the values of the actual parameters are passed to the formal parameters in the target interface simulation file, and the return values of the nodes corresponding to the formal parameters are obtained.
[0009] Based on the return value, the simulation result of the software under test is determined, and the simulation result is sent to the client.
[0010] Optionally, when a target interface simulation file for the software under test does not exist, the simulation method includes:
[0011] Obtain the target data interaction file of the software to be tested;
[0012] The target data interaction file is traversed to obtain the interface-related information of the data interaction between the software under test and the target hardware;
[0013] The interface-related information is filled into the specified location in the initial simulation file to form a candidate interface simulation file; the initial simulation file is an XML format file.
[0014] In response to the developer's data modification operation on the candidate interface simulation file, the candidate interface simulation file whose modification operation has been completed is determined as the target interface simulation file.
[0015] Optionally, before responding to a developer's data modification operation on the candidate interface simulation file, the simulation method further includes:
[0016] In response to the developer's file opening operation, the candidate interface simulation file is opened through a visualization program, so that the developer can modify the data of the candidate interface simulation file based on the expected implementation function of the software under test.
[0017] Optionally, after determining the candidate interface simulation file whose modification operation has been completed as the target interface simulation file, the simulation method further includes:
[0018] The target interface simulation file is bound to the software under test, and the bound software under test is stored in the first storage area, while the target interface simulation file of the bound software under test is stored in the second storage area.
[0019] Optionally, the interface-related information includes at least the class name, method name, method formal parameters, and method return value.
[0020] Optionally, filling the interface-related information into a specified location in the initial simulation file to form a candidate interface simulation file includes:
[0021] Fill the class name into the first specified position in the initial simulation file to construct the class name node of the initial simulation file;
[0022] Fill the method name into the second specified position in the initial simulation file to construct the method name node under the class name node;
[0023] Fill the formal parameters and return values of the method into the third specified position in the initial simulation file to construct the condition node under the method name node;
[0024] The initial simulation file, which has been constructed with class name nodes, method name nodes, and condition nodes, is determined as the candidate interface simulation file.
[0025] Optionally, the target data interaction file is a dynamic link library file.
[0026] This application embodiment also provides a simulation device for testing software functionality, the simulation device comprising:
[0027] The determination module is used to scan the data packets of the software under test to determine whether the target interface simulation file of the software under test exists.
[0028] The first acquisition module is used to acquire the actual parameters generated by the software under test during runtime when a target interface simulation file of the software under test exists.
[0029] The second acquisition module is used to traverse each node in the target interface simulation file, pass the value of the actual parameter to the formal parameter in the target interface simulation file, and obtain the return value of the node corresponding to the formal parameter.
[0030] The sending module is used to determine the simulation result of the software under test's operation function based on the return value, and send the simulation result to the client.
[0031] Optionally, the simulation device further includes a construction module, which is used for:
[0032] When the target interface simulation file of the software under test does not exist, obtain the target data interaction file of the software under test.
[0033] The target data interaction file is traversed to obtain the interface-related information of the data interaction between the software under test and the target hardware;
[0034] The interface-related information is filled into the specified location in the initial simulation file to form a candidate interface simulation file; the initial simulation file is an XML format file.
[0035] In response to the developer's data modification operation on the candidate interface simulation file, the candidate interface simulation file whose modification operation has been completed is determined as the target interface simulation file.
[0036] Optionally, the building module 250 is further configured to:
[0037] In response to the developer's file opening operation, the candidate interface simulation file is opened through a visualization program, so that the developer can modify the data of the candidate interface simulation file based on the expected implementation function of the software under test.
[0038] Optionally, the simulation device further includes a storage module, the storage module being used for:
[0039] The target interface simulation file is bound to the software under test, and the bound software under test is stored in the first storage area, while the target interface simulation file of the bound software under test is stored in the second storage area.
[0040] Optionally, the interface-related information includes at least the class name, method name, method formal parameters, and method return value.
[0041] Optionally, when the construction module fills the interface-related information into a specified location in the initial simulation file to form a candidate interface simulation file, the construction module is used to:
[0042] Fill the class name into the first specified position in the initial simulation file to construct the class name node of the initial simulation file;
[0043] Fill the method name into the second specified position in the initial simulation file to construct the method name node under the class name node;
[0044] Fill the formal parameters and return values of the method into the third specified position in the initial simulation file to construct the condition node under the method name node;
[0045] The initial simulation file, which has been constructed with class name nodes, method name nodes, and condition nodes, is determined as the candidate interface simulation file.
[0046] Optionally, the target data interaction file is a dynamic link library file.
[0047] This application embodiment also provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the simulation method described above are performed.
[0048] This application also provides a computer-readable storage medium storing a computer program, which, when run by a processor, executes the steps of the simulation method described above.
[0049] This application provides a simulation method, apparatus, electronic device, and storage medium for testing software functionality. The simulation method includes: scanning data packets of the software under test to determine whether a target interface simulation file for the software under test exists; when a target interface simulation file exists, acquiring the actual parameters generated by the software under test during runtime; traversing each node in the target interface simulation file, passing the values of the actual parameters to formal parameters in the target interface simulation file, and acquiring the return values of the nodes corresponding to the formal parameters; based on the return values, determining the simulation result of the software under test's runtime functionality, and sending the simulation result to a client.
[0050] In this way, this application realizes rapid simulation development based on interface information by automatically generating target interface simulation files from dynamic link library files containing interface information. Furthermore, by generating interface simulation files in a general XML format, it can effectively reduce repetitive development work. Moreover, based on the generation of interface simulation files, it enables the testing of software functions and logic without the presence of hardware products.
[0051] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0052] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0053] Figure 1 A flowchart illustrating a simulation method for testing software functionality provided in an embodiment of this application;
[0054] Figure 2 This is one of the structural schematic diagrams of a simulation device for testing software functionality provided in an embodiment of this application;
[0055] Figure 3 A second schematic diagram of the structure of a simulation device for testing software functionality provided in an embodiment of this application;
[0056] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.
[0058] The research and development process of semiconductor devices is divided into two parts: hardware and software. To improve the efficiency of the research and development process, software development and hardware development are often carried out simultaneously. The software development phase includes requirements design, detailed design, coding, and testing, and the software's functionality and logic need to be tested during the software development process.
[0059] Current software functional and logic testing often relies on hardware conditions. However, because the development cycles of software and hardware are not synchronized, the development cycle for this testing method is relatively long. Therefore, how to ensure that software functional and logic testing can be completed without hardware products is an urgent technical problem to be solved.
[0060] Based on this, embodiments of this application provide a simulation method, apparatus, electronic device, and storage medium for testing software functions. By constructing a target interface simulation file, it ensures that software functions and logic can be tested without hardware products, thereby shortening the R&D cycle.
[0061] Please see Figure 1 , Figure 1 This is a flowchart illustrating a simulation method for testing software functionality provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the simulation method includes:
[0062] S101. Scan the data packets of the software to be tested to determine whether the target interface simulation file of the software to be tested exists.
[0063] S102. When a target interface simulation file of the software to be tested exists, obtain the actual parameters generated during the runtime of the software to be tested.
[0064] S103. Traverse each node in the target interface simulation file, pass the value of the actual parameter to the formal parameter in the target interface simulation file, and obtain the return value of the node corresponding to the formal parameter.
[0065] S104. Based on the return value, determine the simulation result of the software under test's operation function, and send the simulation result to the client.
[0066] This application provides a simulation method for testing software functionality. By pre-constructing a target interface simulation file to replace hardware, the method enables functional testing of software by first determining the target interface simulation file corresponding to the software under test; then, acquiring the actual parameters generated during the execution of the software; next, traversing each node in the target interface simulation file and passing the determined actual parameters to the formal parameters in the target interface simulation file to determine the return value of the node containing the formal parameter; finally, based on the return values of the determined nodes, determining the simulation result of the software's operational function. Thus, this simulation method ensures that software functionality and logic testing and verification can be completed without the need for hardware products.
[0067] The step of scanning the data packets of the software under test to determine whether a target interface simulation file of the software under test exists includes: scanning the data packets of the software under test to determine the associated information of the software under test; and based on the scanned associated information, scanning a specified storage location to determine whether a target interface simulation file of the software under test exists.
[0068] Here, the target interface simulation file is in XML format. To determine if the target interface simulation file for the software under test exists, a pre-built C# simulation support class can be called. This class then determines whether the target interface simulation file exists in the specified path. The C# simulation support class can be used to define the file format of the constructed interface simulation file and determine the initial simulation file. It identifies the format of the files stored in the specified path to determine if the target interface simulation file for the software under test exists.
[0069] The associated information of the software under test includes at least the information of the target data interaction file required when the software under test interacts with the target hardware, and may include the information of the target interface simulation file generated based on the data interaction file; the target data interaction file is a dynamic link library file.
[0070] It should be noted that the data interaction file refers to the file necessary for functional and logical testing or verification of the software through the hardware when both the software and hardware are ready. This file is a dynamic link library file.
[0071] The actual parameters (actual parameters) are the actual parameters that the software under test needs to send to the hardware when working with the hardware. They are also the parameters that the hardware needs to provide a return value after receiving the actual parameters.
[0072] Here, the return value of the node corresponding to the formal parameter can be obtained as follows: A C# simulation support class is called, and based on the determined actual parameters, each node in the target interface simulation file is traversed to determine the corresponding formal parameter. The value of the actual parameter is then passed to the formal parameter in the target interface simulation file, thereby obtaining the return value of the node corresponding to the formal parameter. The node corresponding to the formal parameter can be the node at the location of the formal parameter, and this node can be a condition node.
[0073] The step of determining the simulation result of the software under test's operating function based on the return value includes: pre-setting the simulation result for each return value, so that when the return value of the node containing the formal parameter is determined, the simulation result of the software under test's operating function can be directly determined. The simulation result includes both normal and abnormal results.
[0074] In one embodiment of this application, when no target interface simulation file for the software under test exists, the simulation method includes: acquiring a target data interaction file for the software under test; traversing the target data interaction file to acquire interface-related information for data interaction between the software under test and the target hardware; filling the interface-related information into a specified position in an initial simulation file to form a candidate interface simulation file; the initial simulation file is an XML format file; and in response to a developer's data modification operation on the candidate interface simulation file, determining the candidate interface simulation file after the modification operation is completed as the target interface simulation file.
[0075] In this step, when it is determined that there is no target interface simulation file for the software under test, the target data interaction file for the software under test can be determined through the associated information of the software under test. Then, the information in the target data interaction file is traversed and read through the reflection mechanism to obtain the interface-related information of the software under test and the target hardware for data interaction. Then, the obtained interface-related information is filled into the specified position in the initial simulation file to add node content to the initial simulation file, forming a candidate interface simulation file. Finally, the candidate interface simulation file is sent to the developers so that the developers can continue to modify the node content in the candidate interface simulation file based on the expected implementation function of the software under test, thereby obtaining the target interface simulation file based on the candidate interface simulation file modified by the developers.
[0076] Here, the reflection mechanism is the reflection mechanism of C#; the initial simulation file is a pre-determined XML format file through the C# simulation support class, and multiple node content filling positions are set in the file for filling in interface-related information to generate candidate interface simulation files.
[0077] Here, the interface-related information includes at least a class name, method name, method formal parameters, and method return value. Different interface-related information includes different field formats to better determine the location of each interface-related information when filling in information into the initial simulation file later. The obtained interface-related information includes at least one class name, each class name includes at least one method name, and each method name includes at least one set of method formal parameters and a method return value.
[0078] It should be noted that, based on the data interaction file (i.e., dynamic link library), the target interface simulation file can be automatically constructed by supporting classes, enabling rapid development of simulation files based on interface information.
[0079] Furthermore, compared to existing solutions that require writing different simulation programs based on hardware program differences, the approach of constructing target interface simulation files based on data interaction files (i.e., dynamic link libraries) offers better versatility because different hardware may correspond to the same dynamic link library file. This effectively improves program reusability, reduces redundant development of simulation programs, and consequently shortens product development cycles and lowers R&D costs.
[0080] In another embodiment of this application, filling the interface-related information into a designated location in the initial simulation file to form a candidate interface simulation file includes: filling the class name into a first designated location in the initial simulation file to construct a class name node in the initial simulation file; filling the method name into a second designated location in the initial simulation file to construct a method name node under the class name node; filling the method formal parameters and method return value into a third designated location in the initial simulation file to construct a condition node under the method name node; and determining the initial simulation file with the constructed class name node, method name node, and condition node as the candidate interface simulation file.
[0081] Here, after obtaining the interface-related information and determining the class name, method name, method formal parameters, and method return value in the interface-related information, the node content is filled in. Each data is filled into the specified position to complete the construction of the class name node, method name node, and condition node, and the candidate interface simulation file is obtained.
[0082] Each class name node includes at least one method name node, and each method name node includes at least one condition node.
[0083] In another embodiment of this application, before responding to a developer's data modification operation on the candidate interface simulation file, the simulation method further includes: in response to the developer's file opening operation, opening the candidate interface simulation file through a visualization program, so that the developer can perform data modification operations on the candidate interface simulation file based on the expected implementation function of the software under test.
[0084] Here, in order to increase the compatibility between the automatically generated candidate interface simulation file and the software under test, the generated candidate interface simulation file needs to be sent to the developers for confirmation and modification to obtain the target interface simulation file.
[0085] The visualization program is a visual XML file read / write program. Modifications to the candidate interface simulation file include changing condition node data and / or adding and / or deleting condition nodes.
[0086] In another embodiment of this application, after determining the candidate interface simulation file after the modification operation is completed as the target interface simulation file, the simulation method further includes: binding the target interface simulation file to the software under test, storing the bound software under test in a first storage area, and storing the bound target interface simulation file of the software under test in a second storage area.
[0087] Here, the first storage area and the second storage area are predetermined storage areas. The first storage area and the second storage area can be the same storage area or different storage areas.
[0088] Furthermore, the target interface simulation file is pre-bound to a corresponding target data interaction file, which is stored in a third storage area. This third storage area may be the same as the first storage area, the same as the second storage area, or a separate storage area. The target data interaction file is a dynamic link library file.
[0089] This application provides a simulation method for testing software functionality. The simulation method includes: scanning the data packets of the software under test to determine whether a target interface simulation file of the software under test exists; when a target interface simulation file of the software under test exists, obtaining the actual parameters generated by the software under test during runtime; traversing each node in the target interface simulation file, passing the values of the actual parameters to the formal parameters in the target interface simulation file, and obtaining the return values of the nodes corresponding to the formal parameters; based on the return values, determining the simulation result of the software under test's runtime functionality, and sending the simulation result to a client.
[0090] In this way, this application realizes rapid simulation development based on interface information by automatically generating target interface simulation files from dynamic link library files containing interface information. Furthermore, by generating interface simulation files in a general XML format, it can effectively reduce repetitive development work. Moreover, based on the generation of interface simulation files, it enables the testing of software functions and logic without the presence of hardware products.
[0091] Please see Figure 2 , Figure 3 , Figure 2 This is one of the structural schematic diagrams of a simulation device for testing software functionality provided in an embodiment of this application. Figure 3 This is a second schematic diagram of a simulation device for testing software functionality provided in an embodiment of this application. Figure 2 As shown, the simulation device 200 includes:
[0092] The determination module 210 is used to scan the data packets of the software under test to determine whether the target interface simulation file of the software under test exists.
[0093] The first acquisition module 220 is used to acquire the actual parameters generated by the software under test when the target interface simulation file of the software under test exists.
[0094] The second acquisition module 230 is used to traverse each node in the target interface simulation file, pass the value of the actual parameter to the formal parameter in the target interface simulation file, and obtain the return value of the node corresponding to the formal parameter.
[0095] The sending module 240 is used to determine the simulation result of the operating function of the software under test based on the return value, and send the simulation result to the client.
[0096] Optional, such as Figure 3 As shown, the simulation device 200 further includes a construction module 250, which is used for:
[0097] When the target interface simulation file of the software under test does not exist, obtain the target data interaction file of the software under test.
[0098] The target data interaction file is traversed to obtain the interface-related information of the data interaction between the software under test and the target hardware;
[0099] The interface-related information is filled into the specified location in the initial simulation file to form a candidate interface simulation file; the initial simulation file is an XML format file.
[0100] In response to the developer's data modification operation on the candidate interface simulation file, the candidate interface simulation file whose modification operation has been completed is determined as the target interface simulation file.
[0101] Optionally, the building module 250 is further configured to:
[0102] In response to the developer's file opening operation, the candidate interface simulation file is opened through a visualization program, so that the developer can modify the data of the candidate interface simulation file based on the expected implementation function of the software under test.
[0103] Optionally, the simulation device 200 further includes a storage module 260, which is used for:
[0104] The target interface simulation file is bound to the software under test, and the bound software under test is stored in the first storage area, while the target interface simulation file of the bound software under test is stored in the second storage area.
[0105] Optionally, the interface-related information includes at least the class name, method name, method formal parameters, and method return value.
[0106] Optionally, when the construction module 250 fills the interface-related information into a specified location in the initial simulation file to form a candidate interface simulation file, the construction module 250 is used to:
[0107] Fill the class name into the first specified position in the initial simulation file to construct the class name node of the initial simulation file;
[0108] Fill the method name into the second specified position in the initial simulation file to construct the method name node under the class name node;
[0109] Fill the formal parameters and return values of the method into the third specified position in the initial simulation file to construct the condition node under the method name node;
[0110] The initial simulation file, which has been constructed with class name nodes, method name nodes, and condition nodes, is determined as the candidate interface simulation file.
[0111] Optionally, the target data interaction file is a dynamic link library file.
[0112] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 400 includes a processor 410, a memory 420, and a bus 430.
[0113] The memory 420 stores machine-readable instructions executable by the processor 410. When the electronic device 400 is running, the processor 410 communicates with the memory 420 via the bus 430. When the machine-readable instructions are executed by the processor 410, they can perform the operations described above. Figure 1 The steps of the simulation method in the illustrated method embodiment can be found in the method embodiment for specific implementation methods, which will not be repeated here.
[0114] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 The steps of the simulation method in the illustrated method embodiment can be found in the method embodiment for specific implementation methods, which will not be repeated here.
[0115] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0116] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0117] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0118] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0119] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0120] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A simulation method for testing software functionality, characterized in that, The simulation method includes: The data packets of the software under test are scanned to determine the associated information of the software under test. Based on the scanned associated information, a specified storage location is scanned to determine whether the target interface simulation file of the software under test exists. The target interface simulation file is in XML file format. The associated information of the software under test includes information about the target data interaction file required when the software under test interacts with the target hardware. The target data interaction file is a dynamic link library file. When a target interface simulation file for the software under test exists, obtain the actual parameters generated during the runtime of the software under test. The nodes in the target interface simulation file are traversed, the values of the actual parameters are passed to the formal parameters in the target interface simulation file, and the return values of the nodes corresponding to the formal parameters are obtained. Based on the return value, determine the simulation result of the software under test's operation function, and send the simulation result to the client; When the target interface simulation file for the software under test does not exist, the simulation method includes: Obtain the target data interaction file of the software to be tested; The target data interaction file is traversed to obtain the interface-related information of the data interaction between the software under test and the target hardware; The interface-related information is filled into the specified location in the initial simulation file to form a candidate interface simulation file; the initial simulation file is an XML format file. In response to the developer's data modification operation on the candidate interface simulation file, the candidate interface simulation file whose modification operation has been completed is determined as the target interface simulation file.
2. The simulation method according to claim 1, characterized in that, Before responding to data modification operations by developers on the candidate interface simulation file, the simulation method further includes: In response to the developer's file opening operation, the candidate interface simulation file is opened through a visualization program, so that the developer can modify the data of the candidate interface simulation file based on the expected implementation function of the software under test.
3. The simulation method according to claim 1, characterized in that, After determining the candidate interface simulation file with completed modification operations as the target interface simulation file, the simulation method further includes: The target interface simulation file is bound to the software under test, and the bound software under test is stored in the first storage area, while the target interface simulation file of the bound software under test is stored in the second storage area.
4. The simulation method according to claim 1, characterized in that, The interface-related information includes at least the class name, method name, method formal parameters, and method return value.
5. The simulation method according to claim 4, characterized in that, The step of filling the interface-related information into a specified location in the initial simulation file to form a candidate interface simulation file includes: Fill the class name into the first specified position in the initial simulation file to construct the class name node of the initial simulation file; Fill the method name into the second specified position in the initial simulation file to construct the method name node under the class name node; Fill the formal parameters and return values of the method into the third specified position in the initial simulation file to construct the condition node under the method name node; The initial simulation file, which has been constructed with class name nodes, method name nodes, and condition nodes, is determined as the candidate interface simulation file.
6. A simulation device for testing software functionality, characterized in that, The simulation device includes: The determination module is used to scan the data packets of the software under test, determine the association information of the software under test, and based on the scanned association information, scan a specified storage location to determine whether the target interface simulation file of the software under test exists; the file format of the target interface simulation file is an XML file; the association information of the software under test includes information on the target data interaction file required when the software under test interacts with the target hardware; the target data interaction file is a dynamic link library file; The first acquisition module is used to acquire the actual parameters generated by the software under test during runtime when a target interface simulation file of the software under test exists. The second acquisition module is used to traverse each node in the target interface simulation file, pass the value of the actual parameter to the formal parameter in the target interface simulation file, and obtain the return value of the node corresponding to the formal parameter. The sending module is used to determine the simulation result of the function of the software under test based on the return value, and send the simulation result to the client; The simulation device further includes a construction module, which is used for: When the target interface simulation file of the software under test does not exist, obtain the target data interaction file of the software under test. The target data interaction file is traversed to obtain the interface-related information of the data interaction between the software under test and the target hardware; The interface-related information is filled into the specified location in the initial simulation file to form a candidate interface simulation file; the initial simulation file is an XML format file. In response to the developer's data modification operation on the candidate interface simulation file, the candidate interface simulation file whose modification operation has been completed is determined as the target interface simulation file.
7. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the machine-readable instructions are executed by the processor to perform the steps of the simulation method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the simulation method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Payment terminal application simulation method and device
CN107193628A