Product testing method based on master-slave architecture communication protocol and related equipment

By installing the slave program under test and the host test program on the product to be tested and building a master-slave architecture communication protocol, the problem of relying on real-time network communication in existing technologies is solved, and efficient and low-cost product testing is achieved in an offline environment.

CN120780588APending Publication Date: 2025-10-14SHENZHEN WATER WORLD INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510692032.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-10-14

AI Technical Summary

Technical Problem

Existing product testing methods rely on real-time network communication and cannot be run in an offline environment. The testing tools are expensive and the testing efficiency is low.

Method used

By installing the slave program under test and the host test program on the product to be tested, a master-slave architecture communication protocol is constructed, a test host and a slave to be tested are selected, and the master-slave architecture communication protocol is used to communicate between the same products, thereby building a communication network and conducting product testing.

Benefits of technology

It enables product testing in an offline environment, reduces the cost of testing tools, and improves testing efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120780588A_ABST
    Figure CN120780588A_ABST
Patent Text Reader

Abstract

The invention provides a product testing method based on a master-slave architecture communication protocol. The method comprises the following steps: carrying a slave tested program and a host testing program on a to-be-tested product; after the plurality of to-be-tested products are powered on, running the tested program of the slave by default; at least one to-be-tested product is selected as a test host, a host test program is run based on the target trigger instruction, and the rest to-be-tested products are to-be-tested slaves; wherein the test host and the slave to be tested are the same product; constructing a communication network between the test host and each slave to be tested through a master-slave architecture communication protocol, and constructing a master-slave architecture communication service flow based on a target test environment corresponding to a product to be tested; and based on the master-slave architecture communication service process, controlling the test host to perform product test on each slave to be tested to obtain a test result of the product to be tested. The problems that an existing product testing method depends on network real-time communication, cannot run in an offline environment, and is high in testing tool cost and low in testing efficiency are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of product testing technology, and in particular to a product testing method and related equipment based on a master-slave architecture communication protocol. Background Art

[0002] With the rapid development of science and technology, more and more software and hardware products are emerging. In order to avoid product problems, products need to be tested to ensure that product quality and performance meet established standards. The current product testing process for product production is roughly as follows: based on assembly line operations, the equipment actively enters the production test mode through fully automatic / semi-automatic / manual methods, and the data is aggregated through computer-side wired tools or the Internet. Relying on the network or test equipment or production environment, too many external factors are required, resulting in a cumbersome product production process. At present, existing product testing methods have the problems of relying on real-time network communication, being unable to operate in an offline environment, high test tool costs, and low test efficiency. Therefore, there is an urgent need for a lower-cost and more accurate solution for product testing. Summary of the Invention

[0003] The embodiment of the present invention provides a product testing method based on a master-slave architecture communication protocol, aiming to provide a lower cost and higher accuracy solution for product testing. The present invention carries a slave tested program and a host test program on the product to be tested. After multiple products to be tested are powered on, the slave tested program is run by default, at least one of the products to be tested is selected as the test host, and based on the target trigger instruction, the host test program is run, and the remaining products to be tested are slaves to be tested. The test host and the slaves to be tested are the same product. A communication network is constructed between the test host and each slave to be tested through the master-slave architecture communication protocol, and a target test environment corresponding to the product to be tested is used to construct a master-slave architecture communication business process. According to the master-slave architecture communication business process, the test host is controlled to perform product testing on each slave to be tested to obtain the test results of the product to be tested. The present invention performs master-slave connection communication between the same products through the master-slave architecture communication protocol, which solves the problems of existing product testing methods that rely on real-time network communication, cannot run in an offline environment, have high test tool costs, and have low test efficiency.

[0004] In a first aspect, an embodiment of the present invention provides a product testing method based on a master-slave architecture communication protocol, the method comprising the following steps:

[0005] Load the slave tested program and the host test program onto the product to be tested;

[0006] After the plurality of products to be tested are powered on, the slave tested program is run by default;

[0007] At least one of the products to be tested is selected as a test host, and based on a target trigger instruction, the host test program is run, and the remaining products to be tested are slaves to be tested; wherein the test host and the slaves to be tested are the same product;

[0008] Building a communication network between the test host and each of the slaves to be tested through a master-slave architecture communication protocol, and building a master-slave architecture communication business process based on the target test environment corresponding to the product to be tested;

[0009] Based on the master-slave architecture communication service process, the test host is controlled to perform product testing on each of the slaves to be tested to obtain test results of the products to be tested.

[0010] Optionally, the step of constructing a communication network between the test host and each of the slaves to be tested using a master-slave architecture communication protocol includes:

[0011] Constructing a communication timeout processing mechanism between the test host and the slave to be tested;

[0012] Determining an instruction from the test host to the slave device to be tested;

[0013] Building an external perception mechanism for the test host;

[0014] Based on the communication timeout processing mechanism, the indication instruction and the external perception mechanism, a communication network between the test host and each of the slaves to be tested is established through a master-slave architecture communication protocol.

[0015] Optionally, the constructing of a master-slave architecture communication service process based on the target test environment corresponding to the product to be tested includes:

[0016] When the target test environment corresponding to the product to be tested is a fully automatic environment, a master-slave architecture communication business process is constructed through a fully automatic production line;

[0017] When the target test environment corresponding to the product to be tested is a semi-automatic environment, a master-slave architecture communication business process is constructed through a semi-automatic production line;

[0018] When the target test environment corresponding to the product to be tested is an artificial environment, a master-slave architecture communication business process is constructed through an artificial production line.

[0019] Optionally, the performing of product testing on the test host and each of the slaves to be tested based on the master-slave architecture communication service process includes:

[0020] Based on the master-slave architecture communication business process, when the test host is working, obtaining product test instructions;

[0021] Based on the product test instruction, the test host is controlled to perform product testing on each of the slave devices to be tested.

[0022] Optionally, controlling the test host to perform product testing on each of the slave devices to be tested based on the product test instruction includes:

[0023] Determining a product test type based on the product test instruction;

[0024] If the product test type is a non-communication function test, performing a product test on the test host itself and controlling the test host to perform a product test on each of the slaves to be tested;

[0025] If the product test type is a communication function test, the test host is controlled to perform a product test on each of the slave devices to be tested.

[0026] Optionally, controlling the test host to perform product testing on each of the slave devices to be tested includes:

[0027] Controlling the test host to periodically send requests to obtain the sn code of each slave to be tested;

[0028] When each of the slave devices to be tested is powered on, it enters a ready state and waits for instructions from the test host;

[0029] After receiving the instruction from the test host requesting the sn code, the slave machine to be tested responds with the sn code corresponding to the slave machine to be tested;

[0030] After the test host recognizes the sn code of the slave to be tested, it determines whether the slave to be tested has completed the test;

[0031] If the slave machine to be tested has not completed the test, a product test is performed on the slave machine to be tested.

[0032] Optionally, after selecting at least one of the products to be tested as a test host and running the host test program based on a target trigger instruction, and the remaining products to be tested as test slaves, the method further includes:

[0033] Among the multiple products to be tested, two of the products to be tested are selected as a first test host and a second test host, and the remaining products to be tested are selected as slaves to be tested, and the first test host is made to run on a host test program, and the second test host is made to run on a host test program;

[0034] The first test host issues a first test instruction to each of the slave machines to be tested, so that the slave machines to be tested execute the first test instruction;

[0035] When the slave machine to be tested is idle while executing the first test instruction, synchronously executing the second test instruction issued by the second test host;

[0036] When the slave machine to be tested is idle while executing the second test instruction, the slave machine to be tested re-executes the first test instruction.

[0037] In a second aspect, an embodiment of the present invention further provides a product testing device based on a master-slave architecture communication protocol, the product testing device based on a master-slave architecture communication protocol comprising:

[0038] The loading module is used to load the slave tested program and the host test program into the product under test;

[0039] A running module, configured to run the slave tested program by default after the plurality of products to be tested are powered on;

[0040] A first selection module is configured to select at least one of the products to be tested as a test host, and run the host test program based on a target trigger instruction, and the remaining products to be tested as test slaves; wherein the test host and the test slaves are the same product;

[0041] A construction module is used to establish a communication network between the test host and each of the slaves to be tested through a master-slave architecture communication protocol, and to establish a master-slave architecture communication service process based on the target test environment corresponding to the product to be tested;

[0042] The test module is used to control the test host to perform product testing on each of the slaves to be tested based on the master-slave architecture communication service process, and obtain test results of the products to be tested.

[0043] In a third aspect, an embodiment of the present invention provides an electronic device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the product testing method based on the master-slave architecture communication protocol provided in an embodiment of the present invention are implemented.

[0044] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the product testing method based on the master-slave architecture communication protocol provided in the embodiment of the invention are implemented.

[0045] In an embodiment of the present invention, a slave tested program and a host test program are mounted on a product to be tested; after a plurality of products to be tested are powered on, the slave tested program is run by default; at least one of the products to be tested is selected as a test host, and based on a target trigger instruction, the host test program is run, and the remaining products to be tested are slaves to be tested; wherein the test host and the slaves to be tested are the same product; a communication network is constructed between the test host and each slave to be tested through a master-slave architecture communication protocol, and a master-slave architecture communication business process is constructed based on a target test environment corresponding to the product to be tested; based on the master-slave architecture communication business process, the test host is controlled to perform product testing on each slave to be tested, and a test result of the product to be tested is obtained. The present invention performs master-slave connection communication between the same products through a master-slave architecture communication protocol, thereby solving the problems of existing product testing methods that rely on real-time network communication, cannot run in an offline environment, and have high test tool costs and low test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0047] Figure 1 This is a flowchart of a product testing method based on a master-slave architecture communication protocol provided by an embodiment of the present invention;

[0048] Figure 2 This is a schematic structural diagram of a product testing device based on a master-slave architecture communication protocol provided by an embodiment of the present invention;

[0049] Figure 3 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0051] like Figure 1 As shown, Figure 1 1 is a flowchart of a product testing method based on a master-slave architecture communication protocol provided by an embodiment of the present invention, the product testing method based on a master-slave architecture communication protocol comprising the steps of:

[0052] 101. Install the slave tested program and the host test program on the product to be tested.

[0053] In an embodiment of the present invention, the above-mentioned product testing method based on the master-slave architecture communication protocol can be applied to a production test fixture, which includes a production test program, sensors, microprocessors and other structures and electronic components. The above-mentioned production test program is provided with a master-slave architecture communication protocol, a slave tested program, a host test program, etc. The above-mentioned master-slave architecture communication protocol is used to establish communication between the slave tested program and the host test program, and the above-mentioned slave tested program is used to execute the instruction instructions issued by the host test program. The above-mentioned host test program can enter the product under test through a trigger instruction and actively execute the product test process. The above-mentioned trigger instruction can be a trigger instruction such as a button, a touch screen, a microphone, WiFi, or Bluetooth.

[0054] The slave test program and the host test program are loaded onto the product to be tested. The host test program has a higher priority than the slave test program. When the host test program is started, the slave test program is automatically closed.

[0055] The above-mentioned products to be tested can be understood as products whose performance, reliability or safety needs to be evaluated and tested. It should be noted that the above-mentioned products to be tested are of the same type.

[0056] The above-mentioned test fixture is a tool used to test products. The test fixture can simulate the usage of products in a real environment and perform various performance tests and functional tests on the tested products.

[0057] It should be noted that when a test product needs to be tested, it needs to be installed on a test fixture, and the various performance and functions of the test product need to be tested and verified through the test fixture.

[0058] 102. After multiple products under test are powered on, the slave tested program will be run by default.

[0059] In the embodiment of the present invention, each product to be tested runs the slave tested program by default in the initial stage of power-on.

[0060] 103. Select at least one of the products to be tested as a test host, run the host test program based on the target trigger instruction, and the remaining products to be tested as test slaves, and make the test host run on the host test program.

[0061] In the embodiment of the present invention, the testing host and the host to be tested are the same product.

[0062] The at least one mentioned above can be one, two, three, or more. It is understood that, when testing the same product, one product to be tested can be selected as the test host to execute the product test process; two products to be tested can also be selected as test hosts, and the two test hosts can simultaneously execute the same product test process to ensure the accuracy of the test results; multiple products to be tested can also be selected as test hosts, and the multiple test hosts can simultaneously execute the same product test process to verify the product test results to ensure the accuracy of the test results.

[0063] The above-mentioned test host can be understood as a product to be tested designated as a host. The test host runs on a host test program. The test host can be understood as a host that initiates a communication request.

[0064] The target trigger command can be understood as a pre-set trigger condition or command for the system, which triggers the host test program to execute the product test process after the target trigger command is triggered. The trigger command can be triggered by a button, touch screen, microphone, Wi-Fi, Bluetooth, etc. Different products correspond to different trigger commands.

[0065] The above-mentioned slave device to be tested can be understood as a slave product to be tested, and can be a slave device that responds to a communication request from a host and provides data or performs corresponding operations according to the request.

[0066] It should be noted that after selecting a test host, the host runs the host test program. The test host can actively execute the product test process. The host test program has a higher priority than the slave test program. When the host test program starts, the slave test program automatically closes.

[0067] In a possible embodiment, one of the products to be tested can be selected as the test host, and the remaining products to be tested can be selected as slaves to be tested. The test host runs the host test program, and the remaining slaves to be tested run the slave tested program. When the test host issues the product test instruction, the test host can perform the test host self-test, so that all products to be tested in the same batch can be tested simultaneously. Alternatively, two products to be tested can be selected as test hosts, and the remaining products to be tested can be selected as slaves to be tested. The test host runs the host test program, and the remaining slaves to be tested run the slave tested program. The two test hosts test one product test item at the same time, which can ensure the accuracy of the test results. In addition, multiple products to be tested can be selected as test hosts, and the remaining products to be tested can be selected as slaves to be tested. The test host runs the host test program, and the remaining slaves to be tested run the slave tested program. Multiple test hosts test one product test item at the same time, and the product test results can also be verified to ensure the accuracy of the test results.

[0068] 104. Build a communication network between the test host and each slave to be tested through the master-slave architecture communication protocol, and build a master-slave architecture communication business process based on the target test environment corresponding to the product to be tested.

[0069] In an embodiment of the present invention, the master-slave architecture communication protocol refers to a communication mode in which a communication system consists of a host and multiple slaves, wherein the host is responsible for managing and controlling the multiple slaves, sending commands and data to the slaves and receiving responses from the slaves. In the invention, the master-slave architecture communication protocol is used to establish a communication network between the test host and each slave under test. Through the master-slave architecture communication protocol, the test host and each slave under test can exchange data and communicate over an offline communication network.

[0070] The above-mentioned master-slave architecture communication protocol can be a master-slave architecture communication protocol such as wireless Modbus protocol, Zigbee protocol, LoRa protocol, etc.

[0071] The above construction can be understood as a process of building a communication network between the test host and each slave to be tested through a master-slave architecture communication protocol to achieve data interaction between the test host and each slave to be tested.

[0072] The aforementioned testing environments include fully automated, semi-automated, and manual environments. A fully automated environment is one in which mechanical equipment automatically completes all production steps without human intervention. A semi-automated environment requires both human and mechanical operation. A manual environment is one in which only human operators are present and no mechanical equipment is involved.

[0073] The target test environment mentioned above can be understood as the test environment corresponding to the product to be tested during product testing.

[0074] The above-mentioned master-slave architecture communication business process includes the product testing process of the test master and the test slave in the product to be tested.

[0075] It should be noted that the test standards for each product are different. Therefore, different master-slave architecture communication business processes need to be built for different products. The corresponding master-slave architecture communication business processes can be built based on the test requirements of the product to be tested and the corresponding test environment.

[0076] 105. Based on the master-slave architecture communication business process, control the test host to perform product testing on each slave to be tested, and obtain the test results of the product to be tested.

[0077] In the embodiment of the present invention, the test host can be controlled to execute the product test process on each slave to be tested according to the master-slave architecture communication service process, and the test results of the product to be tested can be obtained.

[0078] Further, after obtaining the test result, the test host saves the test result in a medium of the test host, so as to be collected by the test personnel. The medium can be a flash, an sd card, etc.

[0079] In the embodiment of the present application, the communication network between the test host and each slave machine to be tested is constructed by the master-slave architecture communication protocol, so that the host machine replaces various forms of test tools to perform product testing on the product to be tested, thereby reducing the cost of the test tools and improving the accuracy of product testing.

[0080] In the embodiment of the present application, the slave machine program to be tested and the host machine test program are carried on the product to be tested; after power-on of the plurality of products to be tested, the slave machine program to be tested is run by default; at least one product to be tested is selected as a test host, and based on a target trigger instruction, the host machine test program is run, and the rest of the products to be tested are slave machines to be tested; wherein, the test host and the slave machine to be tested are the same product; the communication network between the test host and each slave machine to be tested is constructed by the master-slave architecture communication protocol, and the master-slave architecture communication business process is constructed based on the target test environment corresponding to the product to be tested; based on the master-slave architecture communication business process, the test host is controlled to perform product testing on each slave machine to be tested, and the test result of the product to be tested is obtained. The master-slave machine connection communication between the same products is realized by the master-slave architecture communication protocol, thereby solving the problems of the existing product testing method, such as dependence on real-time network communication, inability to run in an offline environment, high cost of test tools, and low testing efficiency.

[0081] It can be understood that in the specific embodiments of the present application, product data, test data, instruction data, business data and other related data are involved, and when the embodiments of the present application are applied to specific products or technologies, the permission or consent of the user needs to be obtained, and the collection, use and processing of related data, and the training, deployment and calling of algorithm models all need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0082] Optionally, in the step of constructing the communication network between the test host and each slave machine to be tested by the master-slave architecture communication protocol, a communication timeout processing mechanism of the test host and the slave machine to be tested can be constructed; the indication instruction of the test host to the slave machine to be tested is determined; an external perception mechanism of the test host is constructed; and the communication network between the test host and each slave machine to be tested is constructed by the master-slave architecture communication protocol based on the communication timeout processing mechanism, the indication instruction and the external perception mechanism.

[0083] In the embodiments of the present application, the communication timeout processing mechanism can be understood as a processing mechanism for a timeout situation occurring in the communication process. The communication timeout processing mechanism can be a retransmission request, error recording, reconnection, etc. Specifically, the communication timeout processing mechanism can be a processing mechanism for reporting the slave machine failure on the test host after the test host sends an indication instruction, a processing mechanism for reporting the slave machine failure on the test host when the first communication fails, and a processing mechanism for reporting the slave machine failure on the test host when the communication fails in the product testing process, the timeout time and the retry number are set, and the re-established communication time exceeds the preset timeout time and the retry number, and it is determined that the current function product testing item of the slave machine fails.

[0084] The test host can be understood as a slave machine to be tested, which runs on a host test program. The test host can be understood as a host initiating a communication request.

[0085] The slave machine to be tested can be understood as a slave machine to be tested, which can be a slave machine responding to a host communication request and providing data or performing corresponding operations according to the request.

[0086] The communication timeout processing mechanism of the test host and the slave machine to be tested can ensure the reliability of the communication between the test host and the slave machine to be tested, and avoid the problem that the test host cannot continue to perform other tasks due to the failure of the slave machine to be tested and the like.

[0087] The indication instruction can be understood as a control or query command sent by the test host to the slave machine to be tested, which is used to guide the slave machine to be tested to perform a specific operation or provide specific information. It should be noted that the indication instruction between the test host and the slave machine to be tested should comply with the TLV (type length value) specification. The TLV is a common and effective method to encode and analyze command or data packet, in which Type represents the type of data, Length represents the length of data, and Value is the actual data content. In the master-slave architecture, the use of TLV can make the communication more simple and clear. For example, the master node can send different types of commands to the slave node, so that the slave node can identify the command type and process the corresponding data; the slave node can periodically or on demand send its state information to the master node, so that the master node can analyze and respond accordingly; the slave node can send an error report to the master node in the TLV format, which includes error type and error details, etc.

[0088] The aforementioned external perception mechanism can be understood as a mechanism for monitoring and identifying changes in the external environment. Through this mechanism, the test host can adjust its communication strategy or make decisions based on these changes. For example, in a fully automated environment, technologies such as GPIO or wireless networking can be used to enable the fully automated production line to sense any anomalies in the current operating state in real time, and to handle them if an anomaly is detected. In a manual environment, intuitive technologies such as signal lights can be used to enable workers to sense any anomalies in the current operating state in real time, and to handle them accordingly if an anomaly is detected.

[0089] The above-mentioned master-slave architecture communication protocol refers to a communication mode consisting of a host and multiple slaves in a communication system, wherein the host is responsible for managing and controlling multiple slaves, sending commands and data to the slaves, and receiving responses from the slaves. In the invention, the above-mentioned master-slave architecture communication protocol is used to build a communication network between the test host and each slave to be tested. Through the master-slave architecture communication protocol, the test host and each slave to be tested can exchange data and communicate in a communication network in an offline environment. The above-mentioned master-slave architecture communication protocol can be a master-slave architecture communication protocol such as wireless modbus protocol, Zigbee protocol, LoRa protocol, etc. The above-mentioned wireless modbus protocol converts RS-485 signals into wireless transmission through a wireless module (such as DTD434MC, DTD433F), retains the modbus protocol logic, and the wireless modbus protocol is used to realize data transmission and communication between devices in a wireless environment. The above-mentioned Zigbee protocol is a low-power wireless communication protocol based on the IEEE 802.15.4 standard, supports star networks, and is suitable for large-scale low-power device networking. The LoRa protocol is a long-distance wireless communication technology based on spread spectrum technology that supports a star topology with one master and multiple slaves. The LoRa protocol modulates the original signal onto a wider frequency band for transmission. Even if noise interference is encountered during reception, the signal can be recovered from other undisturbed carrier frequency bands, thereby improving communication sensitivity and reliability.

[0090] It should be noted that the communication timeout handling mechanism ensures that the test host can identify in real time which slave device under test is responding slowly or experiencing a problem. By determining the test host's instructions to the slave devices under test, the test host can ensure accurate control and management of each slave device under test. The external perception mechanism allows the test host to adjust communication strategies or make decisions based on changes in the external environment. The master-slave architecture communication protocol combines the communication timeout handling mechanism, instructions, and external perception mechanism to build a communication network between the test host and each slave device under test, ensuring reliable communication between the test host and each slave device under test.

[0091] Optionally, in the step of constructing a master-slave architecture communication business process based on the target test environment corresponding to the product to be tested, when the target test environment corresponding to the product to be tested is a fully automatic environment, the master-slave architecture communication business process can be constructed through a fully automatic production line; when the target test environment corresponding to the product to be tested is a semi-automatic environment, the master-slave architecture communication business process can be constructed through a semi-automatic production line; when the target test environment corresponding to the product to be tested is a manual environment, the master-slave architecture communication business process can be constructed through a manual production line.

[0092] In an embodiment of the present invention, the fully automatic environment may be an environment in which mechanical equipment automatically completes each step of production without human intervention.

[0093] The aforementioned semi-automatic environment may be an environment requiring joint operation of manual and mechanical equipment.

[0094] The artificial environment may be an environment operated manually without mechanical equipment.

[0095] In one possible embodiment, when the target test environment is a fully automated environment, equipped with automated production equipment and systems, it can complete the testing and verification of production products without human intervention. When the target test environment corresponding to the product under test is a fully automated environment, a master-slave architecture communication business process can be established through a fully automated production line to ensure that the test master and the slave under test can operate and interact normally in the fully automated environment.

[0096] In another possible embodiment, when the target test environment is a semi-automatic environment, which partially relies on automated equipment and partially requires manual intervention to complete certain testing or verification steps, a master-slave architecture communication business process can be established through a semi-automatic production line to ensure that the test master and the slave under test can operate and interact normally in the semi-automatic environment.

[0097] In another possible embodiment, when the target test environment is an artificial environment, all testing and verification work in the artificial environment must be completed manually without the support of automated equipment. When the target test environment corresponding to the product under test is an artificial environment, a master-slave architecture communication business process can be established through a manual production line to ensure that the test master and the test slave can operate and interact normally in the artificial environment.

[0098] It should be noted that the corresponding production line can be selected according to different test environments to build the master-slave architecture communication business process, so that the effectiveness and accuracy in different test environments can be ensured.

[0099] Optionally, in the step of controlling the test host to perform product testing on each slave machine to be tested based on the master-slave architecture communication business process, the product test instructions can be obtained when the test host is working based on the master-slave architecture communication business process; based on the product test instructions, the test host is controlled to perform product testing on each slave machine to be tested.

[0100] In an embodiment of the present invention, the master-slave architecture communication service process includes an automated product testing process for testing a master and a slave in a product to be tested based on a master-slave architecture communication protocol.

[0101] The above-mentioned product test instructions can be understood as commands for guiding the testing of the product to be tested, with the purpose of verifying the functions and performance of the product to be tested.

[0102] The above-mentioned product testing can be understood as a testing process that verifies and evaluates the various functions, performance, stability, etc. of the guessed product through the master-slave architecture communication business process.

[0103] It should be noted that, when testing similar products, when the test host is working and receives a product test instruction, it can control the test host to perform product testing on each slave to be tested, so that the testing of all products of the same product type can be completed.

[0104] Optionally, in the step of controlling the test host to perform product testing on each slave machine to be tested based on the product test instruction, the product test type can be determined based on the product test instruction; if the product test type is a non-communication function test, the product test is performed on the test host itself and the test host is controlled to perform product testing on each slave machine to be tested; if the product test type is a communication function test, the test host is controlled to perform product testing on each slave machine to be tested.

[0105] In this embodiment of the present invention, the aforementioned non-communication functional testing can be understood as a functional test of the host itself, as well as a test type of execution efficiency test. During the non-communication functional testing, the host performs a product test on itself to ensure its performance and stability. Simultaneously, the host is required to control the test to perform product tests on each slave device under test to check the slave's performance and stability.

[0106] The communication function test described above can be understood as a test type in which the test host communicates with other slave devices under test, including sending and receiving data. During the communication function test, the test host controls the test device to perform product tests on each slave device under test. During the test, it is necessary to monitor the communication function between the slave device and the test host in real time to verify that the communication function is functioning properly.

[0107] In this embodiment, the present invention can determine the product test type according to the product test instruction, and perform product testing on the product to be tested according to the product test type, thereby improving test efficiency.

[0108] Optionally, in the step of controlling the test host to perform product testing on each of the slave machines to be tested, the test host can be controlled to periodically send requests to obtain the SN code of each slave machine to be tested; when each slave machine to be tested is powered on, it enters a ready state and waits for instructions from the test host; after receiving the instruction from the test host to request the SN code, the slave machine to be tested responds with the SN code corresponding to the slave machine to be tested; after the test host identifies the SN code of the slave machine to be tested, it determines whether the slave machine to be tested has completed the test; if the slave machine to be tested has not completed the test, product testing is performed on the slave machine to be tested.

[0109] In the embodiment of the present invention, the periodicity is a time interval preset by the system, which may be every period of time, such as every 30 seconds, every 1 minute, every 2 minutes, etc.

[0110] Furthermore, the test host does not send a single acquisition request and then terminates. Instead, it repeatedly sends requests to obtain the SN code of each slave device under test at a preset time interval. This is done to obtain the status of each slave device under test in real time, including whether each slave device under test has completed product testing and whether product testing needs to be repeated on slave devices that have not completed testing.

[0111] The sn code (Serial Number) is a unique identifier for each product and is used to distinguish and manage different slave devices to be tested.

[0112] The local database mentioned above can be understood as a database stored inside the test host, including test records of each slave to be tested, information of the slave to be tested, etc.

[0113] When each slave device under test is powered on, it enters a ready state and is ready to receive instructions from the test host. In the ready state, the slave device under test is in standby mode, waiting to receive instructions from the test host.

[0114] Furthermore, when the slave device to be tested receives the instruction requesting the SN code from the test host, the slave device to be tested will respond immediately and provide the SN code corresponding to the slave device to be tested as a reply.

[0115] Specifically, after obtaining the product test instruction, the test host machine periodically sends a request to obtain the SN code of each to-be-tested slave machine. After identifying the SN code of the to-be-tested slave machine, the to-be-tested slave machine is queried from the local database to determine whether the to-be-tested slave machine has been tested. If the to-be-tested slave machine has not been tested, the test host machine starts to perform the product test process on the to-be-tested slave machine. If the to-be-tested slave machine has been tested, the test host machine sends a test completion instruction to the to-be-tested slave machine, and the to-be-tested slave machine ends the test.

[0116] In a possible embodiment, if the to-be-tested slave machine does not receive the test host machine instruction within a preset time, the to-be-tested slave machine reports that the test host machine instruction has not been received. The preset time is a time for receiving the test host machine instruction set by the system in advance, which can be 3 minutes, 5 minutes, etc. If the preset time is 3 minutes, the to-be-tested slave machine enters a preparation state when powered on and waits to receive the instruction from the host machine. If the to-be-tested slave machine does not receive the test host machine instruction within 3 minutes, the to-be-tested slave machine reports that the test host machine instruction has not been received. If the preset time is 5 minutes, the to-be-tested slave machine enters a preparation state when powered on and waits to receive the instruction from the host machine. If the to-be-tested slave machine does not receive the test host machine instruction within 5 minutes, the to-be-tested slave machine reports that the test host machine instruction has not been received.

[0117] Optionally, after the step of selecting at least one to-be-tested product as a test host machine, running the host test program based on the target trigger instruction, and selecting the remaining to-be-tested products as to-be-tested slave machines, two to-be-tested products can be selected as a first test host machine and a second test host machine, and the remaining to-be-tested products can be selected as to-be-tested slave machines. The first test host machine runs on the host test program, and the second test host machine runs on the host test program. The first test host machine issues a first test instruction to the to-be-tested slave machines, so that the to-be-tested slave machines execute the first test instruction. The to-be-tested slave machines synchronously execute a second test instruction issued by the second test host machine in an idle time of executing the first test instruction. The to-be-tested slave machines re-execute the first test instruction in an idle time of executing the second test instruction.

[0118] In the embodiment of the application, the first test instruction is a test instruction issued by the first test host machine to the to-be-tested slave machine.

[0119] The second test instruction is a test instruction issued by the second test host machine to the to-be-tested slave machine.

[0120] The idle time of executing the first test instruction by the to-be-tested slave machine can be understood as an idle process in a waiting test step or a waiting test result of executing the first test instruction by the to-be-tested slave machine.

[0121] The idle time of executing the second test instruction by the to-be-tested slave machine can be understood as an idle process in a waiting test step or a waiting test result of executing the second test instruction by the to-be-tested slave machine.

[0122] It should be noted that the application allows two test hosts to perform two tests at the same time, similar to a time slice algorithm, which is a scheduling algorithm that divides CPU time into fixed-size time slices, and each process executes within the allocated time. But the time slice of the application is not fixed, but is determined according to the idle time of the device, and then the test is performed in turn, ensuring that CPU resources are not wasted, while two tests can be performed at the same time, improving test efficiency.

[0123] In a possible embodiment, two products to be tested can be selected as test hosts, and the remaining products to be tested as test slaves, the two test hosts running on the host test program, and the remaining test slaves running on the slave test program, and two tests can be performed at the same time; the test host 1 issues a test instruction of product test 1 to the test slave, and when the test slave is idle in executing the test command of product test 1 (in the process of waiting for the test command or in the process of waiting for the test result), the test instruction of product test 2 issued by the test host 2 can be executed synchronously, and when the test slave is idle in executing the test instruction of product test 2 (in the process of waiting for the test result), the test slave re-executes the test command of product test 1, and so on. Similarly, a plurality of products to be tested can be selected as test hosts, and the remaining products to be tested as test slaves, and a plurality of product tests can be performed at the same time, improving test efficiency.

[0124] In another possible embodiment, in the test between products of the same type, the test host and the test slave can be alternated, for example, in the first round of testing, the test host 1, the test slave 2, the test slave 3, the test slave 4, and so on; in the second round of testing, the test slave 1 (converted from the test host 1 to the test slave 1), the test host 2 (converted from the test slave 2 to the test host 2), the test slave 3, the test slave 4, and so on; in the third round of testing, the test slave 1, the test slave 2, the test host 3 (converted from the test slave 3 to the test host 3), the test slave 4, and so on; until all are alternated once, the product test is completed.

[0125] As shown in Figure 2 The embodiment of the application provides a product testing device based on a master-slave architecture communication protocol, which comprises:

[0126] The mounting module 201 is used for mounting the slave test program and the host test program on the product to be tested.

[0127] The running module 202 is used for running the slave test program by default after the plurality of products to be tested are powered on.

[0128] The first selecting module 203 is configured to select at least one of the to-be-tested products as a test host, and based on a target trigger instruction, run a host test program, and the rest of the to-be-tested products are to-be-tested slaves; wherein the test host and the to-be-tested slaves are the same kind of products.

[0129] The constructing module 204 is configured to construct a communication network between the test host and each of the to-be-tested slaves through a master-slave architecture communication protocol, and based on a target test environment corresponding to the to-be-tested products, construct a master-slave architecture communication business process.

[0130] The testing module 205 is configured to control the test host to perform product testing on each of the to-be-tested slaves based on the master-slave architecture communication business process, and obtain a test result of the to-be-tested products.

[0131] Optionally, the constructing module 204 comprises:

[0132] The first constructing submodule is configured to construct a communication timeout processing mechanism of the test host and the to-be-tested slaves.

[0133] The determining submodule is configured to determine an indication instruction of the test host to the to-be-tested slaves.

[0134] The second constructing submodule is configured to construct an external perception mechanism of the test host.

[0135] The third constructing submodule is configured to construct a communication network between the test host and each of the to-be-tested slaves through a master-slave architecture communication protocol based on the communication timeout processing mechanism, the indication instruction, and the external perception mechanism.

[0136] Optionally, the constructing module 204 comprises:

[0137] The fourth constructing submodule is configured to, when the target test environment corresponding to the to-be-tested products is a full-automatic environment, construct a master-slave architecture communication business process through a full-automatic production line.

[0138] The fifth constructing submodule is configured to, when the target test environment corresponding to the to-be-tested products is a semi-automatic environment, construct a master-slave architecture communication business process through a semi-automatic production line.

[0139] The sixth constructing submodule is configured to, when the target test environment corresponding to the to-be-tested products is a manual environment, construct a master-slave architecture communication business process through a manual production line.

[0140] Optionally, the testing module 205 comprises:

[0141] The acquiring submodule is configured to acquire a product testing instruction when the test host is working based on the master-slave architecture communication business process.

[0142] a test submodule configured to control the test host to perform product testing on each of the to-be-tested slaves based on the product testing instruction.

[0143] Optionally, the test submodule comprises:

[0144] a judging unit configured to judge a product testing type based on the product testing instruction;

[0145] a first testing unit configured to perform product testing on the test host itself and control the test host to perform product testing on each of the to-be-tested slaves if the product testing type is non-communication function testing;

[0146] a second testing unit configured to control the test host to perform product testing on each of the to-be-tested slaves if the product testing type is communication function testing.

[0147] Optionally, the test submodule is further configured to control the test host to periodically send a request to acquire the sn code of each of the to-be-tested slaves; when each of the to-be-tested slaves is powered on and works, enter a preparation state and wait for the instruction of the test host; after receiving the instruction of the test host requesting the sn code, the to-be-tested slave should respond to the sn code corresponding to the to-be-tested slave; after the test host identifies the sn code of the to-be-tested slave, determine whether the to-be-tested slave has completed testing; if the to-be-tested slave has not completed testing, perform product testing on the to-be-tested slave.

[0148] Optionally, the device further comprises:

[0149] a second selection module configured to select two of the to-be-tested products as a first test host and a second test host, and the rest of the to-be-tested products as to-be-tested slaves, and make the first test host run on a host testing program and the second test host run on a host testing program.

[0150] a first execution module configured to make the first test host issue a first testing instruction to each of the to-be-tested slaves, so that the to-be-tested slaves execute the first testing instruction;

[0151] a second execution module configured to synchronously execute a second testing instruction issued by the second test host when the to-be-tested slaves are idle in executing the first testing instruction;

[0152] a third execution module configured to make the to-be-tested slaves re-execute the first testing instruction when the to-be-tested slaves are idle in executing the second testing instruction.

[0153] As Figure 3As shown, the embodiment of the present application also provides an electronic device, comprising a processor, wherein the processor can execute any one of the product testing methods based on the master-slave architecture communication protocol.

[0154] Specifically, the electronic device comprises a processor 301 and a memory 302, and a computer program for executing the product testing method based on the master-slave architecture communication protocol stored in the memory 302 and capable of running on the processor 301, wherein:

[0155] The processor 301 runs the computer program for executing the product testing method based on the master-slave architecture communication protocol stored in the memory 302, and executes the following steps:

[0156] The slave program under test and the master test program are loaded on the product under test;

[0157] After the plurality of products under test are powered on, the slave program under test is run by default;

[0158] At least one of the products under test is selected as a test master, and based on a target trigger instruction, the master test program is run, and the remaining products under test are test slaves; wherein the test master and the test slaves are the same product;

[0159] A communication network between the test master and each of the test slaves is constructed through the master-slave architecture communication protocol, and a master-slave architecture communication business process is constructed based on a target test environment corresponding to the product under test;

[0160] Based on the master-slave architecture communication business process, the test master performs product testing on each of the test slaves to obtain the test results of the product under test.

[0161] Optionally, the processor 301 executes the construction of the communication network between the test master and each of the test slaves through the master-slave architecture communication protocol, comprising:

[0162] A communication timeout processing mechanism of the test master and the test slaves is constructed;

[0163] An indication instruction of the test master to the test slaves is determined;

[0164] An external perception mechanism of the test master is constructed;

[0165] Based on the communication timeout processing mechanism, the indication instruction, and the external perception mechanism, the communication network between the test master and each of the test slaves is constructed through the master-slave architecture communication protocol.

[0166] Optionally, the processor 301 executes the construction of the master-slave architecture communication business process based on the target test environment corresponding to the product under test, comprising:

[0167] When the target test environment corresponding to the product to be tested is a full-automatic environment, a master-slave architecture communication service process is constructed through a full-automatic production line;

[0168] When the target test environment corresponding to the product to be tested is a semi-automatic environment, a master-slave architecture communication service process is constructed through a semi-automatic production line;

[0169] When the target test environment corresponding to the product to be tested is a manual environment, a master-slave architecture communication service process is constructed through a manual production line.

[0170] Optionally, the processor 301 executes the master-slave architecture communication service process based on the product test instruction to control the test host to perform product testing on each of the slave machines to be tested, including:

[0171] Based on the master-slave architecture communication service process, a product test instruction is acquired when the test host is working;

[0172] Based on the product test instruction, the test host is controlled to perform product testing on each of the slave machines to be tested.

[0173] Optionally, the processor 301 executes the master-slave architecture communication service process based on the product test instruction to control the test host to perform product testing on each of the slave machines to be tested, including:

[0174] Based on the product test instruction, a product test type is determined;

[0175] If the product test type is a non-communication function test, the test host itself is tested and each of the slave machines to be tested is tested;

[0176] If the product test type is a communication function test, each of the slave machines to be tested is tested.

[0177] Optionally, the processor 301 executes the master-slave architecture communication service process based on the product test instruction to control the test host to perform product testing on each of the slave machines to be tested, including:

[0178] The test host is controlled to periodically send a request to acquire the sn code of each of the slave machines to be tested;

[0179] When each of the slave machines to be tested is powered on and working, a preparation state is entered, and the test host instruction is waited for;

[0180] After the test host requests the sn code of each of the slave machines to be tested, the sn code corresponding to the slave machine to be tested is replied to;

[0181] The test host determines whether the to-be-tested slave has completed testing after identifying the sn code of the to-be-tested slave.

[0182] If the to-be-tested slave has not completed testing, the to-be-tested slave is subjected to product testing.

[0183] Optionally, after selecting at least one of the to-be-tested products as a test host and the rest of the to-be-tested products as to-be-tested slaves based on a target trigger instruction, the processor 301 executes the method further comprising:

[0184] In the plurality of to-be-tested products, two of the to-be-tested products are selected as a first test host and a second test host, and the rest of the to-be-tested products are to-be-tested slaves, and the first test host is caused to run on a host test program and the second test host is caused to run on a host test program.

[0185] The first test host issues a first test instruction to each of the to-be-tested slaves, so that the to-be-tested slaves execute the first test instruction.

[0186] In an idle time of the to-be-tested slaves executing the first test instruction, a second test instruction issued by the second test host is synchronously executed.

[0187] In an idle time of the to-be-tested slaves executing the second test instruction, the to-be-tested slaves re-execute the first test instruction.

[0188] The embodiment of the application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement each process of the product testing method based on the master-slave architecture communication protocol provided by the embodiment of the application, and the same technical effects can be achieved. To avoid repetition, details are not described herein.

[0189] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by a computer program instructing related hardware. The program can be stored in a computer readable storage medium. When the program is executed, the processes of the above-mentioned embodiment method can be included. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM) or a random access memory (RAM).

[0190] The above only describes preferred embodiments of the application, and of course cannot limit the scope of the application. Therefore, equivalent changes made according to the claims of the application are still within the scope of the application.

Claims

1. A product testing method based on a master-slave architecture communication protocol, characterized in that: The method comprises the following steps: Load the slave tested program and the host test program onto the product to be tested; After the plurality of products to be tested are powered on, the slave tested program is run by default; At least one of the products to be tested is selected as a test host, and based on a target trigger instruction, the host test program is run, and the remaining products to be tested are tested slaves; wherein the test host and the tested slaves are the same product; Building a communication network between the test host and each of the slaves to be tested through a master-slave architecture communication protocol, and building a master-slave architecture communication business process based on the target test environment corresponding to the product to be tested; Based on the master-slave architecture communication service process, the test host is controlled to perform product testing on each of the slaves to be tested to obtain test results of the products to be tested.

2. The product testing method based on the master-slave architecture communication protocol according to claim 1, characterized in that: The communication network between the test host and each of the slaves to be tested is established by using a master-slave architecture communication protocol, including: Constructing a communication timeout processing mechanism between the test host and the slave to be tested; Determining an instruction from the test host to the slave device to be tested; Building an external perception mechanism for the test host; Based on the communication timeout processing mechanism, the indication instruction and the external perception mechanism, a communication network between the test host and each of the slaves to be tested is established through a master-slave architecture communication protocol.

3. The product testing method based on the master-slave architecture communication protocol according to claim 1, characterized in that: The process of constructing a master-slave architecture communication service process based on the target test environment corresponding to the product to be tested includes: When the target test environment corresponding to the product to be tested is a fully automatic environment, a master-slave architecture communication business process is constructed through a fully automatic production line; When the target test environment corresponding to the product to be tested is a semi-automatic environment, a master-slave architecture communication business process is constructed through a semi-automatic production line; When the target test environment corresponding to the product to be tested is an artificial environment, a master-slave architecture communication business process is constructed through an artificial production line.

4. The product testing method based on the master-slave architecture communication protocol according to claim 1, characterized in that: The controlling the test host to perform product testing on each of the slaves to be tested based on the master-slave architecture communication service process includes: Based on the master-slave architecture communication business process, when the test host is working, obtaining product test instructions; Based on the product test instruction, the test host is controlled to perform product testing on each of the slave devices to be tested.

5. The product testing method based on the master-slave architecture communication protocol according to claim 4, characterized in that: The controlling the test host to perform product testing on each of the slave devices to be tested based on the product test instruction includes: Determining a product test type based on the product test instruction; If the product test type is a non-communication function test, performing a product test on the test host itself and controlling the test host to perform a product test on each of the slaves to be tested; If the product test type is a communication function test, the test host is controlled to perform a product test on each of the slave devices to be tested.

6. The product testing method based on the master-slave architecture communication protocol according to claim 5, characterized in that: The controlling the test host to perform product testing on each of the slave devices to be tested includes: Controlling the test host to periodically send requests to obtain the sn code of each slave to be tested; When each of the slave devices to be tested is powered on, it enters a ready state and waits for instructions from the test host; After receiving the instruction from the test host requesting the sn code, the slave machine to be tested responds with the sn code corresponding to the slave machine to be tested; After the test host recognizes the sn code of the slave to be tested, it determines whether the slave to be tested has completed the test; If the slave machine to be tested has not completed the test, a product test is performed on the slave machine to be tested.

7. The product testing method based on the master-slave architecture communication protocol according to any one of claims 1 to 6, characterized in that: After selecting at least one of the products to be tested as a test host and running the host test program based on a target trigger instruction, and the remaining products to be tested as test slaves, the method further includes: Among the multiple products to be tested, two of the products to be tested are selected as a first test host and a second test host, and the remaining products to be tested are selected as slaves to be tested, and the first test host is made to run on a host test program, and the second test host is made to run on a host test program; The first test host issues a first test instruction to each of the slave machines to be tested, so that the slave machines to be tested execute the first test instruction; When the slave machine to be tested is idle while executing the first test instruction, synchronously executing the second test instruction issued by the second test host; When the slave machine to be tested is idle while executing the second test instruction, the slave machine to be tested re-executes the first test instruction.

8. A product testing device based on a master-slave architecture communication protocol, characterized in that: The product testing device based on the master-slave architecture communication protocol includes: The loading module is used to load the slave tested program and the host test program into the product under test; A running module, configured to run the slave tested program by default after the plurality of products to be tested are powered on; A first selection module is configured to select at least one of the products to be tested as a test host, and run the host test program based on a target trigger instruction, and the remaining products to be tested as test slaves; wherein the test host and the test slaves are the same product; A construction module is used to establish a communication network between the test host and each of the slaves to be tested through a master-slave architecture communication protocol, and to establish a master-slave architecture communication service process based on the target test environment corresponding to the product to be tested; The test module is used to control the test host to perform product testing on each of the slaves to be tested based on the master-slave architecture communication service process, and obtain test results of the products to be tested.

9. An electronic device, characterized in that: include: 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 steps of the product testing method based on the master-slave architecture communication protocol as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the product testing method based on the master-slave architecture communication protocol according to any one of claims 1 to 7.