Modbus communication automatic test method and device of controller and computer equipment
Through automated testing methods, the existing Modbus communication test problems are solved, unreliable results and low coverage, and efficient and reliable Modbus communication test is achieved.
Patent Information
- Application Number
- CN202411661820.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-02-14
AI Technical Summary
Existing Modbus communication tests require manual execution, resulting in low test efficiency, low reliability of results, low test coverage, and inability to effectively test the reliability and stability of communication.
Provides a controller's Modbus communication automated testing method, which can generate test data by reading configuration parameters, automatically connect to the controller under test, send test data, analyze test results, and generate test reports.
It improves testing efficiency and coverage, reduces manual errors, realizes fully automated testing, and improves the reliability and stability of Modbus communication functions.
Smart Images

Figure CN119449647A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Modbus communication testing of industrial control systems, and in particular to a Modbus communication automation testing method, device and computer equipment for a controller. Background Art
[0002] With the development of science and technology, the iteration speed of industrial control systems has accelerated. As one of the most widely used communication protocols in the industrial field, the need for Modbus communication function testing has also increased.
[0003] The current Modbus communication test requires testers to use Modbus simulation software to connect to the controller, simulate the server or client, build a test environment, manually execute test cases, and manually judge the test results. The entire test process has the following disadvantages:
[0004] (1) Low test efficiency: Manually executing test cases one by one is slow and inefficient.
[0005] (2) The reliability of test results is not high: When using manual methods to determine test results, there is a possibility of manual errors, which leads to unreliable test results.
[0006] (3) Low test coverage: Manual testing can only select part of the test data for testing, and the test data coverage is low.
[0007] (4) The reliability and stability of Modbus communication cannot be tested: The reliability and stability of Modbus communication functions cannot be tested manually for a long time. Summary of the invention
[0008] Based on this, it is necessary to provide a Modbus communication automation testing method, device, computer equipment, computer-readable storage medium and computer program product for a controller that can improve test coverage, efficiency and reliability in response to the above technical problems.
[0009] In a first aspect, the present application provides a Modbus communication automation test method for a controller. The method comprises:
[0010] Read configuration parameters to obtain test connection parameters, test instance parameters of test content, and test time parameters;
[0011] Connecting with the controller under test according to the test connection parameters;
[0012] Generate test data according to the test instance parameters and Modbus communication protocol content;
[0013] Sending the test data to the controller under test according to the test time parameter, and having the controller under test perform the test according to the test data to obtain test result data;
[0014] Compare the test result data with the expected result data to obtain a test analysis result;
[0015] A test report is generated according to the test analysis results.
[0016] In one embodiment, generating test data according to the test instance parameters and Modbus communication protocol content includes:
[0017] According to the Modbus communication protocol content, the test instance parameters are parsed to generate a random number within the range specified by the corresponding protocol;
[0018] The test data is generated by assembling the metadata specified by the protocol of the communication protocol data and the random number.
[0019] In one embodiment, according to the Modbus communication protocol content, the test instance parameters are parsed to generate a random number within the range specified by the corresponding protocol, including:
[0020] According to the Modbus communication protocol content, the test instance parameters are parsed to determine the test mode, where the test mode includes a server mode and a client mode;
[0021] Determine corresponding data generation configuration parameters according to the test mode;
[0022] Configuration parameters are generated according to the data, and random numbers are generated within the range specified by the corresponding protocol.
[0023] In one embodiment, the test time parameter includes a test time and a preset sending frequency; the test data is sent to the controller under test according to the test time parameter, and the controller under test performs a test according to the test data to obtain test result data, including:
[0024] The test data and the test time are sent to the controller according to a preset sending frequency, and the controller under test performs the test according to the test data within the test time to obtain the test result data.
[0025] In one embodiment, generating a test report according to the test analysis result includes:
[0026] Fill the test content and the test results into the corresponding report generation template to generate a test report.
[0027] In one embodiment, the method comprises:
[0028] Acquire configuration parameters, the configuration parameters including the test connection parameters, test instance parameters and test time parameters;
[0029] Verify the legality and correctness of the configuration parameters;
[0030] If the configuration parameters are verified to be abnormal, an abnormal reminder is output;
[0031] If the configuration parameter verification passes, the configuration parameter is stored.
[0032] In a second aspect, the present application also provides a Modbus communication automation test device for a controller. The device comprises:
[0033] The parameter acquisition module is used to read the configuration parameters, obtain the test connection parameters, the test instance parameters of the test content, and the test time parameters;
[0034] A connection module, used for connecting with the controller under test according to the test connection parameters;
[0035] A test data generation module, used to generate test data according to the test instance parameters and Modbus communication protocol content;
[0036] A test module, used for sending the test data to the controller under test according to the test time parameter, and the controller under test performs the test according to the test data to obtain test result data;
[0037] An analysis module, used to compare the test result data with the expected result data to obtain a test analysis result;
[0038] A report generation module is used to generate a test report based on the test analysis results.
[0039] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the Modbus communication automation test method for the controller of the above-mentioned embodiments are implemented.
[0040] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the Modbus communication automation test method for the controller of each of the above embodiments.
[0041] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the Modbus communication automation test method for the controller of the above-mentioned embodiments are implemented.
[0042] The Modbus communication automation test method, device, computer equipment, storage medium and computer program product of the above controller can automatically generate test data according to the Modbus communication protocol, covering all possible test data, which is more comprehensive and more automated than the data covered by traditional manual testing. At the same time, by flexibly configuring the test time parameters, the test can be fully automated without manual intervention, saving manpower and material resources, and improving the reliability and stability of the test Modbus communication function. Furthermore, the method also automatically collects, compares and analyzes the test result data, reduces the mistakes of manual comparison and analysis, improves the accuracy of the test results, and automatically generates a test report. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A schematic diagram of a Modbus communication automation test system for a controller in one embodiment;
[0044] Figure 2 A schematic diagram of a flow chart of a Modbus communication automation test method for a controller in one embodiment;
[0045] Figure 3 It is a structural block diagram of a Modbus communication automatic test device of a controller in one embodiment;
[0046] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] A Modbus communication automatic test system for a controller, such as Figure 1As shown, it includes a Modbus communication automation test device 101 and a controller 103. The Modbus communication automation test device 101 and the controller can be connected in a TCP connection mode or an RTU connection mode. Specifically, the Modbus communication automation test device 101 performs a test through the following steps: reading configuration parameters, obtaining test connection parameters, test instance parameters of the test content, and test time parameters; connecting with the controller under test according to the test connection parameters; generating test data according to the test instance parameters and the Modbus communication protocol content; sending the test data to the controller under test according to the test time parameters, and the controller under test performs the test according to the test data to obtain test result data; comparing the test result data with the expected result data to obtain a test analysis result; generating a test report according to the test analysis result.
[0049] The Modbus communication automation test system using this controller has the following technical effects:
[0050] (1) Improve test efficiency and coverage
[0051] The system can automatically generate test data according to the Modbus communication protocol, covering all possible test data. The data covered is more comprehensive than that of traditional manual testing, with a higher degree of automation and a simpler method.
[0052] (2) Improve test applicability
[0053] The system can flexibly configure the instruction sending interval and test time, so that the test can be performed fully automatically without human intervention, saving manpower and material resources and improving the reliability and stability of the test Modbus communication function.
[0054] (3) Improve test accuracy
[0055] The system automatically collects, compares and analyzes test result data, reduces human errors in comparison and analysis, improves the accuracy of test results, and automatically generates test reports.
[0056] A Modbus communication automation test method for a controller is applied to Figure 1 The Modbus communication automation test device 101 shown in FIG. Figure 2 As shown, the method includes:
[0057] Step 201, read configuration parameters, obtain test connection parameters, test instance parameters of test content, and test time parameters.
[0058] Specifically, configuration parameters are obtained by reading the configuration file. The configuration parameters include test connection parameters, test instance parameters of the test content, and test time parameters. Among them, the test connection parameters, data generation configuration parameters, and transmission frequency can be manually configured in advance and stored in the form of a configuration file.
[0059] The test connection parameters are used to realize the connection between the Modbus communication automation test device 101 and the controller under test 103 .
[0060] Among them, the test instance parameters are used to generate test data for each test content. Test instance data for different test contents can be pre-configured. It can be understood that Modbus communication adopts a master-slave architecture. A master device can communicate with multiple slave devices, including client and server modes. The test content includes data blocks with four output types: coils, discrete inputs, holding registers, and input registers when communicating in two modes. The bit numbers that the controller needs to communicate include BOOL, INT, UINT, SINT, USINT, DINT, UDINT, WORD, DEORD, REAL, LREAL and other data types. The data bit rules include word conversion, intra-word conversion, byte conversion and no conversion. All roles, data block types, bit number data types, data bit rules, and communication commands need to be covered during testing.
[0061] Among them, the test time parameter is used to control the test to be completed within the specified time range.
[0062] Step 202: Connect to the controller under test according to the test connection parameters.
[0063] Specifically, the test connection parameters include parameters such as the address of the controller under test, etc. The Modbus communication automation test device 101 establishes a connection with the controller under test according to the test connection parameters to achieve communication.
[0064] Step 203, generating configuration parameters and Modbus communication protocol content according to the data, and generating test data.
[0065] Specifically, the Modbus communication automatic testing device 101 automatically generates test data according to the Modbus communication protocol content and test instance parameters.
[0066] Step 204: sending the test data to the controller under test according to the test time parameter, and having the controller under test perform a test according to the test data to obtain test result data.
[0067] Specifically, the Modbus communication automation test device 101 sends the test data to the controlled controller according to the test time parameter. The controller performs the test according to the test data to obtain the test result data.
[0068] Step 205: Compare the test result data with the expected result data to obtain a test analysis result.
[0069] Specifically, the Modbus communication automation test device 101 records the test content data of each use case, and compares the read and received controller data with the expected result data of the communication protocol stored locally to see whether they are consistent, thereby determining the test result.
[0070] Specifically, the Modbus communication automation test device 101 collects data from various modules, including controller data, and then performs data cleaning, extraction, format conversion and other processing on the data. The collected and processed data is compared and analyzed to see whether it is consistent with the local expected result data, and a final judgment result is given.
[0071] Step 206: Generate a test report based on the test analysis results.
[0072] Specifically, the judgment result of the data analysis and the test content are filled into the corresponding report generation template, and a corresponding test report is generated.
[0073] The Modbus communication automation test method of the controller can automatically generate test data according to the Modbus communication protocol, covering all possible test data, which is more comprehensive and more automated than the data covered by traditional manual tests. At the same time, by flexibly configuring the test time parameters, the test can be fully automated without manual intervention, saving manpower and material resources, and improving the reliability and stability of the test Modbus communication function. Furthermore, the method also automatically collects, compares and analyzes the test result data, reduces the mistakes of manual comparison and analysis, improves the accuracy of the test results, and automatically generates a test report.
[0074] In another embodiment, the test data is generated according to the test instance parameters and the Modbus communication protocol content, including: parsing the test instance parameters according to the Modbus communication protocol content to generate a random number within the range specified by the corresponding protocol; assembling the protocol-specified metadata of the communication protocol data and the random number to generate the test data.
[0075] Specifically, mainly based on the Modbus communication protocol content and test case parameters, random numbers within the range specified by the protocol are generated, and then according to these random numbers, the protocol part metadata + random number data are assembled into a complete protocol data according to the specifications of the communication protocol data in the test data generation module using program code to automatically generate test data. For different test contents, the method of generating test data is the same. For example, the operation of coils and holding registers, the composition of the test data is through the coil, the message header of the discrete input data frame structure, the function code + data (such as 0 or 1 for coils, [0, 65535] for holding registers), where the data part is automatically generated by the program with random numbers and the number of times the data is generated can be configured.
[0076] Specifically, according to the communication protocol rules, the configuration in the local configuration file is parsed to generate random numbers within the range required by the corresponding protocol, and then according to the communication protocol data specifications, the metadata + random data required by the protocol are constructed to simulate and generate different data, including coils, discrete inputs, holding registers, and input registers. The data frame consists of a message header + function code + data (random numbers generated by the program). The difference between these four different data lies in the function code and data part of the data frame structure.
[0077] In this embodiment, test data can be automatically generated according to the Modbus communication protocol to cover all possible test data. The data covered is more comprehensive and the degree of automation is higher than that of traditional manual testing.
[0078] In another embodiment, according to the Modbus communication protocol content, the test instance parameters are parsed to generate a random number within the range specified by the corresponding protocol, including: according to the Modbus communication protocol content, the test instance parameters are parsed to determine a test mode, the test mode including a server mode and a client mode; according to the test mode, corresponding data generation configuration parameters are determined; according to the data generation configuration parameters, a random number within the range specified by the corresponding protocol is generated.
[0079] Specifically, the test instance parameters of each test content of each test mode are configured, the test mode is determined according to the test instance parameters, and each test mode is configured with corresponding data generation configuration parameters, which are used to generate random numbers within the range specified by the corresponding protocol. In this way, it is possible to automatically generate test data of test contents of different test modes according to the Modbus communication protocol, covering all possible test data.
[0080] In another embodiment, the test time parameters include test time and a preset sending frequency; sending the test data to the controller under test according to the test time parameters, and the controller under test performing a test according to the test data to obtain test result data, includes: sending the test data and the test time to the controller according to the preset sending frequency, and the controller under test performing a test according to the test data within the test time to obtain test result data.
[0081] The sending frequency is used to define the time interval for the Modbus communication automation test device 101 to send test data to the controller under test. The test time is used to define the total duration of executing the test. In this way, the instruction sending interval and the test time can be flexibly configured to realize the automatic execution of the test without manual intervention, saving manpower and material resources.
[0082] In one embodiment, generating a test report according to the test analysis result includes:
[0083] Fill the test content and the test analysis results into the corresponding report generation template to generate a test report.
[0084] Specifically, according to the test requirements, configure the corresponding test report template, including test summary, test environment, test results, test coverage, etc. Fill the processed data into the report template. This includes inserting specific data such as test results and indicators into the corresponding positions of the template.
[0085] In another embodiment, the generated report can be stored in a designated location for subsequent review and management, or can be sent to a designated mailbox via email.
[0086] In another embodiment, the Modbus communication automation test method of the controller also includes: obtaining configuration parameters, the configuration parameters including the test connection parameters, the test instance parameters and the test time parameters; verifying the legality and correctness of the configuration parameters; if the configuration parameters are verified to be abnormal, outputting an abnormal reminder; if the configuration parameters pass the verification, storing the configuration parameters.
[0087] Specifically, the user configures the parameters and stores all the parameters in the configuration file for centralized management and updating. For the parameters configured by the user, the legality and correctness of the parameters are further verified. If there is an abnormality in the parameters, an exception is thrown and the subsequent process is interrupted. If the verification passes, the configuration parameters are stored to ensure security and persistent storage.
[0088] Compared with the existing manual testing method, the Modbus communication automation testing method of the controller of the present application can automatically generate test data and has a higher coverage rate. In addition, the existing testing method relies on manual testing and needs to execute test cases one by one, while the testing method of the present application uses automated code execution and is more efficient. The existing testing method can only rely on manual comparison and analysis for test result data, and the test report can only be written manually; the testing method of the present application uses automatic comparison and analysis data, and automatically generates corresponding test reports to improve test efficiency and reliability. The testing method of the present application improves the reliability and stability of the Modbus test by automatic long-term testing and adjusting the test instruction sending interval.
[0089] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0090] Based on the same inventive concept, the embodiment of the present application also provides a Modbus communication automation test device for a controller for implementing the Modbus communication automation test method for the controller involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the Modbus communication automation test device for one or more controllers provided below can be referred to the limitations of the Modbus communication automation test method for the controller above, and will not be repeated here.
[0091] In one embodiment, Figure 3 As shown, a Modbus communication automation test device 101 of a controller is provided, comprising:
[0092] The parameter acquisition module 302 is used to read the configuration parameters, and acquire the test connection parameters, the test instance parameters of the test content, and the test time parameters.
[0093] The connection module 304 is used to connect to the controller under test according to the test connection parameters.
[0094] The test data generating module 306 is used to generate test data according to the test instance parameters and Modbus communication protocol content.
[0095] The test module 308 is used to send the test data to the controller under test according to the test time parameter, and the controller under test executes the test according to the test data to obtain test result data.
[0096] The analysis module 310 is used to compare the test result data with the expected result data to obtain a test analysis result.
[0097] The report generating module 312 is used to generate a test report according to the test analysis result.
[0098] In one embodiment, the test module 308 parses the test instance parameters according to the Modbus communication protocol content, generates a random number within the range specified by the corresponding protocol, and assembles the protocol-specified metadata of the communication protocol data and the random number to generate the test data.
[0099] In another embodiment, the test module 308 parses the test instance parameters according to the Modbus communication protocol content, determines the test mode, and the test mode includes a server mode and a client mode; determines the corresponding data generation configuration parameters according to the test mode; and generates a random number within the range specified by the corresponding protocol according to the data generation configuration parameters.
[0100] In another embodiment, the test time parameter includes the test time and a preset sending frequency. The test module is used to send the test data and the test time to the controller according to the preset sending frequency, and the controller under test performs the test according to the test data within the test time to obtain the test result data.
[0101] In another embodiment, the report generation module 312 is used to fill the test content and the test analysis results into a corresponding report generation template to generate a test report.
[0102] In another embodiment, a parameter acquisition module is used to obtain configuration parameters, which include the test connection parameters, test instance parameters and test time parameters; verify the legality and correctness of the configuration parameters; if the configuration parameters are verified to be abnormal, output an abnormal reminder; if the configuration parameters pass the verification, store the configuration parameters.
[0103] Each module in the Modbus communication automation test device of the controller can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0104] In one embodiment, a computer device is provided, which may be a terminal, and is used as a Modbus communication automation test device as a controller, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a Modbus communication automation test method of a controller is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0105] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0106] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, steps of a Modbus communication automation test method for a controller are implemented.
[0107] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of a Modbus communication automation test method for a controller are implemented.
[0108] In one embodiment, a computer program product is provided, comprising a computer program, which implements the steps of a Modbus communication automation test method for a controller when the computer program is executed by a processor.
[0109] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and 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-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0110] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0111] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A Modbus communication automation test method for a controller, characterized in that: The method comprises: Read configuration parameters to obtain test connection parameters, test instance parameters of test content, and test time parameters; Connecting with the controller under test according to the test connection parameters; Generate test data according to the test instance parameters and Modbus communication protocol content; Sending the test data to the controller under test according to the test time parameter, and having the controller under test perform the test according to the test data to obtain test result data; Compare the test result data with the expected result data to obtain a test analysis result; A test report is generated according to the test analysis results.
2. The method according to claim 1, characterized in that: The generating test data according to the test instance parameters and the Modbus communication protocol content includes: According to the Modbus communication protocol content, the test instance parameters are parsed to generate a random number within the range specified by the corresponding protocol; The test data is generated by assembling the metadata specified by the protocol of the communication protocol data and the random number.
3. The method according to claim 2, characterized in that According to the Modbus communication protocol content, the test instance parameters are parsed to generate a random number within the range specified by the corresponding protocol, including: According to the Modbus communication protocol content, the test instance parameters are parsed to determine the test mode, where the test mode includes a server mode and a client mode; Determine corresponding data generation configuration parameters according to the test mode; Configuration parameters are generated according to the data to produce a random number within the range specified by the corresponding protocol.
4. The method according to claim 1, characterized in that The test time parameters include the test time and the preset sending frequency; the test data is sent to the controller under test according to the test time parameters, and the controller under test performs the test according to the test data to obtain the test result data, including: The test data and the test time are sent to the controller according to a preset sending frequency, and the controller under test performs the test according to the test data within the test time to obtain the test result data.
5. The method according to claim 1, characterized in that: Generating a test report according to the test analysis result includes: Fill the test content and the test analysis results into the corresponding report generation template to generate a test report.
6. The method according to claim 1, characterized in that The method comprises: Acquire configuration parameters, the configuration parameters including the test connection parameters, test instance parameters and test time parameters; Verify the legality and correctness of the configuration parameters; If the configuration parameters are verified to be abnormal, an abnormal reminder is output; If the configuration parameter verification passes, the configuration parameter is stored.
7. A Modbus communication automatic test device for a controller, characterized in that: The device comprises: The parameter acquisition module is used to read the configuration parameters, obtain the test connection parameters, the test instance parameters of the test content, and the test time parameters; A connection module, used for connecting with the controller under test according to the test connection parameters; A test data generation module, used to generate test data according to the test instance parameters and Modbus communication protocol content; A test module, used for sending the test data to the controller under test according to the test time parameter, and the controller under test performs the test according to the test data to obtain test result data; An analysis module, used to compare the test result data with the expected result data to obtain a test analysis result; A report generation module is used to generate a test report based on the test analysis results.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Modbus protocol automatic test method and system suitable for overspeed protector
CN121664713A