A test method, device, storage medium and terminal device for button operations

By setting the execution probability of key operation and test paths, the execution test path and key operation are generated, and the problem of low test coverage in the prior art is solved, and more efficient test coverage is achieved.

CN114328245BActive Publication Date: 2025-06-27SPREADTRUM COMM (TIANJIN) INC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111654513.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2025-06-27
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

In the prior art, random execution of key press operations results in very low test coverage and it is difficult to cover applications in terminal devices.

Method used

By setting the execution probability of multiple key operations and test paths, the execution test path and key operations are generated to ensure that the test path can cover applications in the terminal device.

Benefits of technology

This improves the test coverage of key operation, allowing the test to cover more test interfaces and improves the testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328245B_ABST
    Figure CN114328245B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides a method, apparatus, storage medium, and terminal device for testing button operations. The method includes: setting the execution probability of each button operation among a plurality of button operations; setting the execution probability of each test path among a plurality of test paths; generating an execution test path according to the execution probabilities of the plurality of test paths; generating an execution button operation according to the execution probabilities of the plurality of button operations; and executing the execution button operation by executing the test path. In the technical solution provided by the embodiment of the present invention, the execution button operation can be executed by executing the test path, and the execution test path can cover the application programs in the terminal device, thereby improving the test coverage of the button operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a method, device, storage medium, and terminal device for testing button operations.

Background Art

[0002] In the related art, only random button operations are performed, resulting in a very limited coverage, that is, it is difficult to cover the test interfaces in many applications. The main reason for the low coverage is that, taking the state where the terminal device is currently on the main interface as an example, if you want to enter a certain application, you need to perform a series of button operations in sequence to enter the application. However, the probability of entering the application by the random method is very low, which reduces the test coverage of button operations.

Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a method, device, storage medium, and terminal device for testing button operations to improve the test coverage of button operations.

[0004] On the one hand, an embodiment of the present invention provides a method for testing button operations, including:

[0005] Setting the execution probability of each button operation among multiple button operations;

[0006] Setting the execution probability of each test path among multiple test paths;

[0007] Generating an execution test path according to the execution probabilities of multiple test paths;

[0008] Generating an execution button operation according to the execution probabilities of multiple button operations;

[0009] Executing the execution button operation through the execution test path.

[0010] Optionally, the setting of the execution probability of each button operation among multiple button operations includes:

[0011] Defining a button operation array for multiple button operations;

[0012] Setting button array values for the button operation array;

[0013] Determining the execution probability of each button operation according to the number of elements corresponding to the button array values.

[0014] Optionally, the setting of the execution probability of each test path among multiple test paths includes:

[0015] Defining a test path array for multiple test paths;

[0016] Setting path array values for the test path array;

[0017] Determine the execution probability of each test path according to the number of elements corresponding to the path array value.

[0018] Optionally, the generating an execution test path according to the execution probabilities of multiple test paths includes:

[0019] Generate a path random integer according to the test path array;

[0020] Use the path random integer as the subscript of the test path array, and generate an execution test path according to the execution probabilities of multiple test paths through a set random function.

[0021] Optionally, the generating an execution key operation according to the execution probabilities of multiple key operations includes:

[0022] Generate a key random integer according to the key operation array;

[0023] Use the key random integer as the subscript of the key operation array, and generate an execution key operation according to the execution probabilities of multiple key operations through a set random function.

[0024] Optionally, after the execution key operation is executed according to the execution test path, it includes:

[0025] Obtain the operation duration of the randomly performed key operation;

[0026] Determine whether the operation duration is less than or equal to the set total operation duration;

[0027] If it is determined that the operation duration is less than the set total operation duration, continue to execute the step of generating an execution key operation according to the execution probabilities of multiple key operations;

[0028] If it is determined that the operation duration is equal to the set total operation duration, return to the main interface.

[0029] Optionally, after returning to the main interface, it includes:

[0030] Obtain the test duration of the randomly performed key operation;

[0031] Determine whether the test duration is less than or equal to the set total test duration;

[0032] If it is determined that the test duration is less than the set total test duration, continue to execute the step of generating an execution test path according to the execution probabilities of multiple test paths.

[0033] On the other hand, an embodiment of the present invention provides a test device for key operations, including:

[0034] A first setting module, configured to set the execution probability of each key operation among a plurality of key operations;

[0035] A second setting module, configured to set the execution probability of each test path among a plurality of test paths;

[0036] A first generation module, configured to generate an execution test path according to the execution probabilities of a plurality of test paths;

[0037] A second generation module, configured to generate an execution key operation according to the execution probabilities of a plurality of key operations;

[0038] An execution module, configured to execute the execution key operation through the execution test path.

[0039] On the other hand, an embodiment of the present invention provides a storage medium, including: the storage medium stores a program, wherein when the program runs, it controls the device where the storage medium is located to execute the above-mentioned test method for a key operation.

[0040] On the other hand, an embodiment of the present invention provides a terminal device, including a memory and a processor, the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. It is characterized in that when the program instructions are loaded and executed by the processor, the steps of the above-mentioned test method for a key operation are implemented.

[0041] In the technical solution of the test method for a key operation provided by the embodiment of the present invention, the execution probability of each key operation among a plurality of key operations is set; the execution probability of each test path among a plurality of test paths is set; an execution test path is generated according to the execution probabilities of a plurality of test paths; an execution key operation is generated according to the execution probabilities of a plurality of key operations; the execution key operation is executed through the execution test path. In the technical solution provided by the embodiment of the present invention, the execution key operation can be executed through the execution test path, and the execution test path can cover the application programs in the terminal device, improving the test coverage of the key operation.

Description of the Drawings

[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0043] Figure 1 A test method for a key operation provided by the related art;

[0044] Figure 2Flow chart of a method for testing button operations provided by an embodiment of the present invention;

[0045] Figure 3 Flow chart of another method for testing button operations provided by an embodiment of the present invention;

[0046] Figure 4 Schematic structural diagram of a device for testing button operations provided by an embodiment of the present invention;

[0047] Figure 5 Schematic diagram of a terminal device provided by an embodiment of the present invention.

Detailed implementation manners

[0048] For a better understanding of the technical solutions of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0049] It should be clear that the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.

[0050] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "the" and "said" used in the embodiments of the present invention and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.

[0051] It should be understood that the term " / and" used herein is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after.

[0052] The related art provides a method for testing button operations. Figure 1 For a method for testing button operations provided by the related art, as Figure 1 shown, the method includes:

[0053] Step 102, define an array of button operations for multiple button operations.

[0054] In the embodiments of the present invention, each step is executed by a terminal device. For example, the terminal device includes: a mobile phone, a tablet computer or a wearable device.

[0055] For example, multiple button operations include button operations of a "confirm" button, a "down" button, a "swipe left" button, etc.

[0056] For example, define an array of key operations corresponding to multiple key operations as array_keyboard.

[0057] Step 104: Set the key array values for the array of key operations.

[0058] In the related art, key operations are used to set the key array values for the array of key operations.

[0059] In the related art, it is possible to set the key array values for the array of key operations according to the actual situation.

[0060] Step 106: Determine the execution probability of each key operation according to the number of elements corresponding to the key array values.

[0061] Step 108: Generate an execution key operation according to the execution probabilities of multiple key operations.

[0062] Step 110: Execute the execution key operation.

[0063] For example, if the execution key operation is the key operation of the "OK" key, then execute the key operation of the "OK" key.

[0064] Step 112: Obtain the test duration of the performed key operations.

[0065] Step 114: Determine whether the test duration is less than or equal to the set total test duration. If it is determined that the test duration is less than the set total test duration, execute Step 108; if it is determined that the test duration is equal to the set total test duration, the process ends.

[0066] In the embodiments of the present invention, if it is determined that the test duration is less than the set total test duration, it indicates that the test duration has not reached the required total test duration and further testing is needed, so execute Step 108; if it is determined that the test duration is equal to the set total test duration, it indicates that the test duration has reached the required total test duration and no further testing is needed, and the process ends.

[0067] In the related art, only key operations are randomly executed, which cannot cover the test interfaces in many applications, reducing the test coverage of key operations.

[0068] To solve the technical problems in the related art, embodiments of the present invention provide a method for testing key operations. Figure 2 For the flowchart of a method for testing key operations provided by an embodiment of the present invention, as Figure 2 shown, the method includes:

[0069] Step 202: Set the execution probability of each key operation among multiple key operations.

[0070] In the embodiments of the present invention, each step is executed by a terminal device. For example, the terminal device includes: a mobile phone, a tablet computer or a wearable device.

[0071] For example, multiple key operations include key operations of the "OK" key, key operations of the "down" key, key operations of the "swipe left" key, etc. Among them, to prevent premature exit from the test interface, multiple key operations do not include key operations of the "power" key and key operations of the "back" key.

[0072] Step 204: Set the execution probability of each test path among multiple test paths.

[0073] Step 206: Generate an execution test path according to the execution probabilities of multiple test paths.

[0074] Step 208: Generate an execution key operation according to the execution probabilities of multiple key operations.

[0075] Step 210: Execute the execution key operation by executing the test path.

[0076] For example, if the execution key operation is the key operation of the "OK" key, then execute the key operation of the "OK" key by executing the test path.

[0077] In the technical solution provided by the embodiments of the present invention, set the execution probability of each key operation among multiple key operations; set the execution probability of each test path among multiple test paths; generate an execution test path according to the execution probabilities of multiple test paths; generate an execution key operation according to the execution probabilities of multiple key operations; execute the execution key operation by executing the test path. In the technical solution provided by the embodiments of the present invention, the execution key operation can be executed by executing the test path, and the execution test path can cover the application programs in the terminal device, improving the test coverage of the key operation.

[0078] The embodiments of the present invention provide another method for testing key operations. Figure 3 It is a flowchart of another method for testing key operations provided by the embodiments of the present invention. As Figure 3 shown, the method includes:

[0079] Step 302: Define an array of key operations for multiple key operations.

[0080] In the embodiments of the present invention, each step is executed by a terminal device. For example, the terminal device includes: a mobile phone, a tablet computer or a wearable device.

[0081] For example, multiple key operations include up, down, left, right and OK, etc. Among them, to prevent premature exit from the test interface, multiple key operations do not include key operations of the "power" key and key operations of the "back" key.

[0082] For example, define an array of key operations corresponding to multiple key operations as array_keyboard.

[0083] Step 304: Set the key array values for the array of key operations.

[0084] In the embodiments of the present invention, the key array values can be set for the array of key operations according to the actual situation.

[0085] In the embodiments of the present invention, the key array values can be set for the array of key operations with key operations. For example, the array of key operations can be array_keyboard[up, down, left, right, ok, up, down, down, up, left, ok].

[0086] Step 306: Determine the execution probability of each key operation according to the number of elements corresponding to the key array values.

[0087] In the embodiments of the present invention, if the array of key operations is array_keyboard[up, down, left, right, ok, up, down, down, up, left, ok], the number of elements corresponding to the key array values is 11.

[0088] As an alternative, the more the number of elements corresponding to the key array values of the array of key operations, the higher the execution probability of the key operation.

[0089] Step 308: Define an array of test paths for multiple test paths.

[0090] In the embodiments of the present invention, the test paths for entering the application can be encapsulated into methods.

[0091] In the embodiments of the present invention, the test paths are the test paths leading to the applications installed in the terminal device. The multiple test paths include: the test path of Application A, the test path of Application B, the test path of Application C, etc.

[0092] For example, define an array of test paths corresponding to multiple test paths as array_fuction.

[0093] Step 310: Set the path array values for the array of test paths.

[0094] In the embodiments of the present invention, the path array values can be set for the array of test paths according to the actual situation.

[0095] In the embodiments of the present invention, the path array values can be set for the array of test paths with test paths. For example, the array of test paths can be array_fuction[A, C, B, C, A, A, A].

[0096] Step 312: Determine the execution probability of each test path according to the number of elements corresponding to the path array value.

[0097] In the embodiment of the present invention, if the test path array is array_fuction[A, C, B, C, A, A, A], the number of elements corresponding to the path array value is 7.

[0098] As an alternative, the more the number of elements corresponding to the path array value of the test path array, the higher the execution probability of the test path.

[0099] Step 314: Generate a path random integer according to the test path array.

[0100] As an alternative, within the range of [0, the length of the test path array - 1], a path random integer is randomly generated through the set random function.

[0101] Step 316: Use the path random integer as the subscript of the test path array, and generate an executed test path according to the execution probabilities of multiple test paths through the set random function.

[0102] For example, if the test paths include: the test path of application A, the test path of application B, and the test path of application C, the test path array can be array_fuction[A, C, B, C, A, A, A], and the data length is 7. Then, through the random function, an integer is randomly generated within [0, 6]. If the generated random integer is 5, then use this random integer 5 as the subscript of the test path array, that is, the key operation to be executed is array[5], which is the test path of application A. At this time, the executed test path is the test path of application A.

[0103] Step 318: Generate a key random integer according to the key operation array.

[0104] As an alternative, within the range of [0, the length of the key operation array - 1], a key random integer is randomly generated through the set random function.

[0105] Step 320: Use the key random integer as the subscript of the key operation array, and generate an executed key operation according to the execution probabilities of multiple key operations through the set random function.

[0106] For example, if the key operations include: up, down, left, right, and confirm, then the key operation array can be array_keyboard[up, down, left, right, confirm, up, down, down, up, left, confirm], and the data length is 11. Then, through a random function, an integer is randomly generated in the range [0, 10]. If the randomly generated integer is 5, then this random integer 5 is used as the subscript of the key operation array, that is, the key operation to be executed is array[5] which is confirm. At this time, the key operation of the "confirm" key is executed.

[0107] Step 322: Execute this key operation by executing the test path.

[0108] For example, through the test path of Application A, execute the key operation of the "confirm" key.

[0109] Step 324: Obtain the operation duration of the performed key operation.

[0110] Step 326: Determine whether the operation duration is less than or equal to the set total operation duration. If it is determined that the operation duration is less than the set total operation duration, execute Step 318; if it is determined that the operation duration is equal to the set total operation duration, execute Step 328.

[0111] In the embodiment of the present invention, if it is determined that the operation duration is less than the set total operation duration, it indicates that the operation duration of this key operation has not reached the set total operation duration, and this key operation needs to be continued to be tested, and Step 318 is executed; if it is determined that the operation duration is equal to the set total operation duration, it indicates that the operation duration of this key operation has reached the set total operation duration, and this key operation does not need to be continued to be tested, and Step 328 is executed.

[0112] Step 328: Return to the main interface.

[0113] As an optional solution, the main interface is the desktop of this terminal device.

[0114] Step 330: Obtain the test duration of the performed random key operation.

[0115] Step 332: Determine whether the test duration is less than or equal to the set total test duration. If it is determined that the test duration is less than the set total test duration, execute Step 314; if it is determined that the test duration is equal to the set total test duration, the process ends.

[0116] In the embodiment of the present invention, if it is determined that the test duration is less than the set total test duration, it indicates that the test duration has not reached the required total test duration, and testing needs to be continued, and Step 214 is executed; if it is determined that the test duration is equal to the set total test duration, it indicates that the test duration has reached the required total test duration, and testing does not need to be continued, and the process ends.

[0117] In the technical solution provided by the embodiment of the present invention, the execution probability of each key operation among multiple key operations is set; the execution probability of each test path among multiple test paths is set; an execution test path is generated according to the execution probabilities of the multiple test paths; an execution key operation is generated according to the execution probabilities of the multiple key operations; and the execution key operation is executed by executing the test path. In the technical solution provided by the embodiment of the present invention, the execution key operation can be executed by executing the test path, and the execution test path can cover the application programs in the terminal device, improving the test coverage of the key operation.

[0118] In the technical solution provided by the embodiment of the present invention, the test path from the main interface to the test interface of the application program is encapsulated into a method, a test path is randomly selected as the execution test path, after entering the execution test path, random key operations are executed for a period of time, then return to the main interface, and then the next test path is randomly selected, and so on until the set total test duration is reached. The execution test path can cover the application programs in the terminal device, improving the test coverage of the key operation, enabling the test to cover more test interfaces, and being able to find more problems within the same test time, further improving the test efficiency of the key operation.

[0119] The embodiment of the present invention provides a test device for key operations. Figure 4 It is a schematic structural diagram of a test device for key operations provided by the embodiment of the present invention, as Figure 4 shown, the device includes: a first setting module 11, a second setting module 12, a first generating module 13, a second generating module 14, and an execution module 15.

[0120] The first setting module 11 is used to set the execution probability of each key operation among multiple key operations.

[0121] The second setting module 12 is used to set the execution probability of each test path among multiple test paths.

[0122] The first generating module 13 is used to generate an execution test path according to the execution probabilities of the multiple test paths.

[0123] The second generating module 14 is used to generate an execution key operation according to the execution probabilities of the multiple key operations.

[0124] The execution module 15 is used to execute the execution key operation by means of the execution test path.

[0125] In the embodiment of the present invention, the first setting module 11 is specifically used to define a key operation array of multiple key operations; set key array values for the key operation array; and determine the execution probability of each key operation according to the number of elements corresponding to the key array values.

[0126] In an embodiment of the present invention, the second setting module 12 is specifically configured to define a test path array for a plurality of test paths; set path array values for the test path array; and determine the execution probability of each test path according to the number of elements corresponding to the path array values.

[0127] In an embodiment of the present invention, the first generating module 13 is specifically configured to generate a path random integer according to the test path array; use the path random integer as the subscript of the test path array, and generate an executed test path according to the execution probabilities of the plurality of test paths through a set random function.

[0128] In an embodiment of the present invention, the second generating module 14 is specifically configured to generate a key random integer according to the key operation array; use the key random integer as the subscript of the key operation array, and generate an executed key operation according to the execution probabilities of the plurality of key operations through a set random function.

[0129] In an embodiment of the present invention, the device further includes: a first obtaining module 16, a first judging module 17, and a returning module 18.

[0130] The first obtaining module 16 is used to obtain the operation duration of the random key operation that has been performed.

[0131] The first judging module 17 is used to judge whether the operation duration is less than or equal to the set total operation duration; if it is judged that the operation duration is less than the set total operation duration, trigger the second generating module 14 to continue to execute the step of generating an executed key operation according to the execution probabilities of the plurality of key operations; if it is judged that the operation duration is equal to the set total operation duration, trigger the returning module 18 to return to the main interface.

[0132] In an embodiment of the present invention, the device further includes: a second obtaining module 19 and a second judging module 20.

[0133] The second obtaining module 19 is used to obtain the test duration of the random key operation that has been performed.

[0134] The second judging module 20 is used to judge whether the test duration is less than or equal to the set total test duration; if it is judged that the test duration is less than the set total test duration, trigger the first generating module 13 to continue to execute the step of generating an executed test path according to the execution probabilities of the plurality of test paths.

[0135] In the technical solution provided by the embodiment of the present invention, the execution probability of each key operation among multiple key operations is set; the execution probability of each test path among multiple test paths is set; an execution test path is generated according to the execution probabilities of the multiple test paths; an execution key operation is generated according to the execution probabilities of the multiple key operations; and the execution key operation is executed by executing the test path. In the technical solution provided by the embodiment of the present invention, the execution key operation can be executed by executing the test path, and the execution test path can cover the application programs in the terminal device, improving the test coverage of the key operation.

[0136] The test device for key operations provided in this embodiment can be used to implement the above Figure 2 and Figure 3 the test method for key operations therein. For specific descriptions, reference can be made to the embodiments of the test method for key operations above, and details will not be repeated here.

[0137] The embodiment of the present invention provides a storage medium. The storage medium includes a stored program. When the program runs, it controls the device where the storage medium is located to execute the steps of the embodiments of the above test method for key operations. For specific descriptions, reference can be made to the embodiments of the test method for key operations above.

[0138] The embodiment of the present invention provides a terminal device, including a memory and a processor. The memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, the steps of the embodiments of the above test method for key operations are implemented. For specific descriptions, reference can be made to the embodiments of the test method for key operations above.

[0139] Figure 5 It is a schematic diagram of a terminal device provided by the embodiment of the present invention. As Figure 5 shown, the terminal device 50 of this embodiment includes: a processor 51, a memory 52, and a computer program 53 stored in the memory 52 and executable on the processor 51. When the computer program 53 is executed by the processor 51, the test method for key operations in the embodiment is implemented. To avoid repetition, details are not described here one by one. Alternatively, when the computer program is executed by the processor 51, the functions of each model / unit in the test device for key operations in the embodiment are implemented. To avoid repetition, details are not described here one by one.

[0140] The terminal device 50 includes, but is not limited to, a processor 51 and a memory 52. Those skilled in the art can understand that Figure 5 this is only an example of the terminal device 50 and does not constitute a limitation on the terminal device 50. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, the terminal device may further include input / output devices, network access devices, buses, etc.

[0141] The so-called processor 51 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor may also be any conventional processor, etc.

[0142] The memory 52 may be an internal storage unit of the terminal device 50, such as the hard disk or memory of the terminal device 50. The memory 52 may also be an external storage device of the terminal device 50, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 50. Further, the memory 52 may also include both the internal storage unit and the external storage device of the terminal device 50. The memory 52 is used to store computer programs and other programs and data required by the terminal device. The memory 52 may also be used to temporarily store data that has been output or is to be output.

[0143] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

[0144] In several embodiments provided by the present invention, 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 merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other may be through some interfaces, and the indirect couplings or communication connections of the devices or units may be in electrical, mechanical, or other forms.

[0145] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0146] In addition, in each embodiment of the present invention, each functional unit may be integrated in a processing unit, may exist separately physically for each unit, or two or more units may be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a hardware plus software functional unit.

[0147] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit stored in a storage medium includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute some steps of the methods described in each embodiment of the present invention. The foregoing storage medium includes: various media 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 disc that can store program codes.

[0148] The foregoing is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the scope of protection of the present invention.

Claims

1. A test method for button operations, characterized in that, including: setting the execution probability of each key operation among multiple key operations; setting the execution probability of each test path among multiple test paths; generating an execution test path according to the execution probabilities of multiple test paths; generating an execution key operation according to the execution probabilities of multiple key operations; executing the execution key operation through the execution test path; The setting of the execution probability of each test path among multiple test paths includes: defining a test path array of multiple test paths; setting a path array value for the test path array; determining the execution probability of each test path according to the number of elements corresponding to the path array value; The generating of the execution test path according to the execution probabilities of multiple test paths includes: generating a path random integer according to the test path array; using the path random integer as the subscript of the test path array, and generating an execution test path according to the execution probabilities of multiple test paths through a set random function; wherein, the execution test path is a randomly selected test path after encapsulating the test path from the main interface to the test interface of the application program into a method.

2. The method according to claim 1, characterized in that, The setting of the execution probability of each key operation among multiple key operations includes: defining a key operation array of multiple key operations; setting a key array value for the key operation array; determining the execution probability of each key operation according to the number of elements corresponding to the key array value.

3. The method according to claim 2, wherein The generating of the execution key operation according to the execution probabilities of multiple key operations includes: generating a key random integer according to the key operation array; using the key random integer as the subscript of the key operation array, and generating an execution key operation according to the execution probabilities of multiple key operations through a set random function.

4. The method according to claim 1, characterized in that After executing the execution key operation according to the execution test path, it includes: obtaining the operation duration of the randomly performed key operation; judging whether the operation duration is less than or equal to the set total operation duration; if it is judged that the operation duration is less than the set total operation duration, continue to execute the step of generating an execution key operation according to the execution probabilities of multiple key operations; if it is judged that the operation duration is equal to the set total operation duration, return to the main interface.

5. The method according to claim 4, wherein After returning to the main interface, it includes: obtaining the test duration of the randomly performed key operation; judging whether the test duration is less than or equal to the set total test duration; if it is judged that the test duration is less than the set total test duration, continue to execute the step of generating an execution test path according to the execution probabilities of multiple test paths.

6. A test device for button operation, characterized in that including: a first setting module for setting the execution probability of each key operation among multiple key operations; a second setting module for setting the execution probability of each test path among multiple test paths; a first generating module for generating an execution test path according to the execution probabilities of multiple test paths; a second generating module for generating an execution key operation according to the execution probabilities of multiple key operations; an execution module for executing the execution key operation through the execution test path; The second setting module is specifically configured to define a test path array for multiple test paths; set path array values for the test path array; and determine the execution probability of each test path according to the number of elements corresponding to the path array values. The first generation module is specifically configured to generate a path random integer according to the test path array; use the path random integer as the subscript of the test path array, and generate an executed test path according to the execution probabilities of multiple test paths through a set random function. Among them, the executed test path is a test path randomly selected after encapsulating the test path from the main interface to the test interface of the application program into a method.

7. A storage medium, characterized in that, Including: The storage medium includes a stored program, wherein when the program runs, it controls the device where the storage medium is located to execute the test method for a key operation described in any one of claims 1 to 5.

8. A terminal device, comprising a memory and a processor, the memory being used for storing information including program instructions, and the processor being used for controlling the execution of the program instructions, characterized in that, When the program instructions are loaded and executed by a processor, the steps of the test method for a key operation described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Test method and device

    CN105988931A