Script testing method, device, equipment and storage medium
By obtaining and analyzing the status parameters of the executor, selecting the appropriate executor and adjusting the script waiting time, the problem of low testing efficiency in the existing technology is solved and more efficient script testing is achieved.
Patent Information
- Application Number
- CN202211483360.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-24
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-11-24
AI Technical Summary
In the prior art, script waiting time is added to improve test stability, resulting in a decrease in test efficiency.
By obtaining the status parameters of multiple executors, determining the comprehensive status parameters of each executor, selecting the target executor with good status, and adjusting the waiting time of the script according to its status parameters.
The efficiency of script testing is improved, and the waiting time of scripts is more suitable by selecting executors in good state, which improves the efficiency of the test process.
Smart Images

Figure CN115729824B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of program testing technology, and in particular to a script testing method, device, equipment and storage medium. Background Art
[0002] With the continuous development of computer technology, a large number of services can be realized through the Internet. Before providing services through the Internet, the program providing the service needs to be tested first.
[0003] At present, in the prior art, when testing a program that provides a service, in order to improve the stability of the test, the waiting time in the script is usually increased.
[0004] However, the inventors have discovered that the prior art has at least the following technical problems: increasing the waiting time in the script will lead to a decrease in test efficiency. Summary of the invention
[0005] The present application provides a script testing method, apparatus, device and storage medium to solve the problem of low script testing efficiency.
[0006] In a first aspect, the present application provides a script testing method, comprising: in response to the initiation of a test task, obtaining at least one state parameter of all execution machines; determining the comprehensive state parameters of each execution machine based on the state parameters; determining the target execution machine based on the comprehensive state parameters of each execution machine; determining the target waiting time of the script to be tested based on the comprehensive state parameters of the target execution machine; determining the target waiting time as the waiting time of the script to be tested to obtain a target script; and sending the target script to the target execution machine so that the target execution machine tests the target script.
[0007] In one possible implementation, the target waiting time of the script to be tested is determined based on the comprehensive status parameters of the target execution machine, including: determining the target parameter interval to which the comprehensive status parameters belong based on the comprehensive status parameters of the target execution machine; searching for the correspondence between a preset parameter interval and the target waiting time based on the target parameter interval to obtain the target waiting time; or, inputting the comprehensive status parameters of the target execution machine into a preset waiting time calculation function to obtain the target waiting time.
[0008] In one possible implementation, the comprehensive state parameters of each execution machine are determined based on the state parameters, including: based on any state parameter of any execution machine, searching for the correspondence between a preset state parameter range and a parameter state value corresponding to any state parameter to obtain the parameter state value corresponding to any state parameter; inputting each state value corresponding to any execution machine into a preset comprehensive state parameter calculation function to obtain the comprehensive state parameter of any execution machine.
[0009] In one possible implementation, the state parameters include central processing unit occupancy, memory occupancy and response speed; accordingly, according to any state parameter of any execution machine, the corresponding relationship between the preset state parameter range and the parameter state value corresponding to any state parameter is searched to obtain the parameter state value corresponding to any state parameter, including: according to the central processing unit occupancy of any execution machine, the corresponding relationship between the preset central processing unit occupancy range and the processor occupancy state value is searched to obtain the corresponding processor occupancy state value; according to the memory occupancy of any execution machine, the corresponding relationship between the preset memory occupancy range and the memory occupancy state value is searched to obtain the corresponding memory occupancy state value; according to the response speed of any execution machine, the corresponding relationship between the preset response speed range and the response speed state value is searched to obtain the corresponding response speed state value.
[0010] In one possible implementation, each state value corresponding to any execution machine is input into a preset comprehensive state parameter calculation function to obtain the comprehensive state parameters of any execution machine, including: inputting the processor occupancy state value, memory occupancy state value and response speed state value corresponding to any execution machine into a preset comprehensive state parameter calculation function to obtain the comprehensive state parameters of any execution machine.
[0011] In a possible implementation, after determining the comprehensive status parameters of each execution machine based on the status parameters, it also includes: if the comprehensive status parameters of all execution machines are less than preset values, restart all execution machines and re-execute the steps of obtaining the execution machine status parameters and calculating the comprehensive status parameters of the execution machines.
[0012] In a possible implementation, after re-executing the steps of obtaining the execution machine status parameters and calculating the execution machine comprehensive status parameters, it also includes: if the comprehensive status parameters of all execution machines are less than the preset value, a prompt message is sent to the corresponding terminal device of the tester.
[0013] In the second aspect, the present application provides a script testing device, including: a parameter acquisition module, used to obtain at least one state parameter of all execution machines in response to the start of a test task; a parameter determination module, used to determine the comprehensive state parameters of each execution machine based on the state parameters; an execution machine determination module, used to determine the target execution machine based on the comprehensive state parameters of each execution machine; a time determination module, used to determine the target waiting time of the script to be tested based on the comprehensive state parameters of the target execution machine; a script acquisition module, used to determine the target waiting time as the waiting time of the script to be tested, and obtain the target script; a script sending module, used to send the target script to the target execution machine, so that the target execution machine tests the target script.
[0014] In a third aspect, the present application provides an electronic device comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the script testing method described in the first aspect.
[0015] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the script testing method described in the first aspect.
[0016] The script testing method, apparatus, equipment and storage medium provided in the present application obtain the status parameters of all execution machines, determine the comprehensive status parameters of each execution machine, and determine the target execution machine according to the comprehensive status parameters. According to the comprehensive status parameters of the target execution machine, the target waiting time of the script to be tested is determined, and the target waiting time is used as the waiting time of the script to be tested to obtain the target script. The target script is sent to the target execution machine for script testing, so as to find an execution machine with a better status among all execution machines, and change the waiting time of the script according to the status of the selected execution machine, so that the waiting time is more suitable for the selected execution machine, thereby improving the testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] Figure 1 A schematic diagram of an application scenario of the script testing method provided in an embodiment of the present application;
[0019] Figure 2 A flowchart of a script testing method provided in an embodiment of the present application;
[0020] Figure 3 A schematic diagram of the structure of a script testing device provided in an embodiment of the present application;
[0021] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0022] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0023] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0024] With the continuous development of computer technology and the Internet, the network is providing more and more services. These services need to be tested before they are officially launched to ensure the stability of the services.
[0025] Currently, when testing the services provided, the program or script to be tested can usually be sent to a fixed execution end, and the execution end is used to test the script. In order to reduce the error rate of the script, a long waiting time is also set in the script, which will cause the problem of low efficiency in the testing process.
[0026] In response to the above technical problems, the inventors proposed the following technical concept: by obtaining the state parameters of multiple execution machines, a target execution machine suitable for testing is found, and according to the state parameters of the target execution machine, the waiting time in the script is changed.
[0027] Figure 1 Schematic diagram of application scenario of the script testing method provided in the embodiment of the present application. Figure 1 In this scenario, it includes: server 101 and execution machine 102.
[0028] The server 101 may be a single server, or may be implemented using a server or a cluster of multiple servers with more powerful processing capabilities and higher security. If possible, a computer or laptop with stronger computing power may be used as a substitute.
[0029] The execution machine 102 may include a computer, a server, a tablet, a mobile phone, a PDA (Personal Digital Assistant), a notebook, etc., which are used to run the script. There may be two or more execution machines 102.
[0030] During the specific implementation process, the server 101 is used to obtain the state parameters of the execution machine 102, calculate the comprehensive state parameters of each execution machine, select the target execution machine, determine the target waiting time of the script to be tested according to the comprehensive state parameters of the target execution machine, and replace the waiting time in the script to be tested with the target waiting time to obtain the target script, and send the target script to the execution machine 102.
[0031] The execution machine 102 is used to run the target script to obtain the test result.
[0032] It is understandable that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the script testing method. In other feasible implementations of the present application, the above architecture may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently, which can be determined according to the actual application scenario and is not limited here. Figure 1 The components shown may be implemented by hardware, software, or a combination of software and hardware.
[0033] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0034] Figure 2 A flowchart of a script testing method provided in an embodiment of the present application. The execution subject of the embodiment of the present application may be Figure 1 The server 101 in the embodiment may also be a computer and / or a mobile phone, etc., which is not particularly limited in this embodiment. Figure 2 As shown, the method includes:
[0035] S201: In response to the start of a test task, obtaining at least one state parameter of all execution machines.
[0036] In this step, the test task can be started by receiving a test task start instruction sent by the tester's corresponding client, or a test task in the test task queue is completed and a new test task is started. The state parameters of the execution machine can be obtained by sending a state parameter acquisition instruction to the execution machine and receiving the state parameters fed back by the execution machine.
[0037] The state parameters include but are not limited to CPU occupancy, memory occupancy, and response speed. Both CPU occupancy and memory occupancy can be obtained by sending commands to the execution machine, and the response speed can also be obtained by sending a request to the execution machine and receiving feedback from the execution machine, and the time difference between the sending time of the request and the receiving time of the execution machine feedback is used as the response time.
[0038] S202: Determine the comprehensive state parameters of each execution machine according to the state parameters.
[0039] In this step, a preset program, script, production rule or mapping method may be used to convert the state parameter, and then a preset formula may be input to obtain the comprehensive state parameter.
[0040] The preset program, script, production rule or mapping method may be preset by a tester.
[0041] In a possible implementation, in this step, the comprehensive state parameters of each execution machine are determined according to the state parameters, including: step S202A or step S202B.
[0042] S202A: According to any state parameter of any execution machine, find the corresponding relationship between the preset state parameter range and the parameter state value corresponding to any state parameter, and obtain the parameter state value corresponding to any state parameter.
[0043] In this step, the target state parameter range to which the state parameter belongs may be determined, and the parameter state value corresponding to the state parameter may be found in the correspondence relationship between the preset state parameter range and the parameter state value according to the target state parameter range.
[0044] Specifically, the state parameter range may be preset, and the target state parameter range to which the state parameter belongs may be determined by comparing the state parameter with the end points of the state parameter range.
[0045] Among them, the corresponding relationship between the state parameter range and the parameter state value can be shown in Table 1. This application does not limit the specific values in Table 1.
[0046] Table 1 Comparison table of status parameter range and parameter status value (illustrative)
[0047]
[0048] S202B: Input each state value corresponding to any execution machine into a preset comprehensive state parameter calculation function to obtain the comprehensive state parameter of any execution machine.
[0049] In this step, the comprehensive state parameter may be the output value of a preset comprehensive state parameter calculation function. The preset comprehensive state parameter calculation function may correspond to the type of state parameter. If two state parameters are selected to calculate the comprehensive state parameter, the comprehensive state parameter calculation function may be different from the calculation function for selecting three state parameters.
[0050] Among them, the comprehensive state parameter calculation function can be as follows:
[0051] K=mF+nG+l
[0052] Among them, K represents the comprehensive state parameter, F represents the value of the first state parameter, G represents the value of the second state parameter, and m, n, and l represent constants.
[0053] S203: Determine the target execution machine according to the comprehensive status parameters of each execution machine.
[0054] In this step, the execution machine with a relatively high comprehensive status parameter among all execution machines can be used as the target execution machine. It is easy to think that depending on the different calculation methods of the comprehensive status parameter, the execution machine with a relatively low comprehensive status parameter among all execution machines can also be used as the target execution machine.
[0055] S204: Determine the target waiting time of the script to be tested according to the comprehensive status parameter of the target execution machine.
[0056] In this step, the target waiting time can be the global waiting time.
[0057] In a possible implementation manner, in this step, determining the target waiting time of the script to be tested according to the comprehensive status parameter of the target execution machine includes: step S204A, S204B or step S204C.
[0058] S204A: Determine the target parameter interval to which the comprehensive status parameter belongs according to the comprehensive status parameter of the target execution machine.
[0059] In this step, the comprehensive status parameter of the target execution machine can be compared with the endpoints of multiple preset parameter intervals to obtain the target parameter interval to which the comprehensive status parameter of the target execution machine belongs.
[0060] For example, if the comprehensive status parameter of the target execution machine is 7, the preset first parameter interval is greater than or equal to 3 and less than 5, the preset second parameter interval is greater than or equal to 5 and less than 7, and the preset third parameter interval is greater than or equal to 7 and less than 9, then the comprehensive status parameter of the target execution machine belongs to the third parameter interval, and the third parameter interval is determined as the target parameter interval. The specific values of the parameter intervals in this application are not limited.
[0061] S204B: According to the target parameter interval, search for the corresponding relationship between the preset parameter interval and the target waiting time to obtain the target waiting time.
[0062] In this step, the corresponding relationship between the parameter interval and the target waiting time is shown in Table 2 for example.
[0063] Table 2 Corresponding relationship between parameter interval and target waiting time (schematic)
[0064]
[0065] For example, if the target parameter interval is 6.5 < x ≤ 7, the target waiting time is 25 seconds. If the target parameter interval is 4 < x ≤ 4.5, the target waiting time is 50 seconds.
[0066] S204C: Input the comprehensive status parameter of the target execution machine into the preset waiting time calculation function to obtain the target waiting time.
[0067] In this step, the waiting time calculation function is as follows:
[0068] T=rS+q
[0069] Among them, T represents the target waiting time, r and q represent constants, and S represents the comprehensive state parameter.
[0070] S205: Determine the target waiting time as the waiting time of the script to be tested, and obtain the target script.
[0071] In this step, the target waiting time may replace the original waiting time in the script to be tested, or the target waiting time may be written into a preset position in the script to be tested.
[0072] S206: Send the target script to the target execution machine so that the target execution machine tests the target script.
[0073] In this step, sending the target script to the target execution machine may be done through a network.
[0074] From the description of the above embodiments, it can be seen that the embodiments of the present application obtain the status parameters of all execution machines, determine the comprehensive status parameters of each execution machine, and determine the target execution machine according to the comprehensive status parameters. According to the comprehensive status parameters of the target execution machine, the target waiting time of the script to be tested is determined, and the target waiting time is used as the waiting time of the script to be tested to obtain the target script. The target script is sent to the target execution machine for script testing, so as to find an execution machine with a better status among all execution machines, and change the waiting time of the script according to the status of the selected execution machine, so that the waiting time is more suitable for the selected execution machine, thereby improving the test efficiency.
[0075] In a possible implementation, the state parameters include CPU occupancy, memory occupancy, and response speed.
[0076] Accordingly, in the above step S202A, according to any state parameter of any execution machine, the corresponding relationship between the preset state parameter range and the parameter state value corresponding to any state parameter is searched to obtain the parameter state value corresponding to any state parameter, including:
[0077] The 1st and 2nd rows, 1st and 3rd rows, and 1st and 4th rows of the above Table 1 can be split into 3 tables to respectively represent the correspondence between the CPU occupancy range and the processor occupancy status value, the correspondence between the memory occupancy range and the memory occupancy status value, and the correspondence between the response speed range and the response speed status value.
[0078] S202A1: According to the CPU occupancy rate of any execution machine, find the corresponding relationship between the preset CPU occupancy rate range and the processor occupancy state value to obtain the corresponding processor occupancy state value.
[0079] In this step, for example, if the CPU occupancy rate of one execution machine is 4%, the corresponding processor occupancy state value is 10; if the CPU occupancy rate of another execution machine is 45%, the corresponding processor occupancy state value is 6; if the CPU occupancy rate of another execution machine is 65%, the corresponding processor occupancy state value is 3.
[0080] S202A2: According to the memory occupancy rate of any execution machine, find the correspondence between the preset memory occupancy rate range and the memory occupancy status value to obtain the corresponding memory occupancy status value.
[0081] In this step, for example, if the memory occupancy rate of an execution machine is 9%, the corresponding memory occupancy status value is 10; if the memory occupancy rate of another execution machine is 50%, the corresponding memory occupancy status value is 7; if the memory occupancy rate of another execution machine is 72%, the corresponding memory occupancy status value is 3.
[0082] S202A3: According to the response speed of any execution machine, find the corresponding relationship between the preset response speed range and the response speed state value to obtain the corresponding response speed state value.
[0083] In this step, for example, if the response speed of one execution machine is 12ms, the corresponding response speed status value is 9; if the response speed of another execution machine is 20ms, the corresponding response speed status value is 8; if the response speed of another execution machine is 60, the corresponding response speed status value is 3.
[0084] In a possible implementation, in this step, in the above S202B, each state value corresponding to any execution machine is input into a preset comprehensive state parameter calculation function to obtain the comprehensive state parameter of any execution machine, specifically including:
[0085] The processor occupancy state value, memory occupancy state value and response speed state value corresponding to any execution machine are input into a preset comprehensive state parameter calculation function to obtain the comprehensive state parameter of any execution machine.
[0086] Among them, the comprehensive state parameter calculation function is as follows:
[0087] S=aX+bY+cZ+d
[0088] In the formula, S represents the comprehensive state parameter, a, b, c, d are constants, X represents the processor occupancy state value, Y represents the memory occupancy state value, and Z represents the response speed state value. Among them, a can be 30% or 0.3, b can be 30% or 0.3, and c can be 40% or 0.4. The values of the constants can also be obtained from experience.
[0089] From the description of the above embodiments, it can be seen that the embodiments of the present application obtain the processor occupancy status value corresponding to the CPU occupancy rate of the execution machine, the memory occupancy status value corresponding to the memory occupancy rate, and the response speed status value corresponding to the response speed by respectively querying the corresponding relationships, and inputting the processor occupancy status value, the memory occupancy status value and the response speed status value into a preset comprehensive state parameter calculation function to obtain the comprehensive state parameters, thereby comprehensively considering the CPU occupancy rate, memory occupancy rate and response speed, and improving the suitability of the target execution machine.
[0090] In a possible implementation, after determining the comprehensive state parameters of each execution machine according to the state parameters in the above step S202, the method further includes:
[0091] S210: If the comprehensive status parameters of all execution machines are less than the preset values, restart all execution machines and re-execute the steps of obtaining the execution machine status parameters and calculating the comprehensive status parameters of the execution machines.
[0092] In this step, the preset value may be obtained by receiving the setting information of the tester's terminal device in advance. Restarting all execution machines may also be restarting idle execution machines that are not performing script testing. Restarting all execution machines may be sending a restart instruction to all execution machines so that the execution machines restart according to the restart instruction. The steps of obtaining the execution machine state parameters and calculating the execution machine comprehensive state parameters may be the above steps S201 and S202.
[0093] The preset value is, for example, 4, 3 or 2.
[0094] From the description of the above embodiments, it can be seen that the embodiments of the present application improve the state of the execution machines by restarting all the execution machines when the comprehensive state parameters of all the execution machines are less than the preset values, thereby improving the efficiency of script testing. After restarting all the execution machines, the steps of obtaining the execution machine state parameters and calculating the comprehensive state parameters of the execution machines are executed again, so that it can be determined again whether there are execution machines that can perform script testing, and the target execution machine can be determined if there are execution machines that can be tested.
[0095] In a possible implementation, after the above step S210 re-executes the steps of obtaining the execution machine state parameters and calculating the execution machine comprehensive state parameters, it also includes:
[0096] S211: If the comprehensive status parameters of all execution machines are less than the preset values, a prompt message is sent to the corresponding terminal device of the tester.
[0097] In this step, a prompt message is sent to the corresponding terminal device of the tester, which can be sent in the format of a text message, a message, etc.
[0098] Among them, the prompt information is, for example, "the execution machine is in poor condition", "the execution machine parameters are unqualified", etc. The embodiment of the present application does not impose specific restrictions on the content of the prompt information.
[0099] From the description of the above embodiment, it can be seen that by sending a prompt message to the tester's corresponding terminal device when no comprehensive parameter of the execution machine is greater than or equal to the preset value after restarting all execution machines, the tester can be prompted to troubleshoot or debug, thereby improving the efficiency of subsequent tests.
[0100] Figure 3 This is a schematic diagram of the structure of the script testing device provided in the embodiment of the present application. Figure 3 As shown, the script testing device 300 includes: a parameter acquisition module 301, a parameter determination module 302, an execution machine determination module 303, a time determination module 304, a script acquisition module 305 and a script sending module 306.
[0101] The parameter acquisition module 301 is used to acquire at least one state parameter of all execution machines in response to the start of the test task.
[0102] The parameter determination module 302 is used to determine the comprehensive state parameters of each execution machine according to the state parameters.
[0103] The execution machine determination module 303 is used to determine the target execution machine according to the comprehensive state parameters of each execution machine.
[0104] The time determination module 304 is used to determine the target waiting time of the script to be tested according to the comprehensive state parameters of the target execution machine.
[0105] The script obtaining module 305 is used to determine the target waiting time as the waiting time of the script to be tested, and obtain the target script.
[0106] The script sending module 306 is used to send the target script to the target execution machine so that the target execution machine tests the target script.
[0107] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0108] In a possible implementation, the time determination module 304 is specifically used to determine the target parameter interval to which the comprehensive state parameter belongs according to the comprehensive state parameter of the target execution machine. According to the target parameter interval, the corresponding relationship between the preset parameter interval and the target waiting time is searched to obtain the target waiting time. Alternatively, the comprehensive state parameter of the target execution machine is input into a preset waiting time calculation function to obtain the target waiting time.
[0109] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0110] In a possible implementation, the parameter determination module 302 is specifically used to find the corresponding relationship between the preset state parameter range and the parameter state value corresponding to any state parameter of any execution machine according to any state parameter of any execution machine, and obtain the parameter state value corresponding to any state parameter. Each state value corresponding to any execution machine is input into the preset comprehensive state parameter calculation function to obtain the comprehensive state parameter of any execution machine.
[0111] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0112] In a possible implementation, the state parameters include CPU occupancy, memory occupancy, and response speed.
[0113] Accordingly, the parameter determination module 302 is specifically used to find the corresponding relationship between the preset CPU occupancy range and the processor occupancy state value according to the CPU occupancy of any execution machine, and obtain the corresponding processor occupancy state value. According to the memory occupancy of any execution machine, find the corresponding relationship between the preset memory occupancy range and the memory occupancy state value, and obtain the corresponding memory occupancy state value. According to the response speed of any execution machine, find the corresponding relationship between the preset response speed range and the response speed state value, and obtain the corresponding response speed state value.
[0114] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0115] In one possible implementation, the parameter determination module 302 is specifically used to input the processor occupancy status value, memory occupancy status value and response speed status value corresponding to any execution machine into a preset comprehensive status parameter calculation function to obtain the comprehensive status parameters of any execution machine.
[0116] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0117] In a possible implementation, the script testing device 300 further includes: an execution machine restart module 307 .
[0118] The execution machine restart module 307 is used to restart all execution machines if the comprehensive state parameters of all execution machines are less than the preset value, and re-execute the steps of obtaining the execution machine state parameters and calculating the execution machine comprehensive state parameters.
[0119] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0120] In a possible implementation, the script testing device 300 further includes: an information sending module 308 .
[0121] The information sending module 308 is used to send a prompt message to the corresponding terminal device of the tester if the comprehensive status parameter of all execution machines is less than a preset value.
[0122] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0123] In order to implement the above embodiment, the embodiment of the present application also provides an electronic device.
[0124] refer to Figure 4 , which shows a schematic diagram of the structure of an electronic device 400 suitable for implementing the embodiment of the present application, and the electronic device 400 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0125] like Figure 4As shown, the electronic device 400 may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 401, and a memory 402 connected to the processor in communication, the memory 402 may be a read-only memory (ROM), and the processor 101 may perform various appropriate actions and processes according to the program stored in the memory 402, the computer execution instruction, or the program loaded from the storage device 408 to the random access memory (RAM) 403 to implement the script testing method in any of the above embodiments. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processor 401, the memory 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0126] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0127] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the memory 402. When the computer program is executed by the processor 401, the above-mentioned functions defined in the method of the embodiment of the present application are executed.
[0128] It should be noted that the computer-readable storage medium mentioned above in the present application may be a computer-readable signal medium or a computer storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable storage medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0129] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0130] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0131] The computer program code for performing the operation of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).
[0132] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0133] The modules involved in the embodiments described in this application may be implemented by software or hardware. The name of the unit does not limit the module itself in some cases. For example, the parameter determination module may also be described as a "comprehensive state parameter determination module".
[0134] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0135] The present application also provides a computer-readable storage medium, which stores computer execution instructions. When the processor executes the computer execution instructions, the technical solution of the script testing method in any of the above embodiments is implemented. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the script testing method. Please refer to the implementation principle and beneficial effects of the script testing method, which will not be repeated here.
[0136] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0137] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the technical solution of the script testing method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the script testing method. Please refer to the implementation principle and beneficial effects of the script testing method, and no further details will be given here.
[0138] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.
[0139] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0140] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A script testing method, characterized in that: include: In response to the start of the test task, obtaining at least one state parameter of all execution machines; According to any state parameter of any execution machine, searching for a corresponding relationship between a preset state parameter range and a parameter state value corresponding to any state parameter, and obtaining a parameter state value corresponding to any state parameter; Inputting each state value corresponding to any one of the execution machines into a preset comprehensive state parameter calculation function to obtain the current comprehensive state parameter of any one of the execution machines; According to the current comprehensive state parameters of each execution machine, determine the target execution machine with the lowest or highest current comprehensive state parameter, the state of the target execution machine is better than that of other execution machines; According to the current comprehensive state parameters of the target execution machine, determine the target parameter interval to which the current comprehensive state parameters of the target execution machine belong; according to the target parameter interval, find the corresponding relationship between the preset parameter interval and the target waiting time to obtain the target waiting time; or, input the current comprehensive state parameters of the target execution machine into a preset waiting time calculation function to obtain the target waiting time; Determine the target waiting time as the waiting time of the script to be tested, and obtain the target script; Sending the target script to the target execution machine so that the target execution machine tests the target script; The state parameters include CPU occupancy rate, memory occupancy rate and response speed; Correspondingly, the step of searching for a corresponding relationship between a preset state parameter range and a parameter state value corresponding to any state parameter according to any state parameter of any execution machine to obtain a parameter state value corresponding to any state parameter includes: According to the CPU occupancy rate of any of the execution machines, searching for a correspondence between a preset CPU occupancy rate range and a processor occupancy state value to obtain a corresponding processor occupancy state value; According to the memory occupancy rate of any of the execution machines, searching for a correspondence between a preset memory occupancy rate range and a memory occupancy status value to obtain a corresponding memory occupancy status value; According to the response speed of any of the execution machines, the corresponding relationship between the preset response speed range and the response speed state value is searched to obtain the corresponding response speed state value.
2. The method according to claim 1, characterized in that: The step of inputting each state value corresponding to any one of the execution machines into a preset comprehensive state parameter calculation function to obtain the current comprehensive state parameter of any one of the execution machines comprises: The processor occupancy state value, memory occupancy state value and response speed state value corresponding to any of the execution machines are input into a preset comprehensive state parameter calculation function to obtain the current comprehensive state parameter of any of the execution machines.
3. The method according to claim 1 or 2, characterized in that: After inputting each state value corresponding to any one of the execution machines into a preset comprehensive state parameter calculation function to obtain the current comprehensive state parameter of any one of the execution machines, the method further includes: If the comprehensive status parameters of all execution machines are less than the preset values, all execution machines are restarted, and the steps of obtaining the execution machine status parameters and calculating the comprehensive status parameters of the execution machines are re-executed.
4. The method according to claim 3, characterized in that After the steps of re-executing the steps of obtaining the execution machine state parameters and calculating the execution machine comprehensive state parameters, the method further includes: If the comprehensive status parameters of all execution machines are less than the preset value, a prompt message will be sent to the corresponding terminal device of the tester.
5. A script testing device, characterized in that: include: A parameter acquisition module, used for acquiring at least one state parameter of all execution machines in response to the start of the test task; A parameter determination module, used for searching, according to any state parameter of any execution machine, a corresponding relationship between a preset state parameter range and a parameter state value corresponding to any state parameter, and obtaining a parameter state value corresponding to any state parameter; Inputting each state value corresponding to any one of the execution machines into a preset comprehensive state parameter calculation function to obtain the current comprehensive state parameter of any one of the execution machines; An execution machine determination module is used to determine a target execution machine with the lowest or highest current comprehensive state parameter according to the current comprehensive state parameters of each execution machine, and the state of the target execution machine is better than that of other execution machines; A time determination module is used to determine the target parameter interval to which the comprehensive state parameter of the target execution machine belongs according to the comprehensive state parameter of the target execution machine; according to the target parameter interval, find the corresponding relationship between the preset parameter interval and the target waiting time to obtain the target waiting time; or, input the comprehensive state parameter of the target execution machine into a preset waiting time calculation function to obtain the target waiting time; A script acquisition module, used to determine the target waiting time as the waiting time of the script to be tested, and obtain a target script; A script sending module, used for sending the target script to the target execution machine so that the target execution machine tests the target script; The state parameters include CPU occupancy rate, memory occupancy rate and response speed; accordingly, the parameter determination module is specifically used to find the corresponding relationship between the preset CPU occupancy rate range and the processor occupancy state value according to the CPU occupancy rate of any of the execution machines, and obtain the corresponding processor occupancy state value; according to the memory occupancy rate of any of the execution machines, find the corresponding relationship between the preset memory occupancy rate range and the memory occupancy state value, and obtain the corresponding memory occupancy state value; According to the response speed of any of the execution machines, the corresponding relationship between the preset response speed range and the response speed state value is searched to obtain the corresponding response speed state value.
6. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the script testing method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the script testing method according to any one of claims 1 to 4 when executed by a processor.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the script testing method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Android multi-model automatic test system and method
CN112667516A
UI automatic test method and device, electronic equipment and storage medium
CN114064503A