Simulation test method, device, equipment and medium
Through simulated testing methods and devices, the problem of inefficiency of IoT cloud devices in large batches, multiple devices and multiple interface scenarios is solved, and the access test of multiple devices and cloud server capability verification is realized, which improves testing efficiency and saves costs.
Patent Information
- Application Number
- CN202111449667.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In the prior art, IoT cloud devices have low efficiency through manual testing in large batches, multi-device, and multi-interface scenarios.
Provide a simulation test method and device, by receiving simulation requests, obtaining protocol types, authentication information, simulation data and verification data, using simulation scheduling strategy scheduling equipment simulation unit for authentication and data processing, encoding and encapsulating data, uploading to cloud servers through message queues, and verifying response data to obtain test results.
It realizes access testing of multiple devices, verifies cloud server capabilities, optimizes testing efficiency, saves the running-in period of access devices, and reduces manual testing costs.
Smart Images

Figure CN114116356B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of functional testing, and in particular to a simulation testing method, device, equipment and medium. Background Art
[0002] Currently, most cloud devices in the existing Internet of Things need to test all data transmission protocol ports of each connected device or various different connected devices. In a large-scale, multi-device, multi-interface device or application scenario, testers use different testing devices to conduct transmission tests one by one in a manual testing manner, resulting in low testing efficiency. Summary of the Invention
[0003] The present invention provides a simulation testing method, device, computer equipment and storage medium, which realizes the access testing of multiple devices, verifies the capabilities of the cloud server, and subsequent auxiliary service development, improving the testing efficiency.
[0004] A simulation testing method includes:
[0005] Receiving a simulation request, and obtaining the protocol type, authentication information, simulation data and verification data associated with the simulation data in the simulation request;
[0006] Using a simulation scheduling strategy to schedule a device simulation unit matching the protocol type, and authenticating the authentication information through a container in the scheduled device simulation unit to determine whether the authentication is passed;
[0007] If the authentication is passed, encoding and encapsulating the simulation data to obtain data to be reported, and inserting the data to be reported into a message queue;
[0008] Uploading the data to be reported to a cloud server through the message queue;
[0009] Receiving response data returned for the data to be reported through the message queue, and checking the response data according to the verification data to obtain a simulation test result.
[0010] A simulation testing device includes:
[0011] A receiving module, configured to receive a simulation request, and obtain the protocol type, authentication information, simulation data and verification data associated with the simulation data in the simulation request;
[0012] A scheduling module, configured to use a simulation scheduling strategy to schedule a device simulation unit matching the protocol type, and authenticate the authentication information through a container in the scheduled device simulation unit to determine whether the authentication is passed;
[0013] An encapsulation module, which is used to encode and encapsulate the simulation data to obtain the data to be reported if the authentication is passed, and insert the data to be reported into the message queue;
[0014] An upload module, which is used to upload the data to be reported to the cloud server through the message queue;
[0015] A verification module, which is used to receive the response data returned for the data to be reported through the message queue, and verify the response data according to the verification data to obtain the simulation test result.
[0016] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above simulation test method are implemented.
[0017] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the above simulation test method are implemented.
[0018] The simulation test method, device, computer device, and storage medium provided by the present invention receive a simulation request, obtain the protocol type, authentication information, simulation data, and verification data associated with the simulation data in the simulation request; use a simulation scheduling strategy to schedule a device simulation unit matching the protocol type, and authenticate the authentication information through a container in the scheduled device simulation unit to determine whether the authentication is passed; if the authentication is passed, encode and encapsulate the simulation data to obtain the data to be reported, and insert the data to be reported into the message queue; upload the data to be reported to the cloud server through the message queue; receive the response data returned for the data to be reported through the message queue, and verify the response data according to the verification data to obtain the simulation test result. Therefore, it can realize communication and testing of multiple protocols. The optimized scheduling strategy can eliminate the need to build actual test equipment and the environment of simulation nodes. As long as the protocol and function are determined, testing can be carried out through a multi-protocol intelligent simulator, which can enter the device test link in advance, save the running-in period of the access device, improve the efficiency of the access device test, realize the access test of multiple devices, verify the capabilities of the cloud server, and subsequent auxiliary service development, thus improving the test efficiency. Description of the Drawings
[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the accompanying drawings required for the description of the embodiments of the present invention. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0020] Figure 1 It is a schematic diagram of the application environment of the simulation test method in an embodiment of the present invention;
[0021] Figure 2 It is a flowchart of the simulation test method in an embodiment of the present invention;
[0022] Figure 3 It is a principle block diagram of the simulation test device in an embodiment of the present invention;
[0023] Figure 4 It is a principle block diagram of the verification module of the simulation test device in an embodiment of the present invention;
[0024] Figure 5 It is a schematic diagram of a computer device in an embodiment of the present invention. Specific embodiments
[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.
[0026] The simulation test method provided by the present invention can be applied in an application environment such as Figure 1 , where the client (computer device) communicates with the server through a network. Among them, the client (computer device) includes, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers.
[0027] In one embodiment, as Figure 2 shown, a simulation test method is provided, and its technical solution mainly includes the following steps S10 - S50:
[0028] S10, receive a simulation request, and obtain the protocol type, authentication information, simulation data, and verification data associated with the simulation data in the simulation request.
[0029] Understandably, the protocol type is a category of protocols preset for simulating access devices. The protocol types include protocol categories such as MQTT, CoAP, and LWM2M. The authentication information is information related to the transmission authentication of the simulation device or / and the simulation user authentication. For example, the authentication information is user information such as an account and a password that reflects uniqueness and privacy. The simulation data is the data transmitted by the simulation device generated by the simulation device. The verification data is the data that responds to the simulation data. The verification data can be the same as the simulation data, indicating that the cloud server has received the simulation data. The verification data can be the service feedback data corresponding to the simulation data, indicating the service data returned by the cloud server after performing corresponding operations on the simulation data.
[0030] In one embodiment, before the step S10, that is, before receiving the simulation request, it includes:
[0031] Receive a simulation data generation request, and obtain the data configuration in the simulation data generation request; wherein, the data configuration includes a data identifier, a data type, a data range, an event attribute, or / and a service attribute.
[0032] Understandably, the data identifier is the data that gives a variable a unique identifier. The data type is the type to which the data identifier belongs. The data range is the range to which the data identifier belongs. The event attribute is the encoding obtained by converting the event performed on the data identifier. The service attribute is the attribute content that defines the relevant status returned by the data identifier.
[0033] Based on the data type, randomly generate the simulation value that matches the data range.
[0034] Understandably, according to the data type, call the generator corresponding to this data type. By inputting the data range into the called generator, the simulation value that matches within the data range is generated by this generator. The simulation value is the value generated during the actual operation simulation. The generator is a model that randomly generates irregular numbers or letters.
[0035] Search for the verification data that matches both the data identifier and the simulation value from the simulation comparison table.
[0036] Understandably, the simulation comparison table stores the corresponding verification data returned for various data identifiers under different simulation values. The verification data corresponding to both the data identifier and the simulation value can be queried from the simulation comparison table.
[0037] Generate rules for the data identifier, the simulation value, the event attribute, or / and the service attribute to generate the simulation data.
[0038] Understandably, the data identifier, the analog value, the event attribute, and / or the service attribute are generated according to the rules in the format of the physical model, that is, generated according to the rules in the format of the three dimensions of attribute - event - service, to obtain the analog data.
[0039] Associate the analog data with the verification data.
[0040] The present invention realizes receiving a request for generating analog data, and obtaining the data configuration in the request for generating analog data; wherein, the data configuration includes a data identifier, a data type, a data range, an event attribute, and / or a service attribute; based on the data type, randomly generating the analog value that matches the data range; looking up the verification data that matches both the data identifier and the analog value from an analog comparison table; generating the analog data by generating rules for the data identifier, the analog value, the event attribute, and / or the service attribute; associating the analog data with the verification data. In this way, it is possible to automatically generate analog data that meets the requirements through the data configuration, and automatically find the corresponding verification data, providing a basis for the output of subsequent analog test results. Therefore, it saves the cost of manually generating analog data and verification data, improves the accuracy and correctness of analog data generation, and ensures the correctness of verification data matching.
[0041] S20: Use an analog scheduling strategy to schedule a device simulation unit that matches the protocol type, and authenticate the authentication information through a container in the scheduled device simulation unit to determine whether the authentication is successful.
[0042] Understandably, the simulation scheduling policy is a device simulator that matches scheduling resources, that is, a device simulation unit that is idle and has the same or similar protocol as the previous simulation. A flag bit is reserved in the storage area of each device simulation unit to store the protocol type of the previous simulation. By comparing this flag bit with the protocol type of the current simulation, the similarity can be determined. The process of determining the similarity can be as follows: Each protocol type corresponds to a flag bit with a digital number. This flag bit can be composed of multiple digits. The cosine similarity algorithm can be used to calculate the cosine value of the flag bit corresponding to the previous simulation protocol and the flag bit corresponding to the current simulation protocol, and map this cosine value to the similarity value between the two. Thus, the process of scheduling the device simulation unit that matches the protocol type is as follows: First, detect the operation flags in each device simulation unit, and determine whether the corresponding device simulation unit is idle through this operation flag, and obtain the device simulation unit corresponding to the idle operation flag; Second, compare the protocol type with the flag bits of each idle device simulation unit to find the similarity; Finally, sort all similarities, and determine the device simulation unit corresponding to the flag bit with the maximum similarity as the device simulator that is scheduled to match the protocol type. When the similarity is 100%, it indicates that the two are the same protocol. Thus, by scheduling the device simulation unit that matches the protocol type, the deployment time can be reduced because the plugins or components deployed by the device simulation units with high similarity are similar, avoiding the situation of deployment errors or long deployment times. The device simulation unit builds a corresponding independent container, and through this container, each edge node in the device simulation unit can be managed. The container in the device simulation unit can implement the authentication function. The authentication process is a process of judging whether the information related to transmission authentication or / and simulated user authentication in the authentication information can pass.
[0043] In one embodiment, in step S20, that is, authenticating the authentication information through the container in the scheduled device simulation unit to determine whether the authentication is passed, includes:
[0044] Allocate edge nodes corresponding to the protocol type through the container in the device simulation unit.
[0045] Understandably, the container is a container based on the Docker architecture built in the device simulation unit. Under this container, there are multiple edge nodes (Agents) connected to the device simulation unit, which manage the container of the device simulation unit. Different protocol types are built into different edge nodes, with one protocol type corresponding to one edge node. The allocation process is to query the edge node consistent with the protocol type in the container management list of the container, and confirm the edge node consistent with the protocol type as the allocated edge node.
[0046] Authenticate the authentication information through the edge node to determine whether the authentication is passed.
[0047] Understandably, the authentication process is to query in the authentication list whether there is a consistent result with the authentication information. If no consistent result is found, it is determined that the authentication fails. If a consistent result is found, it is determined that the authentication passes.
[0048] The present invention realizes the allocation of edge nodes corresponding to the protocol type through the container in the device simulation unit; authenticates the authentication information through the edge node to determine whether the authentication is passed. In this way, multiple edge nodes are managed through the container, and the authentication operation of the authentication information is completed through the edge node, so that an authentication strategy can be matched for different protocol types, with strong pertinence. Therefore, the idea of the container can be used to manage multiple edge nodes in multiple device simulation units, improving the convenience of simulation testing and reducing the time for building the edge node environment.
[0049] S30. If the authentication is passed, encode and encapsulate the simulation data to obtain the data to be reported, and insert the data to be reported into the message queue.
[0050] Understandably, if the authentication is passed, it means that the simulated device that passes the authentication can communicate or transfer data with the edge node in the device simulation unit. The encoding is the process of encoding the simulation data according to the format of the physical model, that is, encoding according to the three dimensions of attribute - event - service. The encapsulation is the process of converting the encoded simulation data according to the protocol type to obtain the data to be reported. The data to be reported is the data that needs to be reported to the cloud server, that is, the data reported by the simulated device to the cloud server. The message queue is a queue used to report to the cloud server, and the message queue sends the messages in the queue according to the first-in, first-out rule.
[0051] In one embodiment, in step S30, that is, encoding and encapsulating the simulation data to obtain the data to be reported and inserting the data to be reported into the message queue includes:
[0052] Model-encode the simulation data according to the format of the physical model to obtain encoded data.
[0053] Understandably, the format of the physical model is a format of three dimensions: attribute - event - service. For example, for the simulation data of the manhole cover status, when model-encoding the simulation data, the process is to extract the leading preset number of digits of the simulation data as the attribute, extract the last preset number of digits of the simulation data as the service, and use the remaining digits in the middle as the event, so as to obtain the encoded data. The attribute is the manhole cover identification, the manhole cover data type, and the manhole cover data range; the event is the manhole cover initialization, setting the timed manhole cover status collection or the manhole cover closing; and the service is the timed collection interval.
[0054] Perform protocol encapsulation on the encoded data according to the protocol type to obtain the data to be reported.
[0055] Understandably, different protocol types correspond to different encapsulation code templates. Obtain the encapsulation code template corresponding to the protocol type. The process of protocol encapsulation is a processing process of filling the input encoded data according to the obtained encapsulation code template, and filling the attributes, events, and services in the encoded data into the corresponding positions in the encapsulation code.
[0056] Send the data to be reported to the message queue corresponding to the physical model topic corresponding to the encoded data.
[0057] Understandably, the physical model topic is the content of dividing the topic type according to the attributes in the physical model. Preset the corresponding relationship between each attribute and each physical model topic. Each physical model topic corresponds to a message queue. Send all the data related to the encoded data corresponding to the physical model topic to the corresponding message queue, and then send it out from the message queue, so as to send the data to be reported to this message queue, and through this message queue, it can be reported to the corresponding cloud server.
[0058] The present invention realizes model-encoding the simulation data according to the format of the physical model to obtain encoded data; performing protocol encapsulation on the encoded data according to the protocol type to obtain the data to be reported; and sending the data to be reported to the message queue corresponding to the physical model topic corresponding to the encoded data. In this way, the simulation data can be encoded according to the structure of the physical model and automatically encapsulated according to the protocol type, reducing the workload of manual coding and encapsulation and improving the efficiency of simulation testing.
[0059] S40, upload the data to be reported to the cloud server through the message queue.
[0060] Understandably, it is uploaded to the cloud server in a subscription manner through a message queue. The cloud server can be the server device of the Internet of Things platform, which is a platform server for managing all access devices. The subscription method is that a message queue corresponding to a thing model topic is reported to the cloud server that has subscribed to this thing model topic. Only the cloud servers that have subscribed to the same thing model topic can receive the data reported by the corresponding message queue, and only the message queues that have subscribed to the same thing model topic can receive the data sent by the cloud server.
[0061] S50. Receive the response data returned for the data to be reported through the message queue, and check the response data according to the verification data to obtain a simulation test result.
[0062] Understandably, after receiving the response data returned by the cloud server after receiving the data to be reported through the message queue, obtain the response data in a subscription manner, and check the verification data and the response data to determine whether they are consistent. If they are consistent, it is determined that the simulation test result is qualified; if they are inconsistent, it is determined that the simulation test result is unqualified. The simulation test result can indicate whether the simulation data in the simulation request is tested qualified, so as to simulate whether the multi-protocol transmission of the access device meets the test requirements.
[0063] The present invention realizes receiving a simulation request, obtaining the protocol type, authentication information, simulation data and verification data associated with the simulation data in the simulation request; using a simulation scheduling strategy to schedule a device simulation unit matching the protocol type, and authenticating the authentication information through a container in the scheduled device simulation unit to determine whether the authentication is passed; if the authentication is passed, encoding and encapsulating the simulation data to obtain data to be reported, and inserting the data to be reported into a message queue; uploading the data to be reported to the cloud server through the message queue; receiving the response data returned for the data to be reported through the message queue, and checking the response data according to the verification data to obtain a simulation test result. Therefore, it can realize the communication and testing of multiple protocols. The optimized scheduling strategy can eliminate the need to build actual test equipment and the environment of simulation nodes. As long as the protocol and function are determined, it can be tested through a multi-protocol intelligent simulator, which can enter the test link of the device in advance, save the running-in period of the access device, improve the test efficiency of the access device, realize the access test of multiple devices, verify the capabilities of the cloud server, and subsequent auxiliary service development, thus improving the test efficiency.
[0064] In one embodiment, in step S50, that is, checking the response data according to the verification data to obtain a simulation test result includes:
[0065] The edge node performs protocol decoding corresponding to the protocol type on the response data to obtain decoded data.
[0066] Understandably, the protocol decoding is the inverse process of protocol encapsulation, that is, the response data is removed according to the encapsulation code template corresponding to the protocol type, the content identical to the encapsulation code template is removed, and the content of attributes, events, and services is retained and recorded as the decoded data.
[0067] Perform physical model decoding on the decoded data to decode the return data.
[0068] Understandably, the physical model decoding is the inverse process of encoding according to the format of the physical model, so as to decode the return data.
[0069] Compare the return data with the verification data to obtain the simulation test result.
[0070] Understandably, by using the string comparison method, the coincidence degree between the return data and the verification data is compared. If all or some of the characters between the return data and the verification data coincide, the simulation test result is output according to the coincidence degree. That is, when all the characters between the return data and the verification data coincide, it is determined that the simulation test result is passed. When some of the characters between the return data and the verification data coincide, the non-coincident character part is compared with the allowable tolerance range in the verification data to determine whether the non-coincident character part falls within the allowable tolerance range in the verification data. If it falls within the allowable tolerance range, it is determined that the simulation test result is passed. If it does not fall within the allowable tolerance range, it is determined that the simulation test result is not passed. If none of the characters between the return data and the verification data coincide, it is determined that the simulation test result is not passed.
[0071] The present invention realizes protocol decoding corresponding to the protocol type on the response data through an edge node to obtain decoded data; performing physical model decoding on the decoded data to decode the return data; comparing the return data with the verification data to obtain the simulation test result. In this way, the corresponding content is automatically decoded through protocol decoding, and the truly returned return data can be decoded through physical model decoding, and the simulation test result is automatically compared. Therefore, the process of manual decoding and checking is not required, the simulation test efficiency is improved, and the simulation test cost is saved.
[0072] In an embodiment, after step S20, that is, after determining whether the authentication is passed, it includes:
[0073] If the authentication fails, return an authentication failure result through the container, and use the authentication failure result as the simulation test result corresponding to the simulation request.
[0074] Understandably, if the authentication fails, return an authentication failure result through the container. The authentication failure result is the result of the prompt content corresponding to the option of failed authentication, and this authentication failure result is returned as the simulation test result.
[0075] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0076] In one embodiment, a simulation test device is provided, which corresponds one-to-one with the simulation test method in the above embodiment. As Figure 3 shown, the simulation test device includes a receiving module 11, a scheduling module 12, a packaging module 13, an uploading module 14, and a verification module 15. The detailed description of each functional module is as follows:
[0077] The receiving module 11 is used to receive a simulation request and obtain the protocol type, authentication information, simulation data, and verification data associated with the simulation data in the simulation request;
[0078] The scheduling module 12 is used to apply a simulation scheduling strategy to schedule a device simulation unit that matches the protocol type, and authenticate the authentication information through the container in the scheduled device simulation unit to determine whether the authentication is passed;
[0079] The packaging module 13 is used to, if the authentication is passed, encode and package the simulation data to obtain data to be reported, and insert the data to be reported into a message queue;
[0080] The uploading module 14 is used to upload the data to be reported to a cloud server through the message queue;
[0081] The verification module 15 is used to receive response data returned for the data to be reported through the message queue, and verify the response data according to the verification data to obtain a simulation test result.
[0082] In one embodiment, as Figure 4 shown, the verification module 15 includes:
[0083] The first decoding unit 51 is used to perform protocol decoding corresponding to the protocol type on the response data through an edge node to obtain decoded data;
[0084] A second decoding unit 52, configured to perform physical model decoding on the decoded data to decode return data;
[0085] A comparison unit 53, configured to compare the return data with the verification data to obtain the simulation test result.
[0086] For the specific limitations of the simulation test device, reference can be made to the limitations of the simulation test method in the foregoing text, which will not be elaborated herein. Each module in the above simulation test device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor in the computer device in the form of hardware or independent of it, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0087] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 5 shown. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a simulation test method.
[0088] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the simulation test method in the above embodiment.
[0089] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, it implements the simulation test method in the above embodiment.
[0090] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided by the present invention can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0091] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0092] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A simulation test method, characterized in that, Including: Receiving a simulation request, obtaining the protocol type, authentication information, simulation data, and verification data associated with the simulation data in the simulation request; Applying a simulation scheduling strategy to schedule a device simulation unit matching the protocol type, and authenticating the authentication information through a container in the scheduled device simulation unit to determine whether the authentication is passed; If the authentication is passed, encoding and encapsulating the simulation data to obtain data to be reported, and inserting the data to be reported into a message queue; Uploading the data to be reported to a cloud server through the message queue; Receiving response data returned for the data to be reported through the message queue, and checking the response data according to the verification data to obtain a simulation test result; The encoding and encapsulating the simulation data to obtain data to be reported, and inserting the data to be reported into a message queue includes: Encoding the simulation data in the format of a physical model to obtain encoded data; the format of the physical model is a format with three dimensions of attribute - event - service; wherein, the process of the model encoding is to extract a preset number of leading digits of the simulation data as attributes, extract the last preset number of digits of the simulation data as services, and take the remaining digits in the middle as events, so as to obtain the encoded data; Performing protocol encapsulation on the encoded data according to the protocol type to obtain the data to be reported; wherein, different protocol types correspond to different encapsulation code templates, obtaining the encapsulation code template corresponding to the protocol type, and the process of the protocol encapsulation is to fill the input encoded data according to the obtained encapsulation code template, and fill the attributes, events, and services in the encoded data at the corresponding positions in the encapsulation code; Sending the data to be reported to the message queue corresponding to the physical model topic corresponding to the encoded data; wherein, each physical model topic corresponds to a message queue, sending the data to be reported to this message queue, and the data can be reported to the corresponding cloud server through this message queue.
2. The simulation test method according to claim 1, characterized in that, The authenticating the authentication information through a container in the scheduled device simulation unit to determine whether the authentication is passed includes: Allocating an edge node corresponding to the protocol type through a container in the device simulation unit; Authenticating the authentication information through the edge node to determine whether the authentication is passed.
3. The simulation test method according to claim 1, characterized in that, The checking the response data according to the verification data to obtain a simulation test result includes: Performing protocol decoding corresponding to the protocol type on the response data through an edge node to obtain decoded data; Performing physical model decoding on the decoded data to decode the returned data; Comparing the returned data with the verification data to obtain the simulation test result.
4. The simulation test method according to claim 1, characterized in that, After determining whether the authentication is passed, it includes: If the authentication fails, returning an authentication failure result through the container, and using the authentication failure result as the simulation test result corresponding to the simulation request.
5. The simulation test method according to claim 1, characterized in that, Before receiving the simulation request, it includes: Receive a simulation data generation request and obtain the data configuration in the simulation data generation request; wherein, the data configuration includes a data identifier, a data type, a data range, an event attribute, and a service attribute; Based on the data type, randomly generate a simulation value that matches the data range; Search for the verification data that matches both the data identifier and the simulation value from the simulation comparison table; Generate the simulation data by performing rule generation on the data identifier, the simulation value, the event attribute, and the service attribute; Associate the simulation data with the verification data.
6. A simulation test device, characterized in that, Include: A receiving module, configured to receive a simulation request, and obtain a protocol type, authentication information, simulation data, and verification data associated with the simulation data in the simulation request; A scheduling module, configured to use a simulation scheduling strategy to schedule a device simulation unit that matches the protocol type, and authenticate the authentication information through a container in the scheduled device simulation unit to determine whether the authentication is passed; An encapsulation module, configured to, if the authentication is passed, encode and encapsulate the simulation data to obtain data to be reported, and insert the data to be reported into a message queue; An upload module, configured to upload the data to be reported to a cloud server through the message queue; A verification module, configured to receive response data returned for the data to be reported through the message queue, and verify the response data according to the verification data to obtain a simulation test result; The encoding and encapsulating the simulation data to obtain data to be reported, and inserting the data to be reported into a message queue includes: Encoding the simulation data in the format of the physical model to obtain encoded data; the format of the physical model is a format of three dimensions of attribute - event - service; wherein, the process of the model encoding is to extract a preset number of leading digits of the simulation data as attributes, extract the last preset number of digits of the simulation data as services, and use the remaining digits in the middle as events, so as to obtain the encoded data; Performing protocol encapsulation on the encoded data according to the protocol type to obtain the data to be reported; wherein, different protocol types correspond to different encapsulation code templates, obtain the encapsulation code template corresponding to the protocol type, and the process of the protocol encapsulation is to fill the input encoded data according to the obtained encapsulation code template, and fill the attributes, events, and services in the encoded data at the corresponding positions in the encapsulation code; Send the data to be reported to the message queue corresponding to the physical model topic corresponding to the encoded data; wherein, each physical model topic corresponds to a message queue, and send the data to be reported to this message queue, and it can be reported to the corresponding cloud server through this message queue.
7. The simulation test device according to claim 6, wherein, The verification module includes: A first decoding unit, configured to perform protocol decoding corresponding to the protocol type on the response data through an edge node to obtain decoded data; A second decoding unit, configured to perform physical model decoding on the decoded data to decode the returned data; A comparison unit, configured to compare the returned data with the verification data to obtain the simulation test result.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the computer program, the simulation test method according to any one of claims 1 to 5 is implemented.
9. A computer-readable storage medium storing a computer program, wherein, When the computer program is executed by the processor, the simulation test method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
APP test simulation system and Internet of Things simulation test method
CN113162823A