Equipment testing method and device and readable storage medium

By generating device testing methods, and automatically generating test scripts using test parameters and script templates, the problem of long editing of test scripts in the existing technology is solved, improving testing efficiency and simplifying the testing process.

CN120029889APending Publication Date: 2025-05-23CONTEMPORARY AMPEREX FUTURE ENERGY RES INST (SHANGHAI) LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311515584.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-14
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

Existing device testing methods require editing and generating test scripts, resulting in a long test process and low efficiency.

Method used

By obtaining the test parameters of the device to be tested, the test script is generated based on the parameters and script templates, simplifying the generation process of the test script.

Benefits of technology

It shortens the time to generate test scripts, improves testing efficiency, and reduces the difficulty and workload of tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029889A_ABST
    Figure CN120029889A_ABST
Patent Text Reader

Abstract

The invention provides an equipment testing method and device and a readable storage medium, and relates to the technical field of equipment testing. The method comprises the steps of obtaining test parameters of to-be-tested equipment in a test process, generating a test script according to the test parameters and a script template, and then testing the to-be-tested equipment through the test script. According to the equipment testing method provided by the embodiment of the invention, only relevant testing parameters need to be set for the to-be-tested equipment when the testing script is generated, so that the generation process of the testing script becomes simple and rapid, the time for generating the testing script can be shortened, the time of the whole testing process can be shortened, and the testing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of equipment testing, and in particular to an equipment testing method, device and readable storage medium. Background Art

[0002] In the field of equipment testing, test scripts can not only realize automated testing of equipment, but also ensure the accuracy of test results. For example, before testing an embedded device, the user can edit and generate a test script and upload the test script to the host computer. During the test, the host computer executes the test script to control the action of the embedded device, monitors the embedded device, and then determines whether the embedded device has passed the test based on the monitoring results.

[0003] Currently, although automated testing of equipment can be achieved through test scripts, the test scripts need to be edited and generated before testing, and editing the test scripts usually takes a long time, which causes the entire testing process to take a long time, resulting in low test efficiency. Summary of the invention

[0004] The embodiments of the present application provide a device testing method, apparatus, and readable storage medium, which can improve the testing efficiency of the device.

[0005] In a first aspect, a device testing method is provided, comprising:

[0006] Obtain the test parameters of the device under test during the test process;

[0007] Generate a test script according to the test parameters and the script template;

[0008] The device under test is tested using the test script.

[0009] In the embodiment of the present application, during the device testing process, the test parameters of the device under test during the testing process are first obtained, a test script is generated according to the test parameters and the script template, and then the device under test is tested through the test script. In this way, when generating the test script, it is only necessary to set the relevant test parameters for the device under test, and because the script template is a pre-set script template, it is not necessary to perform semantic and grammatical checks, debugging, and optimization on the test script, making the test script generation process simple and fast, thereby shortening the time used to generate the test script, and further shortening the time of the entire test process, thereby improving the test efficiency.

[0010] Moreover, since no code editing is required, the user does not need to have code editing ability, which can significantly reduce the difficulty of testing. Also, when the test requirements and / or the device under test change, only the test parameters can be changed without re-editing the code, which can significantly reduce the workload during the test process.

[0011] In some embodiments, the test parameters include input parameters for controlling the action of the device under test, and output parameters for monitoring the change of the action of the device under test.

[0012] In the embodiment of the present application, the test script is generated by the input parameters and output parameters in the test process, so that the user only needs to set the input parameters and output parameters for the device under test during the test process. In this way, the test script generation process can be simplified, thereby shortening the time used to generate the test script, and further improving the test efficiency.

[0013] In some embodiments, generating a test script according to the test parameters and the script template includes:

[0014] Generate a configuration file according to the test parameters;

[0015] The configuration file is configured to the script template to obtain the test script.

[0016] In an embodiment of the present application, when a configuration file is constructed according to test parameters and a test script is generated according to the configuration file and a script template, a new test script can be quickly generated by replacing the configuration file, thereby simplifying the test script generation process and further improving test efficiency.

[0017] In some embodiments, the test parameters are M groups, each group of the test parameters is used to perform a test on the device under test, and M is an integer greater than 1.

[0018] In the embodiment of the present application, the test script may include multiple groups of test parameters. When the test script includes multiple groups of test parameters, the test script may perform multiple tests on the device under test. In this way, multiple tests may be performed through one test script, which may significantly improve the test efficiency.

[0019] In some embodiments, there are N devices under test, each set of the test parameters is used to perform a test on the device under test to which it belongs, and N is an integer greater than 1.

[0020] In an embodiment of the present application, test parameters of multiple devices under test can be obtained at one time during the process of generating a test script. The test script generated in this way can test the devices under test according to the test parameters of each device under test respectively, so that the test script can test multiple devices under test at one time, which can significantly improve the test efficiency.

[0021] In some embodiments, generating a test script according to the test parameters and the script template includes:

[0022] A test sequence is set for the M groups of test parameters in the test script, so that the test script tests the device under test according to each group of test parameters in turn according to the test sequence.

[0023] In the embodiment of the present application, when there are multiple groups of test parameters, a test sequence can be set for the multiple groups of test parameters during the process of generating a test script, so that the test script can perform multiple tests in sequence during the test process. When multiple tests affect each other, the degree of influence between the tests can be reduced, thereby reducing the probability of error during the test process and improving the accuracy of the test results.

[0024] In some embodiments, generating a test script according to the test parameters and the script template includes:

[0025] A judgment statement is set for the first group of parameters in the test script, so that the test script judges whether a test corresponding to the first group of parameters passes according to the judgment statement, and the first group of parameters is one of the M groups of test parameters.

[0026] In the embodiment of the present application, a judgment statement is set for each group of test parameters in the process of generating a test script. The judgment statement can instruct the test script to judge whether a corresponding test has passed according to the judgment method specified in the judgment statement during the test process. The setting of the judgment statement can facilitate the control of the judgment method during the test process, so that the test script can implement more complex tests.

[0027] In some embodiments, generating a test script according to the test parameters and the script template includes:

[0028] A test duration is set for a second group of parameters in the test script so that the test script controls the duration of a test corresponding to the second group of parameters according to the test duration, and the second group of parameters is one of the M groups of test parameters.

[0029] In an embodiment of the present application, a corresponding test duration is set for one or more tests of the device to be tested. The test duration can be used to control the duration of the test process, thereby controlling the duration of the entire test process, thereby improving the test efficiency.

[0030] In some embodiments, generating a test script according to the test parameters and the script template includes:

[0031] The constraint condition of the output parameter is configured for the test script, so that when the parameter value of the output parameter obtained by the test script satisfies the constraint condition, the test script determines whether the device under test passes the test according to the parameter value.

[0032] In an embodiment of the present application, constraints are set for output parameters. During the test process, the test script can determine whether the device under test has passed the test if the actual parameter value of the output parameter meets the constraint condition. Thus, the test result can be judged based on more accurate output parameters, thereby improving the accuracy of the test result.

[0033] In some embodiments, generating a test script according to the test parameters and the script template includes:

[0034] An address mapping table is configured for the test script, where the address mapping table is used to provide the test script with the address of the test parameter in the device under test.

[0035] In the embodiment of the present application, in the process of generating a test script, an address mapping table can be configured for the test script, and the test script can obtain the address of the test parameter from the address mapping table during the test process, and operate the test parameter according to the address of the test parameter. In this way, it is convenient for the test script to operate the test parameter according to the address of the test parameter to test the device under test.

[0036] In a second aspect, a device testing apparatus is provided, comprising:

[0037] An acquisition module is used to obtain the test parameters of the device under test during the test process;

[0038] A generation module, used to generate a test script according to the test parameters and the script template;

[0039] A test module is used to test the device under test through the test script.

[0040] In some embodiments, the test parameters include input parameters for controlling the action of the device under test, and output parameters for monitoring the change of the action of the device under test.

[0041] In some embodiments, the generating module is specifically used to generate a configuration file according to the test parameters; and configure the configuration file to the script template to obtain the test script.

[0042] In some embodiments, the test parameters are M groups, each group of the test parameters is used to perform a test on the device under test, and M is an integer greater than 1.

[0043] In some embodiments, there are N devices under test, each set of the test parameters is used to perform a test on the device under test to which it belongs, and N is an integer greater than 1.

[0044] In some embodiments, the generating module is further used to set a test sequence for the M groups of test parameters in the test script, so that the test script tests the device under test according to each group of test parameters in turn according to the test sequence.

[0045] In some embodiments, the generation module is also used to set a judgment statement for the first group of parameters in the test script, so that the test script determines whether a test corresponding to the first group of parameters passes according to the judgment statement, and the first group of parameters is one of the M groups of test parameters.

[0046] In some embodiments, the generation module is also used to set a test duration for a second group of parameters in the test script so that the test script controls the duration of a test corresponding to the second group of parameters according to the test duration, and the second group of parameters is one of the M groups of test parameters.

[0047] In some embodiments, the generation module is also used to configure the constraints of the output parameters for the test script, so that when the parameter value of the output parameter obtained by the test script meets the constraints, the test script determines whether the test device has passed the test based on the parameter value.

[0048] In some embodiments, the generating module is further used to configure an address mapping table for the test script, and the address mapping table is used to provide the test script with the address of the test parameter in the device under test.

[0049] In a third aspect, a readable storage medium is provided, on which a computer program is stored. When the computer program runs on a device testing apparatus, the device testing apparatus executes the device testing method provided in the first aspect.

[0050] In a fourth aspect, a device testing apparatus is provided, comprising: a processor; a memory; and a computer program, wherein the computer program is stored in the memory, and when the computer program is executed by the processor, the device testing apparatus executes the device testing method provided in the first aspect.

[0051] In a fifth aspect, a computer program product is provided, comprising: a computer program code, when the computer program code is run on a device testing apparatus, the device testing apparatus is enabled to execute the device testing method provided in the first aspect.

[0052] In a sixth aspect, a chip is provided, comprising: a processor for calling and running a computer program from a memory, so that a device testing apparatus equipped with the chip executes the device testing method provided in the aforementioned first aspect.

[0053] It can be understood that the equipment testing devices provided in the second and fourth aspects, the readable storage medium provided in the third aspect, the computer program product provided in the fifth aspect, and the chip provided in the sixth aspect are all used to execute the equipment testing method provided in the first aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A schematic diagram of the composition of a test script in the related art is shown.

[0055] Figure 2 A schematic diagram of a test scenario in the related art is shown.

[0056] Figure 3 A schematic diagram of a device testing scenario provided in an embodiment of the present application is shown.

[0057] Figure 4 A schematic diagram of a device testing scenario provided in an embodiment of the present application is shown.

[0058] Figure 5 A schematic diagram of a device testing scenario provided in an embodiment of the present application is shown.

[0059] Figure 6 A flow chart of a device testing method provided in an embodiment of the present application is shown.

[0060] Figure 7 A schematic diagram of a configuration interface provided in an embodiment of the present application is shown.

[0061] Figure 8 A schematic diagram of another configuration interface provided in an embodiment of the present application is shown.

[0062] Fig. 9 A schematic diagram of another configuration interface provided in an embodiment of the present application is shown.

[0063] Fig.10 A schematic diagram of a configuration interface provided in an embodiment of the present application is shown.

[0064] Fig.11 A flow chart of a device testing method provided in an embodiment of the present application is shown.

[0065] Fig.12 A flow chart of a device testing method provided in an embodiment of the present application is shown.

[0066] Fig.13 A structural schematic diagram of a device testing method provided in an embodiment of the present application is shown.

[0067] Fig.14 A structural block diagram of a device testing method provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0068] The technical solution in the present application will be described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0069] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0070] The term "comprising" herein indicates the presence of the described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections. The terms "comprising", "including", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized. Below, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise stated, the meaning of "multiple" is two or more.

[0071] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0072] At present, in order to improve the test efficiency during the equipment testing process, the common practice is to edit the test script according to the test requirements, control the equipment action and monitor the equipment through the test script, and then determine whether the equipment passes the test based on the monitoring results.

[0073] For example, when testing whether the switch function of a certain switch element included in the embedded device is normal, a test script can be edited and generated, and the test script can be uploaded to the host computer. During the test, the host computer is connected to the embedded device communication, and the host computer executes the test script, and sends the preset parameter value of the control parameter (also referred to as the input parameter) to the embedded device, and the control parameter is a parameter for controlling the action of the switch element in the embedded device. Afterwards, the host computer can monitor the embedded device, and obtain the actual parameter value of one or more parameters (commonly referred to as output parameters or monitoring parameters) related to the switch state of the switch element from the embedded device. Then, the host computer can judge whether the switch function of the switch element is normal according to the actual parameter value obtained, and determine that the embedded device test passes when judging that the switch function of the switch element is normal. It should be understood that the above is only an exemplary example, and the equipment in the embodiment of the present application may include but is not limited to the embedded device.

[0074] See also Figure 1 , Figure 1 FIG. 1 shows a schematic diagram of the composition of a test script in the related art. Figure 1 As shown, the test script includes a code module for controlling the test process, and also includes test parameters of the device under test, such as the input parameters and output parameters in the above examples, and other parameters used in the test process. In the process of editing the test script, it is necessary not only to set the corresponding code and parameters for each step in the test process, but also to check the semantics and syntax of the test script, as well as to debug and optimize the test script, etc., so editing the test script may take a long time.

[0075] Moreover, the code modules in the test scripts are bound to the test parameters. When testing different devices, it is necessary to edit and generate corresponding test scripts for different devices, which is a lot of work. Figure 2 As shown, Figure 2 A schematic diagram of a test scenario in the related art is shown. When three devices need to be tested, since the code module in the test script is bound to the test parameters of the device, it is necessary to edit and generate a first test script 21 for the device according to the first test parameter of one of the devices, edit and generate a second test script 22 for the device according to the second test parameter of one of the devices, and edit and generate a third test script 23 for the device according to the third test parameter of one of the devices.

[0076] Furthermore, when the test target of a device changes, the test parameters used in the test process will also change. For example, when the test target is to test the switch element in the embedded device, a test script needs to be edited and generated, and when the test target is to test other functional modules in the embedded device, another test script needs to be edited and generated. Since the code module in the test script is bound to the test parameters, when the test target of the device under test changes, the previously edited and generated test script will no longer be able to test the device, and a new test script needs to be re-edited to test the device.

[0077] For the above reasons, each time the device is tested, a new test script needs to be edited and generated according to the test objectives and test parameters used in the test process. Editing the test script may take a long time, which causes the entire test process to take a long time, resulting in low test efficiency.

[0078] In order to solve the above technical problems, the embodiment of the present application provides a device testing method, which uses the similar characteristics of the test process to set a general script template, and the script template includes a code module for controlling the test process. Before the test, the test parameters of the device under test are obtained, and a test script for the device under test is generated through the script template and the test parameters. Since the test script includes both the code for controlling the test process and the test parameters of the device under test, the device under test can be tested through the test script.

[0079] In this way, in the process of generating the test script, you only need to set the relevant test parameters for the device under test, and there is no need to edit the code. Moreover, since the script template is a pre-set script template, there is no need to check the semantics and syntax of the test script, as well as debug and optimize the test script, making the test script generation process simple and fast, thereby shortening the time used to generate the test script, and further shortening the time of the entire test process, improving test efficiency.

[0080] Moreover, in the related art, the code module in the test script is bound to the test parameters. When the test target and / or the device under test sends a change, the test script needs to be re-edited, which is a large workload and leads to low test efficiency. In the device testing method provided in the embodiment of the present application, the test process is controlled by the code module in the script template. When the test script is generated by the script template and the test parameters, the code and the test parameters can be untied. When the test target and / or the device under test changes, only the test parameters need to be changed, and there is no need to re-edit the code. Therefore, the workload in the test process can be significantly reduced and the test efficiency can be improved.

[0081] Also, in the related art, the editing of the test script requires the user to have certain code editing capabilities, which is difficult. However, in the device testing method provided in the embodiment of the present application, since code editing is not required, the user does not need to have code editing capabilities, which can significantly reduce the difficulty of testing.

[0082] Among them, the code in the script template is used to control the test process, and the code in the script template can be specifically set according to the test process. For example, in the test process of an embedded device, it is generally only necessary to send the preset parameter value of the input parameter to the embedded device, and then obtain the actual parameter value of the output parameter from the embedded device, and finally determine whether the embedded device has passed the test based on the actual parameter value. Based on this, a general script template can be set for the embedded device, and the script template includes a first functional module for sending the preset parameter value of the input parameter, a second functional module for obtaining the actual parameter value of the output parameter from the embedded device, and a third functional module for determining whether the embedded device has passed the test based on the actual parameter value obtained. The first functional module, the second functional module and the third functional module are code modules in the test script. It should be understood that when other operations need to be performed during the test process, other functional modules may also be included in the script template.

[0083] In the process of generating a test script based on test parameters and a script template, the code module in the script template can be associated with the test parameters of the device under test, so that the code module in the script template can operate the test parameters and test the device under test according to the test parameters. For example, a configuration file can be constructed based on the test parameters, and the configuration file can be configured to the script template, so that the code module in the script template can obtain the test parameters from the configuration file, so that the configuration file can be associated with the script template to obtain the test script.

[0084] Taking the script template of an embedded device as an example, after the configuration file is configured to the script template, the first functional module in the test script can access the configuration file, obtain the preset parameter value of the input parameter from the configuration file, and send the preset parameter value of the input parameter to the device under test. The second functional module can determine the output parameter from the configuration file and obtain the actual parameter value of the output parameter from the embedded device. The third functional module can determine whether the device under test has passed the test based on the actual parameter value obtained.

[0085] For another example, a configuration file can be set in advance for the script template, and the code in the script template can access the data in the configuration file. In the process of generating a test script, the test parameters of the device under test can be added to the configuration file to obtain a test script consisting of a script template and a configuration file including the test parameters, thereby realizing the binding of the test parameters with the script template. For another example, the test parameters can be stored in a preset position of the host computer, and the access address of the script template can be pointed to the preset position, so that the code in the script template can read the test parameters from the preset position, that is, the script template is associated with the test parameters, and the script template after the test parameters are associated is the test script. The above are only exemplary examples, and the specific method of generating a test script based on the script template and the test parameters may include but is not limited to the above examples.

[0086] See also Figure 3 , Figure 3 A schematic diagram of a device testing scenario provided by an embodiment of the present application is shown. Figure 3 As shown, the device test scenario includes a user 31, a host computer 32 and a device to be tested 33. The host computer 32 can be a computer, a tablet computer, an industrial computer and the like. The script template (the script template includes Figure 3 The code module shown in the figure may be a software module running in a host computer. A configuration module is also installed in the host computer 32. The configuration module may provide a user interface to the user to receive test parameters input by the user through the user interface and provide test parameters for the script template.

[0087] Before testing the device 33 under test, the user 31 can input the test parameters of the device 33 under test to the upper computer through the configuration module. The configuration module can construct a configuration file based on the test parameters, and then transmit the configuration file to the script template. At this time, the script template and the configuration file are combined to obtain a test script, and the test script can test the device 33 under test according to the test parameters in the configuration file.

[0088] See also Figure 4 , Figure 4 A schematic diagram of a device test scenario provided by an embodiment of the present application is shown. The device test scenario includes a user 31, a host computer 32, and a device to be tested 33. The configuration module and the code module in the host computer 32 can be integrated into a software module. After the user 31 inputs the test parameters of the device to be tested 33 to the host computer 32 through the configuration module, the configuration module can create a configuration file based on the test parameters, and store the configuration file in a preset location in the host computer 32, so as to associate the configuration file with the script template to obtain a test script. At this time, after the script template is started, the code module in the script template can access the configuration file from the preset location, and obtain the test parameters from the configuration file to test the device to be tested 33.

[0089] See also Figure 5 , Figure 5 A schematic diagram of a device test scenario provided by an embodiment of the present application is shown. The device test scenario includes a host computer 32, a first device under test 331, a second device under test 332, and a third device under test 333. The test processes of the first device under test 331, the second device under test 332, and the third device under test 333 are similar, and a script template can be shared.

[0090] During the process of testing the first device under test 331, the user can input the first test parameter 34 of the first device under test 331 to the upper computer 32, and the configuration module can generate a first configuration file based on the first test parameter 34, and configure the first configuration file to the script template to obtain a first test script. At this time, the first test script can test the first device under test 331.

[0091] Similarly, in the process of testing the second device under test 332, the user can input the second test parameter 35 of the second device under test 332 to the upper computer 32, and the configuration module can generate a second configuration file based on the second test parameter 35, and configure the second configuration file to the script template to obtain a second test script. At this time, the second test script can test the second device under test 332.

[0092] Similarly, in the process of testing the third device under test 333, the user can input the third test parameter 36 of the third device under test 333 to the upper computer 32, and the configuration module can generate a third configuration file based on the third device under test 333, and configure the third configuration file to the script template to obtain a third test script. At this time, the third test script can test the third device under test 333.

[0093] Alternatively, the user can input the first test parameter 34, the second test parameter 35 and the third test parameter 36 into the host computer 32 at the same time. The configuration module can generate a configuration file based on the first test parameter 34, the second test parameter 35 and the third test parameter 36, and configure the configuration file to the script template to obtain a test script. At this time, the test script can use the first test parameter 34, the second test parameter 35 and the third test parameter 36 in the configuration file to test the first device under test 331, the second device under test 332 and the third device under test 333 respectively. It should be understood that the number of devices under test can be specifically set according to the test requirements.

[0094] In actual applications, when a new test script needs to be generated, the configuration file in the script template can be directly replaced to obtain a new test script. For example, after a first configuration file is constructed according to a first test parameter, and a first test script is generated according to the first configuration file and the script template to test a first device under test, a second configuration file can be constructed according to a second test parameter, and after the first configuration file in the script template is replaced with the second configuration file, a second test script can be generated according to the second configuration file and the script template to test a second device under test.

[0095] See also Figure 6 , Figure 6 The schematic diagram of the flow chart of a device testing method 100 provided in the embodiment of the present application is shown. The execution subject of the device testing method 100 may be Figure 3-5 The host computer shown in Figure 1 is as follows. Figure 6 As shown, the method may include:

[0096] Step 110: Acquire test parameters of the device under test during the test process.

[0097] Step 120: Generate a test script according to the test parameters and the script template.

[0098] In this embodiment, in the process of generating the test script, the test parameters obtained by the configuration module may include input parameters and output parameters used by the device under test during the test process. Input parameters refer to parameters that need to send preset parameter values ​​to the device under test during the test process, and the input parameters are used to control the action of the device under test during the test process. Output parameters refer to parameters related to input parameters. After the action of the device under test is controlled by the input parameters, the actual parameter values ​​of the output parameters in the device under test will change, so the actual parameter values ​​can represent the action changes of the device under test after the device under test is controlled.

[0099] Taking an embedded device as an example, when testing whether the switch function of a switch element included in the embedded device is normal, the input parameter may be a parameter used to control the action of the switch element in the embedded device, and the output parameter may be a state parameter of a signal indicator light integrated in the embedded device. When the control parameter is 0, the embedded device controls the switch element to be disconnected, at which time the signal indicator light is turned off, and the state parameter of the signal indicator light becomes 0; when the control parameter is 1, the embedded device controls the switch element to be closed, at which time the signal indicator light is on, and the state parameter of the signal indicator light becomes 1.

[0100] Before starting to test the embedded device, the user can predetermine the input parameters and output parameters required in the process of testing the switch function of the switch element, as well as the preset parameter value of the input parameter (for example, 1) and the expected parameter value of the output parameter (for example, 1). Then, the user can input parameter information of the input parameter to the upper computer, and the parameter information of the input parameter may include the parameter name of the input parameter (hereinafter referred to as the first parameter name) and the preset parameter value. Similarly, the user can input parameter information of the test parameter to the upper computer, and the parameter information of the output parameter may include the parameter name of the output parameter (hereinafter referred to as the second parameter name) and the expected parameter value. It should be understood that the parameter information of the input parameter and the output parameter may include, but is not limited to, information such as the parameter name, the preset parameter value and the expected parameter value, and may also include other parameter information required during the test process.

[0101] Correspondingly, after receiving the parameter information of the input parameters and the output parameters, the configuration module in the host computer can create a configuration file, such as an extensible markup language (XML) file. Afterwards, the configuration module can add a set of information to the configuration file, which includes the first parameter name and preset parameter value of the input parameter, and the second parameter name and expected parameter value of the output parameter. Then, the configuration module can transfer the configuration file to the script template, and the script template is associated with the configuration file to obtain a test script. As in the above example, the configuration module can also associate the script template with the test parameters in other ways to obtain a test script.

[0102] It should be noted that the specific types of input parameters and output parameters may include but are not limited to the above examples. In the process of testing the device under test, there may be one or more input parameters and one or more output parameters. When there are multiple input parameters and output parameters, parameter information of each input parameter and output parameter may be obtained respectively, and the parameter information may be stored in a configuration file.

[0103] Step 130: Test the device to be tested using the test script.

[0104] For example, after obtaining the test script, the host computer can run the test script. At this time, the test script can parse the configuration file, obtain the first parameter name and the preset parameter value of the input parameter from the configuration file, and then send a control instruction to the device under test, the control instruction including the first parameter name and the preset parameter value.

[0105] Correspondingly, after receiving the control instruction, the embedded device can parse the control instruction and obtain the first parameter name and the preset parameter value from the control instruction. Afterwards, the embedded device can control the switch element according to the first parameter name and the preset parameter value to control the switch element to close. At this time, if the switch function of the switch element is normal, the signal indicator light will light up normally, and if the switch function of the switch element is abnormal, the signal indicator light will not be lit.

[0106] After sending the preset parameter value of the input parameter to the embedded device, the test script can parse the configuration file, obtain the second parameter name and expected parameter value of the output parameter from the configuration file, and send a read request to the embedded device, the read request including the second parameter name. After receiving the read request, the embedded device can respond to the read request, obtain the parameter value of the state parameter at the current moment (i.e., the actual parameter value) according to the second parameter name in the read request, and send the actual parameter value to the host computer.

[0107] After receiving the actual parameter value of the output parameter, the test script compares the actual parameter value with the expected parameter value. If the actual parameter value is the same as the expected parameter value (both are 1), it can be determined that the switching function of the switch element is normal and the embedded device test passes. On the contrary, if the actual parameter value is different from the expected parameter value, it can be determined that the switching function of the switch element is abnormal and the embedded device test fails.

[0108] In some embodiments, when the test script needs to operate the test parameters according to the addresses of the test parameters in the device under test during the test process, the user can also predetermine the address of the input parameter in the device under test (hereinafter referred to as the first address), and determine the address of the output parameter in the device under test (hereinafter referred to as the second address). In the process of inputting parameter information to the host computer, the user can also input the first address and the second address to the host computer.

[0109] Correspondingly, the configuration module can add the first address of the input parameter and the second address of the output parameter in the configuration file. During the test process, the test script can obtain the first address from the configuration file, send the preset parameter value of the input parameter to the device under test according to the first address, and obtain the second address from the configuration file, and obtain the actual parameter value of the output parameter from the device under test according to the second address.

[0110] It should be noted that the test process of the device under test may include but is not limited to the above examples. The test process is controlled by the code in the script template. The user can design the code in the script template according to the test requirements so that the code in the script template can control the test process.

[0111] In the embodiment of the present application, during the device testing process, the test parameters of the device under test during the testing process are first obtained, a test script is generated according to the test parameters and the script template, and then the device under test is tested through the test script. In this way, when generating the test script, it is only necessary to set the relevant test parameters for the device under test, and because the script template is a pre-set script template, it is not necessary to perform semantic and grammatical checks, debugging, and optimization on the test script, making the test script generation process simple and fast, thereby shortening the time used to generate the test script, and further shortening the time of the entire test process, thereby improving the test efficiency.

[0112] Moreover, since no code editing is required, the user does not need to have code editing ability, which can significantly reduce the difficulty of testing. Also, when the test requirements and / or the device under test change, only the test parameters can be changed without re-editing the code, which can significantly reduce the workload during the test process.

[0113] Optionally, the test parameters include input parameters for controlling the action of the device under test, and output parameters for monitoring the change of the action of the device under test.

[0114] In some embodiments, the test parameters include input parameters and output parameters, as well as preset parameter values ​​of the input parameters, the preset parameter values ​​of the input parameters are used to control the action of the device under test, and the actual parameter values ​​of the output parameters can represent the action changes of the device under test. When the action changes represented by the actual parameter values ​​match the preset parameter values, it can be determined that the device under test has passed the test. During the test process, the test script can first send the preset parameter values ​​of the input parameters to the device under test, control the action of the device under test through the preset parameter values, and then obtain the actual parameter values ​​of the output parameters from the device under test, and judge whether the action changes of the device under test match the preset parameter values ​​through the actual parameter values ​​of the output parameters, so as to determine whether the device under test has passed the test.

[0115] As in the above example, in the process of testing whether the switching function of the switching element in the embedded device is normal, if the actual parameter value obtained is 1, it can be determined that the signal indicator light in the embedded device is lit, that is, the action change of the embedded device meets expectations and matches the preset parameter value (the preset parameter value is used to control the switching element to open and light up the signal indicator light).

[0116] It should be understood that in the process of generating the test script, parameter information such as the parameter name, address, actual parameter value, and expected parameter value of the test parameter can also be obtained to test the device under test according to the parameter information of the test parameter. The specific method of testing the device under test according to the test parameter can refer to the above example, and this embodiment will not be repeated here.

[0117] In the embodiments of the present application, a test script is generated based on the input parameters and output parameters during the test process, such that the user only needs to set the input parameters and output parameters for the device under test during the test process. In this way, the generation process of the test script can be simplified, thereby shortening the time taken to generate the test script, and further improving the test efficiency.

[0118] Optionally, the step of generating a test script according to test parameters and a script template may include:

[0119] Generate a configuration file according to the test parameters;

[0120] Configure the configuration file to the script template to obtain a test script.

[0121] In some embodiments, during the process of generating a test script according to test parameters and a script template, a configuration file of the script template may be generated according to the test parameters, and then the configuration file is configured to the script template to obtain a test script composed of the script template and the configuration file. As Figure 1 shown, after obtaining the test parameters used during the test process, the configuration module may construct a configuration file according to the test parameters. The parameter information of the input parameters and the parameter information of the output parameters are stored in the configuration file. Then, the configuration module may transmit the configuration file to the script template. At this time, the script template has both a code module for controlling the test process and the test parameters of the device under test. Therefore, the script template (i.e., the test script) can test the device under test.

[0122] In practical applications, when generating a test script based on a configuration file and a script template, when a new test script needs to be generated, the configuration file can be directly replaced to obtain a new test script. For example, after constructing configuration file A according to the test parameters of device under test A, generating a test script according to configuration file A and the script template to test device under test A, configuration file B can be constructed according to the test parameters of device under test B. After replacing configuration file A with configuration file B, a test script can be generated according to configuration file B and the script template to test device under test B.

[0123] In the embodiments of the present application, when constructing a configuration file according to test parameters and generating a test script according to the configuration file and the script template, a new test script can be quickly generated by replacing the configuration file, thereby simplifying the generation process of the test script and further improving the test efficiency.

[0124] Optionally, during the process of generating a test script according to test parameters and a script template, the method may further include:

[0125] Configure an address mapping table for the test script. The address mapping table is used to provide the addresses of the test parameters in the device under test to the test script.

[0126] For example, in the process of generating a test script, the configuration module can obtain the addresses of the input parameters and the output parameters in the device under test, as well as the parameter names of the input parameters and the output parameters, and then create an address mapping table, which includes the first parameter name and the first address of the input parameter, and the second parameter name and the second address of the output parameter. Afterwards, the configuration module can transfer the address mapping table to the script template to configure the address mapping table to the test script.

[0127] Optionally, the addresses of the input parameters and output parameters can be manually input into the configuration module by the user. Alternatively, the user can pre-set an address mapping file in the host computer, and store the parameter names and addresses of the input parameters and output parameters of all the devices under test that need to be tested during the test in the address mapping file. In the process of generating the test script, the configuration module can obtain the addresses of the input parameters and output parameters from the address mapping file according to the parameter names of the input parameters and output parameters, and then construct an address mapping table according to the addresses of the input parameters and output parameters, and configure the address mapping table to the host computer.

[0128] During the test process, the test script can obtain the first parameter name and preset parameter value of the input parameter from the configuration file, and then obtain the first address of the input parameter from the address mapping table according to the first parameter name, and then send the preset parameter value of the input parameter to the device under test according to the first address. Similarly, after sending the preset parameter value of the input parameter to the device under test, the test script can obtain the second parameter name and expected parameter value of the output parameter from the configuration file, and then obtain the second address of the output parameter from the address mapping table according to the second parameter name, and then obtain the actual parameter value of the output parameter from the device under test according to the second address.

[0129] In some embodiments, for the devices to be tested, the user can pre-set an address mapping table in the host computer, and store the parameter names and addresses of the input parameters and output parameters of all the devices to be tested during the test in the address mapping table. In the process of generating a test script, the address mapping table can be directly configured to the test script, so that the addresses of the test parameters can be quickly configured to the test script. In this way, the user does not need to input the addresses of the input parameters and output parameters when inputting parameter information to the host computer, thereby simplifying user operations and improving test efficiency.

[0130] In the embodiment of the present application, in the process of generating a test script, an address mapping table can be configured for the test script, and the test script can obtain the address of the test parameter from the address mapping table during the test process, and operate the test parameter according to the address of the test parameter. In this way, it is convenient for the test script to operate the test parameter according to the address of the test parameter to test the device under test.

[0131] Optionally, there are M groups of test parameters, each group of test parameters is used to perform a test on the device under test, and M is an integer greater than 1, such as 2, 4, 7, 8, etc.

[0132] Exemplarily, when multiple tests need to be performed on the device under test, the user can input a set of test parameters corresponding to each test to the host computer. When the configuration module receives multiple groups (i.e., multiple groups, i.e., M groups) of test parameters input by the user, each group of test parameters can be stored separately in the configuration file. Correspondingly, during the process of testing the device under test, the test script can perform a test on the device under test according to each group of test parameters, so as to perform multiple tests on the device under test.

[0133] For example, for an embedded device, if it is necessary to test whether the switch functions of two switch elements in the embedded device are normal, the user can first input a set of test parameters to the host computer, which is used to test one of the switch elements, and then input another set of test parameters to the host computer, which is used to test the other switch element. The configuration module can store two sets (i.e., M sets) of test parameters in the configuration file.

[0134] During the testing process, the test script can first use a set of test parameters to test a switching element in the embedded device, that is, obtain the preset parameter value of the input parameter from the set of test parameters, and send the preset parameter value to the device under test, and then obtain the actual parameter value of the output parameter in the set of test parameters from the device under test, and finally determine whether the switching function of the switching element is normal based on the actual parameter value, that is, determine whether a test corresponding to the set of test parameters has passed.

[0135] Afterwards, the test script may use another set of test parameters to test another switch element in the embedded device to determine whether the switch function of the other switch element is normal, that is, to determine whether a test corresponding to the set of input parameters passes.

[0136] Optionally, when the two tests do not affect each other, the test script can use two sets of test parameters to test the device under test at the same time, that is, the two tests of the device under test can be performed at the same time.

[0137] See also Figure 7 , Figure 7 FIG. 7 is a schematic diagram of a configuration interface 70 provided in an embodiment of the present application. The configuration interface 70 may be provided to a user by a configuration module for configuring a set of test parameters. Figure 7 As shown, the configuration interface 70 includes a title bar 71, a first configuration area 72 and a second configuration area 73. The first configuration area 72 is used to configure input parameters, and the second configuration area 73 is used to configure output parameters.

[0138] The title bar 71 displays the identification "Step 1" of a set of test parameters currently configured. A set of test parameters can be called a test step. The test script can perform a test on the device under test according to the test parameters in a test step. The user can enter parameter information of each input parameter included in the set of test parameters in the first configuration area 72, such as the parameter name of the input parameter (i.e. Figure 7 The first parameter name "In1" shown) and the address (i.e. Figure 7 The first address Dev1 is shown in the figure, as well as the description information, data type and legal range of the input parameter, and the corresponding parameter value (i.e., the preset parameter value) is set for the input parameter. The description information is used to indicate the function and role of the input parameter in the device under test, the data type is the data type of the input parameter, and the legal range is the value range of the input parameter, for example Figure 7 The input parameters shown can take values ​​of 1 or 0.

[0139] Similarly, the user can enter parameter information of each output parameter included in the set of test parameters in the second configuration area 73, such as the parameter name of the output parameter (i.e. Figure 7 The second parameter name "Out1" is shown), as well as the valid value of the output parameter (i.e., the expected parameter value), description information, data type and legal range, etc.

[0140] When the set of test parameters includes multiple input parameters, the user can input parameter information of the multiple input parameters in the first configuration area 72. Similarly, when the set of test parameters includes multiple output parameters, the user can input parameter information of the multiple output parameters in the second configuration area 73.

[0141] Optionally, the user may create an information storage file in advance in the host computer, and the information storage file stores the parameter information of all input parameters included in each device under test, as well as the parameter information of all output parameters. When the user inputs the parameter information of a certain input parameter to the host computer, he may only input the first parameter name and the preset parameter value of the input parameter. Correspondingly, the configuration module may determine other parameter information of the input parameter from the information storage file according to the first parameter name of the input parameter, and automatically input the parameter information of the input parameter in the first configuration area 72.

[0142] Similarly, when the user inputs parameter information of a certain output parameter to the host computer, he can only test the second parameter name of the parameter. The configuration module can determine other parameter information of the output parameter from the information storage file according to the second parameter name of the output parameter, and automatically test the parameter information of the parameter in the second configuration area 73. The above are only illustrative examples, and the specific method of inputting parameter information may include but is not limited to the above examples.

[0143] See also Figure 8, Figure 8 FIG. 8 is a schematic diagram of another configuration interface 80 provided in an embodiment of the present application. Figure 8 As shown, after creating the test step Step1 (i.e., adding a set of test parameters), the user can click on the blank area in the title bar, and the configuration module can display the creation window 75 in response to the user's click operation. The creation window 75 can display an insert control 751, and when the user clicks on the insert control 751, the configuration module can create a new test step in response to the user's click operation. After creating a new test step, the user can configure the test parameters for the new test step according to the corresponding configuration interface to add a corresponding set of test parameters.

[0144] Among them, other controls can also be displayed in the creation window 75. The user can operate other controls in the creation window 75 to delete the created test steps (that is, delete a set of test parameters corresponding to the test steps), or rename the test steps to change the identification of the test steps.

[0145] See also Fig. 9 , Fig. 9 FIG. 9 is a schematic diagram of another configuration interface 90 provided in an embodiment of the present application. Fig. 9 As shown, the second test step identifier “Step 2 ” is displayed in the title bar 71 . Similarly, for the second test step, the user can input parameter information of each input parameter in the first configuration area 72 , and input parameter information of each output parameter in the second configuration area 73 .

[0146] Combination Figure 7-9 , after the user configures the parameter information of the input parameters and output parameters for each test step, the configuration module can obtain multiple test steps, that is, multiple groups of test parameters. In the process of generating the configuration file, the configuration module stores each group of test parameters in the configuration file in groups. Correspondingly, during the test process, the test script obtains each group of test parameters from the configuration file in groups, and performs a test on the device under test according to each group of test parameters.

[0147] It should be understood that the method of inputting each set of test parameters to the upper computer may include but is not limited to Figure 7-9 As shown, the user can also input one or more groups of test parameters to the host computer in other ways.

[0148] In the embodiment of the present application, the test script may include multiple groups of test parameters. When the test script includes multiple groups of test parameters, the test script may perform multiple tests on the device under test. In this way, multiple tests may be performed through one test script, which may significantly improve the test efficiency.

[0149] Optionally, there are N devices under test, and each set of test parameters is used to perform a test on the device under test. N is an integer greater than 1, such as 2, 3, 9, 11, etc.

[0150] In some embodiments, when there are multiple devices under test (i.e., multiple N devices), one or more groups of test parameters may be set for each device under test. Figure 7-9 As shown, when the devices to be tested include device A and device B, the user can set test step Step1 for device A and configure a set of test parameters for test step Step1, and set test step Step2 for device B and configure a set of test parameters for test step Step2.

[0151] After configuring the configuration file to the script template to obtain the test script, the test script can test the device A under test according to a set of test parameters corresponding to the test step Step1, and test the device B under test according to a set of test parameters corresponding to the test step Step2.

[0152] Optionally, the address of each device under test may be stored in the address mapping table, and the address of the device under test refers to the network address of the device under test in the network formed by the host computer and the device under test. When the test script tests the device under test according to the test parameters, it may obtain the address of the test parameter in the device under test and the address of the device under test from the address mapping table, and then send the preset parameter value of the input parameter to the device under test according to the address of the input parameter and the address of the device under test, and obtain the parameter value of the output parameter from the device under test according to the address of the device under test and the address of the output parameter.

[0153] When there are multiple devices under test, if the tests of the multiple devices under test do not affect each other, during the test process, the test script can use the test parameters of the multiple devices under test to test the multiple devices under test at the same time.

[0154] In an embodiment of the present application, test parameters of multiple devices under test can be obtained at one time during the process of generating a test script. The test script generated in this way can test the devices under test according to the test parameters of each device under test respectively, so that the test script can test multiple devices under test at one time, which can significantly improve the test efficiency.

[0155] Optionally, in the process of generating a test script according to the test parameters and the script template, the method may further include:

[0156] A test sequence is set for the M groups of test parameters in the test script, so that the test script tests the device to be tested according to each group of test parameters in turn according to the test sequence.

[0157] Exemplarily, when there are multiple groups of test parameters, the configuration module can sequentially store each group of test parameters in the configuration file, and the storage order of the multiple groups of test parameters in the configuration file is the test order. After the test script is generated, the test script can sequentially read each group of test parameters from the configuration file during operation, and then test the device to be tested according to each group of test parameters in turn.

[0158] like Figure 7-9 As shown, when the user creates each test step in sequence, the configuration module can store a set of test parameters corresponding to each test step in the configuration file in sequence according to the creation order of multiple test steps (i.e., the test order) during the process of generating the configuration file. In this way, during the test process, the test script can perform a test on the device under test in sequence according to each set of test parameters according to the creation order of the test steps.

[0159] Alternatively, in the process of creating a configuration file, after the configuration module stores each set of test parameters in the configuration file, the multiple sets of test parameters can be marked in the order of creation of multiple test steps to mark the order of creation of the multiple sets of test parameters (i.e., the test order). Alternatively, in the process of generating a configuration file, the configuration module can randomly store each set of test parameters in the configuration file, and the test order is the order in which the multiple sets of test parameters are stored in the configuration file. The above are only exemplary examples, and the specific method of setting the test order of multiple sets of test parameters may include but is not limited to the above examples.

[0160] In the embodiment of the present application, when there are multiple groups of test parameters, a test sequence can be set for the multiple groups of test parameters during the process of generating a test script, so that the test script can perform multiple tests in sequence during the test process. When multiple tests affect each other, the degree of influence between the tests can be reduced, thereby reducing the probability of error during the test process and improving the accuracy of the test results.

[0161] Optionally, in the process of generating a test script according to the test parameters and the script template, the method may further include:

[0162] A judgment statement is set for the first group of parameters in the test script, so that the test script judges whether a test corresponding to the first group of parameters passes according to the judgment statement, and the first group of parameters is one of the M groups of test parameters.

[0163] Exemplarily, the configuration module may set a judgment statement for each group of test parameters, or set a judgment statement for part of multiple groups of test parameters, and the judgment statement may include output parameters. During the test process, after obtaining the actual parameter value of the output parameter, the test script may substitute the actual parameter value of the output parameter into the judgment statement, and judge whether the device under test passes the test according to the judgment statement.

[0164] like Figure 7 As shown, the configuration interface 70 also includes a third configuration area 74, and the third configuration area 74 includes a configuration window 741. In the process of setting input parameters and output parameters for the test step Step1, the user can enter the judgment statement "Out1&&EndTime" for a set of test parameters (i.e., the first set of parameters) corresponding to the test step Step1 in the configuration window 741. Out1 in the judgment statement is the output parameter in the test step Step1, the symbol && is an AND relationship, and EndTime is the test duration of the test step Step1, which is 1000ms. The test duration is used to control the duration of the test step and does not participate in the result determination. In the process of generating a configuration file, the configuration module can store a set of test parameters corresponding to the test step Step1 in the configuration file, and store the judgment statement "Out1&&EndTime" accordingly.

[0165] When testing the device under test according to the test parameters in the test step Step1, after obtaining the actual parameter value of the output parameter, the test script substitutes the actual parameter value of the output parameter into the judgment statement. If the result of the judgment statement is true (that is, the actual parameter value of the output parameter Out1 is 1), it is determined that a test corresponding to the test step Step1 has passed. On the contrary, if the result of the judgment statement is false (that is, the actual parameter value of the output parameter Out1 is 0), it is determined that a test corresponding to the test step Step1 has not passed.

[0166] like Figure 8 As shown, in the process of setting input parameters and output parameters for the test step Step2, the user can enter a judgment statement "Out3&&Out4||EndTime" for a set of test parameters corresponding to the test step Step2 (i.e., the first set of parameters) in the configuration window 741, where Out3 is an output parameter in a set of test parameters corresponding to the test step Step2, Out4 is another output parameter, the symbol || is an OR relationship, and EndTime is the test duration of the test step Step2, 1000ms, and the test duration does not participate in the determination of the test results.

[0167] When testing the device under test according to the test parameters in the test step Step2, after obtaining the actual parameter value of the output parameter Out3 and the actual parameter value of the output parameter Out4, the test script substitutes the actual parameter value of the output parameter Out3 and the actual parameter value of the output parameter Out4 into the judgment statement. If the result of the actual parameter value of the output parameter Out3 and the actual parameter value of the output parameter Out4 is true, it is determined that a test corresponding to the test step Step2 has passed. On the contrary, if the result of the actual parameter value of the output parameter Out3 and the actual parameter value of the output parameter Out4 is false, it is determined that a test corresponding to the test step Step2 has not passed.

[0168] The judgment statement may be manually input by the user or may be set by the configuration module according to a default rule. The above are only exemplary examples, and the specific form of the judgment statement may include but is not limited to the above examples.

[0169] In the embodiment of the present application, a judgment statement is set for each group of test parameters in the process of generating a test script. The judgment statement can instruct the test script to judge whether a corresponding test has passed according to the judgment method specified in the judgment statement during the test process. The setting of the judgment statement can facilitate the control of the judgment method during the test process, so that the test script can implement more complex tests.

[0170] Optionally, in the process of generating a test script according to the test parameters and the script template, the method may further include:

[0171] A test duration is set for the second group of parameters in the test script, so that the test script controls the duration of a test corresponding to the second group of parameters according to the test duration, and the second group of parameters is one of the M groups of test parameters.

[0172] In this embodiment, the configuration module can set the test duration for each set of test parameters, or set the test duration for part of the multiple sets of test parameters, and the test duration is used to control the duration of a test corresponding to the second set of parameters. Figure 7 As shown, the third configuration area 74 includes an input control 742, which is used to input the test duration (e.g., 1000ms), and a set of test parameters corresponding to the test step Step1, i.e., the second set of parameters. During the test, the test script can control the duration of a test corresponding to the test step Step1 according to the test duration.

[0173] For example, the user can add the test duration in the judgment statement and set the usage rules of the test duration according to the relationship between the test duration and other elements in the judgment statement. Figure 7 As shown, in the judgment statement, the test duration and the output parameter Out1 are in an AND relationship. After each time the preset parameter value of the input parameter is sent to the device under test, the test script can start timing, and when the timing reaches the test duration (1000ms), the actual parameter value of the output parameter is obtained from the device under test, and then it is determined whether the device under test passes the test according to the judgment statement.

[0174] In some cases, after the preset parameter value of the input parameter is input into the device under test, the actual parameter value of the output parameter may change after a period of time. If the actual parameter value of the output parameter is directly obtained after the preset parameter value of the input parameter is sent to the device under test, the obtained actual parameter value may not represent the action change of the device under test. Therefore, when the test script is instructed to obtain the actual parameter value of the output parameter after waiting for the test time through the test time, a more accurate actual parameter value can be obtained, so that the test result can be judged more accurately based on the actual parameter value, thereby improving the accuracy of the test result.

[0175] like Figure 8 As shown, in the judgment statement, the test duration and the output parameters Out3 and Out4 are in a phase or relationship. After each time the preset parameter value of the input parameter is sent to the device under test, the test script can start timing. Before the timing duration reaches the test duration, the test script can obtain the actual parameter value of the output parameter from the device under test once every preset duration (less than the test duration), and then judge whether the device under test has passed the test through the judgment statement based on the actual parameter value of the output parameter. If it is judged that the device under test has passed the test, then the test corresponding to the test step Step2 is terminated. If it is judged that the device under test has not passed the test, then the parameter value of the output parameter continues to be obtained from the device under test. If after the timing duration reaches the test duration, it is judged that the device under test has not passed the test based on the actual parameter value, then the test step Step2 is terminated.

[0176] In some cases, after the preset parameter value of the input parameter is input into the device under test, the actual parameter value of the output parameter will change within a certain period of time. However, if you wait for a long time to obtain the actual parameter value and judge whether the device under test has passed the test based on the actual parameter value, the entire test process may take a long time. When the test duration instructs the test script to end a test after waiting for a certain period of time (i.e., the test duration) after sending the preset parameter value to the device under test, the time of the entire test process can be controlled, thereby reducing the time required for the entire test process.

[0177] It should be understood that the above are merely illustrative examples, and specific usage of the test duration may include but is not limited to the above examples.

[0178] In an embodiment of the present application, a corresponding test duration is set for one or more tests of the device to be tested. The test duration can be used to control the duration of the test process, thereby controlling the duration of the entire test process, thereby improving the test efficiency.

[0179] Optionally, during the process of generating a test script, the user may also set script information for the test script.

[0180] See also Fig.10 , Fig.10 FIG. 7 is a schematic diagram of a configuration interface 70 provided in an embodiment of the present application. Fig.10 As shown, the configuration interface 110 includes a fourth configuration area 111 , a fifth configuration area 112 and a sixth configuration area 113 .

[0181] In the fourth configuration area 111, the user can set the script information such as name, creation date, author, version, type, etc. for the test script. In the fifth configuration area 112, the user can enter the parameter information of all input parameters used in the test process. In the sixth configuration area 113, the user can enter the parameter information of all output parameters used in the test process. In the subsequent process of configuring a set of test parameters corresponding to each test, the user can select input parameters from all input parameters included in the fifth configuration area 112, and select output parameters from all output parameters included in the sixth configuration area 113.

[0182] In the process of generating the test script, the configuration module may store the script information in the configuration file, as well as the parameter information of the input parameters input in the fifth configuration area 112 and the parameter information of the output parameters input in the sixth configuration area 113 .

[0183] Optionally, in the process of generating a test script according to the test parameters and the script template, the method may further include:

[0184] The constraints of the output parameters are configured for the test script, so that when the actual parameter values ​​of the obtained output parameters meet the constraints, the test script determines whether the device under test passes the test according to the actual parameter values.

[0185] In some embodiments, the user can store the constraint conditions of each output parameter in the upper computer in advance. After the parameter information of the test parameter is sent to the upper computer, the configuration module can obtain the pre-stored constraint conditions of the output parameter according to the parameter name of the output parameter. In the process of generating the configuration file, the configuration module can store the constraint conditions of the output parameter in the configuration file. Alternatively, in the process of generating the test script, the configuration module can directly associate the test script with the storage location of the constraint conditions, so that the test script can directly obtain the constraint conditions of each output parameter from the storage location of the constraint conditions during the test process.

[0186] After configuring constraints for output parameters, during the process of testing the device under test, the test script first obtains the constraints of the output parameters after obtaining the actual parameter values ​​of the output parameters. Then, if it is determined that the actual parameter values ​​of the output parameters meet the constraints, the actual parameter values ​​of the output parameters are substituted into the judgment statement to determine whether the device under test has passed the test.

[0187] Optionally, the constraint condition of the output parameter may include an interval constraint, for example, if the interval range (i.e., constraint condition) corresponding to the interval constraint is 0 to 4. During the test process, after the test script obtains the actual parameter value of the output parameter, if the actual parameter value is between 0 and 4, it is determined that the actual parameter value of the output parameter satisfies the constraint condition, otherwise it is determined that the actual parameter value of the output parameter does not satisfy the constraint condition. In the case of determining that the actual parameter value of the output parameter does not satisfy the constraint condition, it can be directly determined that the test of the device under test has failed.

[0188] The constraints of the output parameters may also include, but are not limited to, enumeration constraints, regular expression constraints, bit constraints, no constraints, invalid constraints, etc. In practical applications, constraint rules may be set according to the data type of the output parameters and test requirements.

[0189] In an embodiment of the present application, constraints are set for output parameters. During the test process, the test script can determine whether the device under test has passed the test if the actual parameter value of the output parameter meets the constraint condition. Thus, the test result can be judged based on more accurate output parameters, thereby improving the accuracy of the test result.

[0190] See also Fig.11 , Fig.11 The flowchart of a device testing method 200 provided in an embodiment of the present application is shown. The execution subject of the method is a host computer, and the process is a test process of one of the tests executed after the host computer runs the test script after generating the test script. Fig.11 As shown, the method may include:

[0191] Step 210: Send the preset parameter value of the input parameter to the device under test.

[0192] In this embodiment, after generating the test script, the host computer can run the test script to test the device under test. During the test, the test script first obtains the preset parameter values ​​of the input parameters included in a set of test parameters of the device under test from the configuration file, and then sends the preset parameter values ​​of the input parameters to the device under test.

[0193] Optionally, in the process of testing the device under test according to a set of test parameters, if the set of test parameters includes multiple input parameters, the test script may simultaneously send preset parameter values ​​of the multiple input parameters to the device under test.

[0194] Alternatively, during the test script generation process, the configuration module can set the input order of multiple input parameters in the configuration file. Figure 7As shown, if the user sequentially inputs parameter information of multiple input parameters in the first configuration area 72, the configuration module can sequentially store the multiple input parameters in the configuration file in the order in which the multiple input parameters are input, and the storage order of the multiple input parameters in the configuration file is the input order. During the test process, the test script can sequentially read the preset parameter value of each input parameter from the configuration file, and then sequentially send the preset parameter value of each input parameter to the device under test in the storage order of the multiple input parameters.

[0195] Step 220: Obtain output parameters from the judgment statement.

[0196] Step 230: Obtain constraints on output parameters.

[0197] Step 240: Obtain the actual parameter value of the output parameter.

[0198] In this embodiment, after sending the preset parameter value of the input parameter to the device under test, the test script can determine whether a judgment statement is pre-set for the device under test, and if a judgment statement is pre-set, the output parameter is obtained from the judgment statement. Figure 7 As shown, the parameter name of the output parameter can be obtained from the judgment statement. Then, the test script can obtain the pre-stored constraint conditions of the output parameter according to the parameter name of the output parameter. And, after obtaining the parameter name of the output parameter, the test script can send a read request to the device under test to obtain the actual parameter value of the output parameter from the device under test. The specific process of obtaining the output parameter, constraint conditions and actual parameter value can refer to the above example, and this embodiment is not limited here.

[0199] Step 250: Determine whether the actual parameter value satisfies the constraint condition.

[0200] In this embodiment, after obtaining the actual parameter value of the output parameter, the test script first determines whether the actual parameter value satisfies the constraint condition, and if so, executes step 260, and if not, executes step 290. It should be understood that when no constraint condition is set for the output parameter, the test script can directly execute step 260.

[0201] Step 260: Substitute the actual parameter value into the judgment statement.

[0202] Step 270: The result of the judgment statement is true.

[0203] In this embodiment, when the actual parameter value of the output parameter is obtained and the actual parameter value satisfies the constraint condition, the test script can substitute the actual parameter value of the output parameter into the judgment statement and determine whether the result of the judgment statement is true. If the result is true, execute step 280; if the result is false, execute step 290.

[0204] Step 280: Determine whether the device under test passes the test.

[0205] Step 290: Determine whether the device under test fails the test.

[0206] In this embodiment, when the result of the judgment statement is true, the test script can determine that the device under test has passed the test, and the test script can output notification information to notify the user that the device under test has passed the test. On the contrary, when the result of the judgment statement is false or the actual parameter value of the output parameter does not meet the constraint condition, the test script can determine that the device under test has not passed the test, and the test script can output notification information to notify the user that the device under test has not passed the test.

[0207] Optionally, the host computer has a display screen, and when it is determined that the device under test has passed the test, the test script can output a first text message (i.e., notification information) through the display screen to notify the user that the device under test has passed the test. Similarly, when it is determined that the device under test has not passed the test, the test script can output a second text message (i.e., notification information) through the display screen to notify the user that the device under test has not passed the test. It should be understood that the specific output method of the notification information may include but is not limited to the above examples.

[0208] It should be understood that when the configuration file includes multiple groups of test parameters, the test script may execute steps 210 to 290 for each group of test parameters to perform a test on the device under test.

[0209] See also Fig.12 , Fig.12 The flowchart of a device testing method 300 provided in an embodiment of the present application is shown. The execution subject of the method is a host computer, and the process is a test process executed after the host computer runs the test script after generating the test script. Fig.12 As shown, the method may include:

[0210] Step 310: Determine the first test step.

[0211] In this embodiment, the test script may include at least one set of test parameters (i.e., test steps), and during the generation of the test script, a test order is set for multiple test steps. Then, during the test process, the test script first determines the first test step of the multiple test steps, i.e., determines the first set of test parameters.

[0212] Step 320: Obtain the test parameters in the test step.

[0213] Step 330: Send the preset parameter value of the input parameter to the device under test.

[0214] In this embodiment, after determining each test step, the test script can obtain a set of test parameters corresponding to the test step from the configuration file, then determine the preset parameter value of the input parameter from the set of test parameters, and send the preset parameter value of the input parameter to the device under test.

[0215] Step 340: Determine whether the judgment statement includes the test duration.

[0216] In this embodiment, after sending the preset parameter value of the input parameter to the device under test, the test script can obtain the judgment statement corresponding to the test step from the configuration file, and then determine whether the judgment statement includes the test duration. In the case where the judgment statement includes the test duration, the test script can execute step 350, and in the case where it is determined that the judgment statement does not include the test duration, the test script can execute step 314.

[0217] Step 350: Determine whether to wait for the test duration.

[0218] In this embodiment, after determining that the judgment statement includes the test duration, the test script can determine the relationship between the test duration and other elements in the judgment statement. Figure 7 As shown, if the relationship between the test duration and other elements in the judgment statement is an AND relationship, execute step 390; if the relationship between the test duration and other elements in the judgment statement is an OR relationship, execute step 360.

[0219] Step 360: Obtain the actual parameter value of the output parameter.

[0220] Step 370: The result of the judgment statement is true.

[0221] In this embodiment, when the relationship between the test duration and other elements in the judgment statement is an OR relationship, after sending the preset parameter value to the device under test, the test script can start timing and obtain the actual parameter value of the output parameter every preset duration. After obtaining the actual parameter value of the output parameter, the actual parameter value is substituted into the judgment statement to determine whether the result of the judgment statement is true. If the result of the judgment statement is true, step 316 is executed. At the same time, the test script can output a notification message to notify the user that a test corresponding to this test step has passed.

[0222] If the result of the judgment statement is false, it is determined whether the timing duration reaches the test duration. If the timing duration does not reach the test duration, it returns to step 360. If the timing duration reaches the test duration, it executes step 316. At the same time, the test script can output a notification message to inform the user that a test corresponding to this test step has failed.

[0223] After obtaining the actual parameter value of the output parameter, the test script can also determine whether the actual parameter value of the output parameter satisfies the corresponding constraint condition. If so, step 370 is executed; if not, step 360 is returned to execute.

[0224] Step 311, wait for the test to start.

[0225] Step 312: Obtain the actual parameter value of the output parameter.

[0226] In this embodiment, when the relationship between the test duration and other elements in the judgment statement is an AND relationship, after sending the preset parameter value to the device under test, the test script starts timing. When the timing duration reaches the test duration, step 312 is executed to obtain the actual parameter value of the output parameter from the device under test.

[0227] Step 313: Determine whether the result of the judgment statement is true.

[0228] In this embodiment, after waiting for the test time, the test script substitutes the actual parameter value of the output parameter into the judgment statement and determines that the result of the judgment statement is true, and then executes step 316. At the same time, the test script can output a notification message to inform the user that a test corresponding to this test step has passed.

[0229] On the contrary, if the result of the judgment statement is determined to be false, the process may return to step 312. Alternatively, the process may directly execute step 316. At the same time, the test script may output a notification message to inform the user that a test corresponding to this test step has failed.

[0230] Step 314: Obtain the actual parameter value of the output parameter.

[0231] Step 315: Determine whether the result of the judgment statement is true.

[0232] In this embodiment, when the test duration is not included in the judgment statement, the test script can directly execute steps 314 and 315, obtain the actual parameter value of the output parameter from the device under test, and then substitute the actual parameter value into the judgment statement to determine whether the structure of the judgment statement is true. If the result of the judgment statement is true, step 316 is executed. At the same time, the test script can output a notification message to inform the user that a test corresponding to this test step has passed.

[0233] If the result of the judgment statement is false, the process returns to step 314. Alternatively, the process may directly execute step 316. At the same time, the test script may output a notification message to inform the user that a test corresponding to this test step has failed.

[0234] Step 316: Determine whether the test steps have been completed.

[0235] Step 317: Jump to the next test step.

[0236] In this embodiment, when it is determined in the current test step that the device under test has passed the test or the test duration has been reached, the test script executes step 316 to end the test of the current test step. Then, the test script can determine whether the configuration file includes the test parameters of the next adjacent test step according to the test. If it does, step 317 is executed to jump to the next adjacent test step, and then steps 320 to 316 are continued. If the test parameters of the next adjacent test step are not included, the test is ended.

[0237] Combination of the above Figures 1 to 12 The device testing method provided in the embodiment of the present application is described in detail. Fig.13 , Fig.14 Describe the device testing method provided in the embodiment of the present application. It should be understood that Fig.13 , Fig.14 The control device shown can achieve Figure 6 , Fig.11 or Fig.12 One or more steps in the method flow shown are not described in detail here to avoid repetition.

[0238] See also Fig.13 , Fig.13 FIG. 1 is a schematic diagram showing a structure of a device testing method provided by an embodiment of the present application. Fig.13 As shown, the equipment testing device 13 includes an acquisition module 131 , a generation module 132 and a testing module 133 .

[0239] The acquisition module 131 is used to acquire the test parameters of the device under test during the test process;

[0240] A generating module 132, configured to generate a test script according to the test parameters and the script template;

[0241] The testing module 133 is used to test the device under test through the test script.

[0242] In some embodiments, the test parameters include input parameters for controlling the action of the device under test, and output parameters for monitoring the change of the action of the device under test.

[0243] In some embodiments, the generating module 132 is specifically configured to generate a configuration file according to the test parameters; and configure the configuration file to the script template to obtain the test script.

[0244] In some embodiments, the test parameters are M groups, each group of the test parameters is used to perform a test on the device under test, and M is an integer greater than 1.

[0245] In some embodiments, there are N devices under test, each set of the test parameters is used to perform a test on the device under test to which it belongs, and N is an integer greater than 1.

[0246] In some embodiments, the generating module 132 is further configured to set a test sequence for the M groups of test parameters in the test script, so that the test script tests the device under test according to each group of test parameters in turn according to the test sequence.

[0247] In some embodiments, the generation module 132 is also used to set a judgment statement for the first group of parameters in the test script, so that the test script determines whether a test corresponding to the first group of parameters passes according to the judgment statement, and the first group of parameters is one of the M groups of test parameters.

[0248] In some embodiments, the generation module 132 is also used to set a test duration for a second group of parameters in the test script so that the test script controls the duration of a test corresponding to the second group of parameters according to the test duration, and the second group of parameters is one of the M groups of test parameters.

[0249] In some embodiments, the generation module 132 is also used to configure the constraints of the output parameters for the test script, so that when the parameter value of the output parameter obtained by the test script meets the constraints, the test script determines whether the test device has passed the test based on the parameter value.

[0250] In some embodiments, the generating module 132 is further used to configure an address mapping table for the test script, and the address mapping table is used to provide the test script with the address of the test parameter in the device under test.

[0251] Fig.14 FIG. 1 shows a structural block diagram of a device testing method provided by an embodiment of the present application. Fig.14 As shown, the device testing method 140 includes a processor 141 and a memory 142 , and the above-mentioned components can be connected via one or more buses 144 .

[0252] The device testing method 140 further includes a computer program 143, which is stored in the memory 142. When the computer program 143 is executed by the processor 141, the device testing method 140 performs the above Figure 6 , Fig.11 and Fig.12All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding physical device, and will not be repeated here.

[0253] An embodiment of the present application also provides a readable storage medium, which includes a computer program. When the computer program is executed on a computer, the computer executes the method provided by the above method embodiment.

[0254] An embodiment of the present application also provides a computer program product comprising instructions, and when the computer program product is run on a computer, the computer is enabled to execute the method provided by the above method embodiment.

[0255] An embodiment of the present application also provides a chip system, including a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that a device testing method equipped with the chip system executes the method provided in the above method embodiment.

[0256] Among them, the chip system may include an input circuit or interface for sending information or data, and an output circuit or interface for receiving information or data.

[0257] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0258] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0259] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0260] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0261] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0262] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0263] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0264] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0265] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A device testing method, It is characterized in that include: Obtain the test parameters of the device under test during the test process; Generate a test script according to the test parameters and the script template; The device under test is tested using the test script.

2. The method according to claim 1, It is characterized in that The test parameters include input parameters for controlling the action of the device under test, and output parameters for monitoring the action change of the device under test.

3. The method according to claim 2, It is characterized in that The generating of the test script according to the test parameters and the script template includes: Generate a configuration file according to the test parameters; The configuration file is configured to the script template to obtain the test script.

4. The method according to any one of claims 1 to 3, It is characterized in that The test parameters are M groups, each group of the test parameters is used to perform a test on the device under test, and M is an integer greater than 1.

5. The method according to claim 4, It is characterized in that There are N devices under test, each set of test parameters is used to perform a test on the device under test, and N is an integer greater than 1.

6. The method according to claim 4 or 5, It is characterized in that The generating of the test script according to the test parameters and the script template includes: A test sequence is set for the M groups of test parameters in the test script, so that the test script tests the device under test according to each group of test parameters in turn according to the test sequence.

7. The method according to any one of claims 4 to 6, It is characterized in that The generating of the test script according to the test parameters and the script template includes: A judgment statement is set for the first group of parameters in the test script, so that the test script judges whether a test corresponding to the first group of parameters passes according to the judgment statement, and the first group of parameters is one of the M groups of test parameters.

8. The method according to any one of claims 1 to 7, It is characterized in that The generating of the test script according to the test parameters and the script template includes: A test duration is set for a second group of parameters in the test script so that the test script controls the duration of a test corresponding to the second group of parameters according to the test duration, and the second group of parameters is one of the M groups of test parameters.

9. The method according to any one of claims 2 to 8, It is characterized in that The generating of the test script according to the test parameters and the script template includes: The constraint condition of the output parameter is configured for the test script, so that when the parameter value of the output parameter obtained by the test script satisfies the constraint condition, the test script determines whether the device under test passes the test according to the parameter value.

10. The method according to any one of claims 1 to 9, It is characterized in that The generating of the test script according to the test parameters and the script template includes: An address mapping table is configured for the test script, where the address mapping table is used to provide the test script with the address of the test parameter in the device under test.

11. A device testing apparatus, It is characterized in that include: An acquisition module is used to obtain the test parameters of the device under test during the test process; A generation module, used to generate a test script according to the test parameters and the script template; A test module is used to test the device under test through the test script.

12. A readable storage medium, It is characterized in that The readable storage medium stores a computer program, and when the computer program is executed on a device testing apparatus, the device testing apparatus is enabled to execute the method according to any one of claims 1 to 10.