A function test method, device and equipment based on model simulation and a medium

By simulating physical machine information for functional testing, the problem of testing for models lacking historical models or with low shipment volumes has been solved, and a flexible and efficient testing method has been achieved.

CN115309656BActive Publication Date: 2026-04-21JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN INSPUR DATA TECH CO LTD
Filing Date
2022-08-30
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In the development of storage system functions, the lack of historical models or physical models with low shipment volumes makes it impossible to conduct functional testing.

Method used

By collecting and simulating physical machine information, functional tests are conducted using machine configuration files, and test results are recorded using either information collection or information replacement modes.

Benefits of technology

It enables functional testing without a physical device, improving testing efficiency and flexibility without intruding on existing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309656B_ABST
    Figure CN115309656B_ABST
Patent Text Reader

Abstract

The application discloses a function test method and device based on model simulation, equipment and medium, and relates to the field of computer testing. The method comprises the following steps: determining target proxy switch information of a target test function from a preset global configuration variable file; if the target proxy switch information is information indicating that the test switch of the target test function is in an open state, determining a current proxy mode corresponding to the target test function from the preset global configuration variable file; the proxy mode is an information collection mode or an information replacement mode; determining a target model configuration file based on a target test model, and performing function test on a target physical machine by using a target test method in the target model configuration file based on the proxy mode, and then recording the test result of the function test into the target model configuration file. The application enhances the method by the information collection mode and the information replacement mode, so as to achieve the purpose of collecting the method signature parameters and the return result and replacing the return value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer testing, and in particular to a functional testing method, apparatus, equipment, and medium based on machine model simulation. Background Technology

[0002] In the development of storage system functions, some functions are closely related to the physical machine model (such as obtaining information about the machine's CPU (central processing unit), memory, disk, and power supply). When modifying these functions, testing is often carried out on specific physical machines. However, for some historical models or models with low shipment volumes, the laboratory may not have the corresponding physical machines or may have a very small number of them.

[0003] As can be seen from the above, how to perform functional testing on the device under test when there is no device under test during the physical testing process is a problem that needs to be solved in this field. Summary of the Invention

[0004] In view of this, the purpose of this invention is to provide a functional testing method, apparatus, device, and medium based on machine model simulation, which can replace the actual physical machine for testing related functions by collecting and simulating physical machine information, thereby improving testing efficiency. The specific solution is as follows:

[0005] In a first aspect, this application discloses a functional testing method based on model simulation, including:

[0006] Determine the target agent switch information for the target test function from the preset global configuration variable file;

[0007] If the target agent switch information indicates that the test switch representing the target test function is in the on state, then the current agent mode corresponding to the target test function is determined from the preset global configuration variable file; the agent mode is either the information collection mode or the information replacement mode.

[0008] Based on the target test model, determine the target model configuration file, and based on the proxy mode, use the target test method in the target model configuration file to perform functional tests on the target physical machine, and then record the test results of the functional tests in the target model configuration file.

[0009] Optionally, determining the target model configuration file based on the target test model includes:

[0010] The signature information of the test method is determined based on the target test model;

[0011] The location of the target model's configuration file is determined based on the signature information;

[0012] The target device configuration file is obtained based on its storage location.

[0013] Optionally, determining the target agent switch information for the target test function from a preset global configuration variable file includes:

[0014] The first annotation information and the second annotation information are obtained through the preset annotation retrieval interface;

[0015] Based on the first annotation information, determine the target proxy switch information of the target test function from the preset global configuration variable file;

[0016] Accordingly, determining the current proxy mode corresponding to the target test function from the preset global configuration variable file includes:

[0017] The current proxy mode is determined from the preset global configuration variable file based on the first annotation information.

[0018] Optionally, recording the test results of the functional test into the target model configuration file includes:

[0019] The test results of the functional test are formatted as JSON, and the JSON-formatted test results are recorded in the target model configuration file.

[0020] Optionally, the step of performing functional testing on the target physical machine using the target testing method in the target model configuration file includes:

[0021] The target test method with the second annotation information is determined from the target model configuration file, and the target test method is used to perform functional testing on the target physical machine.

[0022] Optionally, the step of performing functional testing on the target physical machine based on the proxy mode using the target testing method in the target device configuration file, and then recording the test results of the functional test in the target device configuration file, includes:

[0023] Based on the proxy mode, the target physical machine is configured using the model configuration information in the target model configuration file, and the target physical machine is tested using the target test method in the target model configuration file. Then, the test results of the functional test are recorded in the target model configuration file.

[0024] Optionally, the step of performing functional testing on the target physical machine based on the proxy mode using the target testing method in the target device configuration file, and then recording the test results of the functional test in the target device configuration file, includes:

[0025] If the current proxy mode is the information collection mode, then the target physical machine is configured using the model configuration information in the target model configuration file, and the target physical machine is tested using the target test method in the target model configuration file. Then, the first target parameter, the first parameter mapping information and the first return result generated in the functional test are extracted, and the first target parameter, the first parameter mapping information and the first return result generated in the functional test are recorded in the target model configuration file.

[0026] If the current proxy mode is the information replacement mode, then the target physical machine is configured using the model configuration information in the target model configuration file, and the target physical machine is tested using the target test method in the target model configuration file. Then, the second target parameter, the second parameter mapping information, and the second return result generated in the functional test are extracted, and the target parameter, parameter mapping information, and target return result corresponding to the test method in the target model configuration file are replaced with the second target parameter, the second parameter mapping information, and the second return result.

[0027] Secondly, this application discloses a functional testing device based on model simulation, comprising:

[0028] The switch information determination module is used to determine the target agent switch information of the target test function from the preset global configuration variable file;

[0029] The proxy mode determination module is used to determine the current proxy mode corresponding to the target test function from the preset global configuration variable file if the target proxy switch information is information indicating that the test switch representing the target test function is in the on state; the proxy mode is either an information collection mode or an information replacement mode.

[0030] The functional testing module is used to determine the target model configuration file based on the target test model, and to perform functional testing on the target physical machine using the target testing method in the target model configuration file based on the proxy mode, and then record the test results of the functional test in the target model configuration file.

[0031] Thirdly, this application discloses an electronic device, including:

[0032] Memory, used to store computer programs;

[0033] A processor is used to execute the computer program to implement the aforementioned functional testing method based on machine model simulation.

[0034] Fourthly, this application discloses a computer storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned functional testing method based on machine model simulation.

[0035] This application first determines the target proxy switch information of the target test function from a preset global configuration variable file. If the target proxy switch information indicates that the test switch of the target test function is in the on state, then the current proxy mode corresponding to the target test function is determined from the preset global configuration variable file. The proxy mode is either an information collection mode or an information replacement mode. Based on the target test device model, a target device configuration file is determined, and based on the proxy mode, the target test method in the target device configuration file is used to perform functional testing on the target physical machine. Then, the test results of the functional test are recorded in the target device configuration file. In this way, the present invention can simulate testing on the target physical machine through a preset global configuration variable file and a pre-set device configuration file, and record the test results in different ways based on different proxy modes. Storing the data in a configuration file facilitates manual modification, is more flexible, and allows for device simulation testing without intruding on the original method, improving the flexibility and usability of the test. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0037] Figure 1 A flowchart of a functional testing method based on model simulation is provided for this application;

[0038] Figure 2 A flowchart of a specific functional testing method based on model simulation provided in this application;

[0039] Figure 3 An execution logic diagram provided for this application;

[0040] Figure 4 A schematic diagram of a functional testing device based on model simulation is provided in this application;

[0041] Figure 5 This application provides a structural diagram of an electronic device. Detailed Implementation

[0042] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0043] In existing technologies, for some historical models or models with low shipment volumes, the laboratory may not have the corresponding physical machines or may have a very limited number of them. Since some test functions are closely related to the physical machine, functional testing of the model under test is impossible without it. This application addresses this by collecting and simulating physical machine information to replace real physical machines for testing related functions, thereby improving testing efficiency.

[0044] This invention discloses a functional testing method based on model simulation, see [link to relevant documentation]. Figure 1 The method includes:

[0045] Step S11: Determine the target agent switch information for the target test function from the preset global configuration variable file.

[0046] In this embodiment, the preset global configuration variable file stores proxy switch information and proxy modes corresponding to different test functions.

[0047] Step S12: If the target agent switch information is information indicating that the test switch of the target test function is in the on state, then determine the current agent mode corresponding to the target test function from the preset global configuration variable file; the agent mode is information collection mode or information replacement mode.

[0048] In this embodiment, if the proxy switch information indicates that the test switch representing the target test function is in an "on" state, it means that the direct testing step can begin. If the proxy switch information indicates that the test switch representing the target test function is in a "off" state, it means that the direct testing step is currently prohibited. In some specific implementations, during simulation testing, it is preferable to set the proxy switch information to "true" so that the test switch representing the target test function is in an "on" state.

[0049] In this embodiment, after determining the target proxy switch information and proxy mode, the target proxy switch information and proxy mode will be stored in memory.

[0050] Step S13: Determine the target device configuration file based on the target test device, and perform functional testing on the target physical machine using the target testing method in the target device configuration file based on the proxy mode, and then record the test results of the functional test in the target device configuration file.

[0051] In this embodiment, determining the target device configuration file based on the target test device may include: determining the signature information of the test method based on the target test device; determining the storage location of the target device configuration file based on the signature information; and obtaining the target device configuration file based on the storage location of the target device configuration file.

[0052] In this embodiment, each test device corresponds to its own device configuration file, which stores specific device configuration information, test methods, and corresponding test results. The recording method for the output information of the test methods differs under different proxy modes.

[0053] In this embodiment, the target device configuration file is first determined based on the target test device model. Then, functional testing is performed on the target physical machine based on the target test method in the target device configuration file. Finally, the test results are recorded in different ways depending on the proxy mode. In a specific implementation, the recorded test results may include information such as: whether there are parameters, the specific parameter values, the parameter mapping relationship, and the method's return result.

[0054] In this embodiment, the target proxy switch information for the target test function is first determined from a preset global configuration variable file. If the target proxy switch information indicates that the test switch for the target test function is in an "on" state, the current proxy mode corresponding to the target test function is determined from the preset global configuration variable file. The proxy mode is either an information collection mode or an information replacement mode. A target device configuration file is determined based on the target test device, and based on the proxy mode, the target test method in the target device configuration file is used to perform functional testing on the target physical machine. The test results of the functional test are then recorded in the target device configuration file. In this way, the present invention can simulate testing on the target physical machine using a preset global configuration variable file and a pre-set device configuration file, and record the test results in different ways based on different proxy modes. Storing the data in a configuration file facilitates manual modification, provides greater flexibility, and allows for device simulation testing without intruding on existing methods, improving the flexibility and usability of the test.

[0055] Figure 2 A flowchart illustrating a specific functional testing method based on machine model simulation, provided as an embodiment of this application. See also... Figure 2 As shown, the method includes:

[0056] Step S21: Obtain the first annotation information and the second annotation information through the preset annotation acquisition interface.

[0057] Based on the first annotation information, the target agent switch information for the target test function is determined from the preset global configuration variable file.

[0058] In this embodiment, the user needs to configure the global configuration variable file, change the switch for simulation testing to True, and then add a global annotation for simulation testing to the entry point of the function to be tested, such as @TestEntry(id=00001,model="modelName"). This annotation will read the corresponding configuration information from the global configuration variable file and store its relevant information in memory.

[0059] Step S22: If the target agent switch information is information indicating that the test switch representing the target test function is in the on state, then the current agent mode is determined from the preset global configuration variable file based on the first annotation information; the agent mode is information collection mode or information replacement mode.

[0060] For a more detailed description of the process of step S22, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0061] Step S23: Determine the target model configuration file based on the target test model, and configure the target physical machine using the model configuration information in the target model configuration file based on the proxy mode.

[0062] For a more detailed description of the process of step S23, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0063] Step S24: Determine the target test method with the second annotation information from the target model configuration file, and use the target test method to perform functional testing on the target physical machine, and then record the test results of the functional test in the target model configuration file.

[0064] In this embodiment, the user needs to annotate the methods that need to be proxied with @Enhance and configure the corresponding method's return result in the target device configuration file. That is, the target device configuration file stores the output information corresponding to the target test method.

[0065] In this embodiment, the step of performing functional testing on the target physical machine using the target testing method in the target device configuration file based on the proxy mode, and then recording the test results of the functional test in the target device configuration file, may include: if the current proxy mode is an information collection mode, configuring the target physical machine using the device configuration information in the target device configuration file, testing the target physical machine using the target testing method in the target device configuration file, then extracting the first target parameter, the first parameter mapping information, and the first return result generated in the functional test, and recording the first target parameter, the first parameter mapping information, and the first return result generated in the functional test in the target device configuration file; if the current proxy mode is an information replacement mode, configuring the target physical machine using the device configuration information in the target device configuration file, testing the target physical machine using the target testing method in the target device configuration file, then extracting the second target parameter, the second parameter mapping information, and the second return result generated in the functional test, and replacing the target parameter, parameter mapping information, and target return result corresponding to the test method in the target device configuration file with the second target parameter, the second parameter mapping information, and the second return result.

[0066] In this embodiment, recording the test results of the functional test into the target model configuration file may include: formatting the test results of the functional test into JSON (i.e., JavaScript Object Notation) format, and recording the JSON-formatted test results into the target model configuration file.

[0067] This embodiment proposes two proxy modes: an information collection mode and an information replacement mode. It should be noted that these modes can enhance specified methods to collect the original method's signature parameters and return results, and replace the return value. The main execution process of the information collection mode involves the user executing the original method, capturing, formatting, and storing the relevant parameters and output information, thus achieving information collection. The main execution process of the information replacement mode involves querying the storage module based on the original method's signature and parameters. If the corresponding method's return result is found, the recorded simulated data is directly returned; otherwise, the original method is executed and the result is recorded, thus achieving data recording. Both proxy modes in this embodiment can specify the test function entry method and the method to be enhanced through annotations. By combining annotations and configuration, device simulation testing can be performed without intruding on the original method.

[0068] like Figure 3The diagram shown is an execution logic diagram proposed in this application. First, it determines whether to perform a simulation test (i.e., whether to use the information replacement mode) based on the simulation test switch (i.e., the target proxy switch information) in the simulation global configuration variable file. If so, it obtains the location of the simulation data storage according to the machine type and method signature, reads the corresponding return value from the corresponding configuration file, and outputs the return value. If no simulation test is performed (i.e., the information collection mode is used), it collects the method signature and return result, and formats and stores the result.

[0069] In this embodiment, the final step is to call the entry method to observe the output of the enhancement method and verify the functionality.

[0070] This invention can also be functionally divided into a proxy module and a storage module. The proxy module enhances the specified method by utilizing information collection and information replacement modes, mainly including record enhancement functionality implemented by the information collection mode and output enhancement functionality implemented by the information replacement mode. The storage module primarily formats and generates a configuration file for storage based on the relevant information of the proxy method (whether there are parameters, parameter mapping relationships, and the original method's return result) in the global configuration variable file and the device configuration file. Furthermore, for cases where no physical machine is available for information collection, a physical machine can be simulated by modifying the template file.

[0071] In this embodiment, first and second annotation information are obtained through a preset annotation acquisition interface. Based on the first annotation information, target proxy switch information for the target test function is determined from a preset global configuration variable file. If the target proxy switch information indicates that the test switch for the target test function is in an on state, the current proxy mode is determined from the preset global configuration variable file based on the first annotation information. The proxy mode is either an information collection mode or an information replacement mode. Then, a target device configuration file is determined based on the target test device model. Based on the proxy mode, the target physical machine is configured using the device configuration information in the target device configuration file. The target physical machine is then tested using the target test method in the target device configuration file. Finally, the test results of the functional test are recorded in the target device configuration file. In this way, the present invention can mark the original methods in the system by combining configuration and annotation, store global simulation test information and device information through configuration files, and establish proxies through marking to enhance information collection and simulated return values, thereby achieving the effect of simulated device testing.

[0072] See Figure 4 As shown in the figure, this application discloses a functional testing device based on model simulation, which may specifically include:

[0073] The switch information determination module 11 is used to determine the target agent switch information of the target test function from a preset global configuration variable file.

[0074] The proxy mode determination module 12 is used to determine the current proxy mode corresponding to the target test function from the preset global configuration variable file if the target proxy switch information is information indicating that the test switch representing the target test function is in the on state; the proxy mode is an information collection mode or an information replacement mode.

[0075] The functional testing module 13 is used to determine the target model configuration file based on the target test model, and to perform functional testing on the target physical machine using the target testing method in the target model configuration file based on the proxy mode, and then record the test results of the functional test in the target model configuration file.

[0076] In this embodiment, the target proxy switch information for the target test function is first determined from a preset global configuration variable file. If the target proxy switch information indicates that the test switch for the target test function is in an "on" state, the current proxy mode corresponding to the target test function is determined from the preset global configuration variable file. The proxy mode is either an information collection mode or an information replacement mode. A target device configuration file is determined based on the target test device, and based on the proxy mode, the target test method in the target device configuration file is used to perform functional testing on the target physical machine. The test results of the functional test are then recorded in the target device configuration file. In this way, the present invention can simulate testing on the target physical machine using a preset global configuration variable file and a pre-set device configuration file, and record the test results in different ways based on different proxy modes. Storing the data in a configuration file facilitates manual modification, provides greater flexibility, and allows for device simulation testing without intruding on existing methods, improving the flexibility and usability of the test.

[0077] In some specific embodiments, the functional testing module 13 includes:

[0078] The signature information determination unit is used to determine the signature information of the test method based on the target test model;

[0079] A location determination unit is used to determine the storage location of the target model configuration file based on the signature information;

[0080] The file determination unit is used to obtain the target model configuration file based on the storage location of the target model configuration file.

[0081] In some specific embodiments, the switch information determination module 11 includes:

[0082] The annotation information acquisition unit is used to acquire first annotation information and second annotation information through a preset annotation acquisition interface;

[0083] The proxy switch information determination module is used to determine the target proxy switch information of the target test function from a preset global configuration variable file based on the first annotation information.

[0084] In some specific embodiments, the functional testing module 13 includes:

[0085] The test method determination unit is used to determine the target test method with the second annotation information from the target model configuration file, and to perform functional testing on the target physical machine using the target test method.

[0086] In some specific embodiments, the functional testing module 13 includes:

[0087] The result recording unit is used to format the test results of the functional test into JSON format and record the JSON-formatted test results into the target model configuration file.

[0088] In some specific embodiments, the functional testing module 13 includes:

[0089] The functional testing unit is used to configure the target physical machine based on the proxy mode using the model configuration information in the target model configuration file, and to test the target physical machine using the target testing method in the target model configuration file, and then record the test results of the functional test in the target model configuration file.

[0090] In some specific embodiments, the functional testing unit includes:

[0091] The first agent mode execution unit is configured to configure the target physical machine using the model configuration information in the target model configuration file and test the target physical machine using the target test method in the target model configuration file if the current agent mode is information collection mode. Then, it extracts the first target parameter, the first parameter mapping information and the first return result generated in the functional test and records the first target parameter, the first parameter mapping information and the first return result generated in the functional test into the target model configuration file.

[0092] The second proxy mode execution unit is configured to configure the target physical machine using the model configuration information in the target model configuration file and test the target physical machine using the target test method in the target model configuration file if the current proxy mode is information replacement mode. Then, it extracts the second target parameter, the second parameter mapping information and the second return result generated in the functional test, and replaces the target parameter, parameter mapping information and target return result corresponding to the test method in the target model configuration file with the second target parameter, the second parameter mapping information and the second return result.

[0093] Furthermore, embodiments of this application also disclose an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of use of this application.

[0094] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a display screen 24, an input / output interface 25, a communication interface 26, and a communication bus 27. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the functional testing method based on machine model simulation disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0095] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 26 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0096] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it can include an operating system 221, computer programs 222, and virtual machine data 223, etc. The virtual machine data 223 can include various types of data. The storage method can be temporary storage or permanent storage.

[0097] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the model-based functional testing method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.

[0098] Furthermore, this application also discloses a computer-readable storage medium, which includes random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, magnetic disks, optical disks, or any other form of storage medium known in the art. When the computer program is executed by a processor, it implements the aforementioned functional testing method based on machine model simulation. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

[0099] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section. Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0100] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0101] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0102] The functional testing method, apparatus, equipment, and storage medium based on model simulation provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A functional testing method based on model simulation, characterized in that, include: Determine the target agent switch information for the target test function from the preset global configuration variable file; If the target agent switch information is information indicating that the test switch of the target test function is in the on state, then the current agent mode corresponding to the target test function is determined from the preset global configuration variable file; The proxy mode is either an information collection mode or an information replacement mode; Based on the target test model, the target model configuration file is determined, and based on the proxy mode, the target test method in the target model configuration file is used to perform functional tests on the target physical machine. Then, the test results of the functional tests are recorded in the target model configuration file. The step of determining the target model configuration file based on the target test model includes: The signature information of the test method is determined based on the target test model; The location of the target model's configuration file is determined based on the signature information; Obtain the target model configuration file based on its storage location; The step of determining the target agent switch information for the target test function from the preset global configuration variable file includes: The first annotation information and the second annotation information are obtained through the preset annotation retrieval interface; Based on the first annotation information, determine the target proxy switch information of the target test function from the preset global configuration variable file; Accordingly, determining the current proxy mode corresponding to the target test function from the preset global configuration variable file includes: The current proxy mode is determined from the preset global configuration variable file based on the first annotation information; The step of performing functional testing on the target physical machine using the target testing method in the target model configuration file includes: The target test method with the second annotation information is determined from the target model configuration file, and the target test method is used to perform functional testing on the target physical machine.

2. The functional testing method based on model simulation according to claim 1, characterized in that, The step of recording the test results of the functional test into the target model configuration file includes: The test results of the functional test are formatted as JSON, and the JSON-formatted test results are recorded in the target model configuration file.

3. The functional testing method based on model simulation according to claim 1 or 2, characterized in that, Based on the proxy mode, the target physical machine is functionally tested using the target testing method in the target machine configuration file, and the test results of the functional tests are then recorded in the target machine configuration file, including: Based on the proxy mode, the target physical machine is configured using the model configuration information in the target model configuration file, and the target physical machine is tested using the target test method in the target model configuration file. Then, the test results of the functional test are recorded in the target model configuration file.

4. The functional testing method based on model simulation according to claim 3, characterized in that, Based on the proxy mode, the target physical machine is functionally tested using the target testing method in the target machine configuration file, and the test results of the functional tests are then recorded in the target machine configuration file, including: If the current proxy mode is the information collection mode, then the target physical machine is configured using the model configuration information in the target model configuration file, and the target physical machine is tested using the target test method in the target model configuration file. Then, the first target parameter, the first parameter mapping information and the first return result generated in the functional test are extracted, and the first target parameter, the first parameter mapping information and the first return result generated in the functional test are recorded in the target model configuration file. If the current proxy mode is the information replacement mode, then the target physical machine is configured using the model configuration information in the target model configuration file, and the target physical machine is tested using the target test method in the target model configuration file. Then, the second target parameter, the second parameter mapping information, and the second return result generated in the functional test are extracted, and the target parameter, parameter mapping information, and target return result corresponding to the test method in the target model configuration file are replaced with the second target parameter, the second parameter mapping information, and the second return result.

5. A functional testing device based on model simulation, characterized in that, include: The switch information determination module is used to determine the target agent switch information of the target test function from the preset global configuration variable file; The proxy mode determination module is used to determine the current proxy mode corresponding to the target test function from the preset global configuration variable file if the target proxy switch information is information indicating that the test switch representing the target test function is in the on state. The proxy mode is either an information collection mode or an information replacement mode; The functional testing module is used to determine the target device configuration file based on the target test device model, and to perform functional testing on the target physical machine using the target testing method in the target device configuration file based on the proxy mode, and then record the test results of the functional test in the target device configuration file; The functional testing module includes: The signature information determination unit is used to determine the signature information of the test method based on the target test model; A location determination unit is used to determine the storage location of the target model configuration file based on the signature information; The file determination unit is used to obtain the target model configuration file based on the storage location of the target model configuration file; The switch information determination module includes: The annotation information acquisition unit is used to acquire first annotation information and second annotation information through a preset annotation acquisition interface; The proxy switch information determination module is used to determine the target proxy switch information of the target test function from a preset global configuration variable file based on the first annotation information. The proxy mode determination module is specifically used to determine the current proxy mode from a preset global configuration variable file based on the first annotation information. The functional testing module includes: The test method determination unit is used to determine the target test method with the second annotation information from the target model configuration file, and to perform functional testing on the target physical machine using the target test method.

6. An electronic device, characterized in that, It includes a processor and a memory; wherein, when the processor executes a computer program stored in the memory, it implements the functional testing method based on model simulation as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer programs are executed by a processor, they implement the functional testing method based on model simulation as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Unit test method and device, test equipment and storage medium

    CN113448853A

  • Dynamic unit test system and method based on bytecode enhancement technology

    CN113468072A