Graphical user interface-based black box test method, device and equipment
By clustering and combining basic test operations, efficient test scripts are generated, which solves the problems of low reusability and low efficiency of test scripts in the existing technology, and realizes efficient automation of graphical user interface testing.
Patent Information
- Application Number
- CN202410698054.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-09-13
AI Technical Summary
The existing test scripts generated based on recording and playback tools have low reusability and are difficult to maintain. Manually writing test scripts is inefficient, making it difficult to implement efficient graphical user interface testing.
By clustering basic test operations, unit test operations are obtained and combined into test scripts to realize automated testing of the graphical user interface and improve the reusability and maintainability of test scripts.
It improves the reusability and maintainability of test scripts, improves test efficiency, reduces the need for manual script writing, and simplifies the test operation process.
Smart Images

Figure CN118642950A
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a black box testing method, device and equipment based on a graphical user interface. Background Art
[0002] A Graphical User Interface (GUI) is a form of human-computer interaction interface that allows users to operate computers or other devices through graphical elements such as windows, icons, buttons, menus, etc. without entering complex commands.
[0003] In the related art, a user's operation on a GUI is recorded by a recording and playback tool to generate a test script. Alternatively, the position coordinates of controls in the GUI are manually recorded, and then a test script is manually written based on the position coordinates of the controls. The test script is then used to test the GUI.
[0004] However, the above-mentioned method of generating test scripts based on recording using a recording and playback tool has low test script reusability and is difficult to maintain; and the method of manually writing test scripts has low test efficiency. Summary of the invention
[0005] Based on this, it is necessary to provide a black box testing method, device and equipment based on a graphical user interface to address the above technical problems, which can achieve higher test script reuse rate, easier maintenance and higher testing efficiency.
[0006] In a first aspect, the present application provides a black box testing method based on a graphical user interface, comprising:
[0007] Obtaining a unit test operation selected from predetermined unit test operations, and obtaining an operation set of the current test task according to a selection order among the selected unit test operations; wherein the unit test operation is obtained by clustering basic test operations;
[0008] For any unit test operation in the operation set, obtain a unit test script of the unit test operation; wherein the unit test script is obtained by combining basic test scripts corresponding to basic test operations in the unit test operation;
[0009] Combine the unit test scripts of each unit test operation in the operation set to obtain a current test script of the current test task;
[0010] Call the current test script to test the graphical user interface and obtain the current test results.
[0011] In a second aspect, the present application provides a black box testing device based on a graphical user interface, comprising:
[0012] A selection module is used to obtain a unit test operation selected from various predetermined unit test operations, and obtain an operation set of the current test task according to a selection order between the selected unit test operations; wherein the unit test operation is obtained by clustering basic test operations;
[0013] An acquisition module, used for acquiring a unit test script of a unit test operation for any unit test operation in the operation set; wherein the unit test script is obtained by combining basic test scripts corresponding to basic test operations in the unit test operation;
[0014] A combination module, used to combine the unit test scripts of each unit test operation in the operation set to obtain a current test script of the current test task;
[0015] The test module is used to call the current test script to test the graphical user interface and obtain the current test results.
[0016] In a third aspect, the present application provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method when executing the computer program.
[0017] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when executed by a processor.
[0018] In a fifth aspect, the present application provides a computer program product, which includes a computer program, and the computer program implements the steps in the above method when executed by a processor.
[0019] The above-mentioned black box testing method, device and equipment based on the graphical user interface can cluster the basic test operations in advance to obtain unit test operations. Then the user can select the required unit test operations from each unit test operation, and combine them to obtain the operation set of the current test task. The current test script can be obtained by combining the unit test scripts corresponding to each unit test operation in the operation set. Call the current test script to complete the test of the graphical user interface. The current test script can be obtained by combining the unit test operations, without the need to manually write the test script, and the testing efficiency is higher. And through clustering, strongly related basic test operations can be aggregated into unit test operations, which is more convenient for users to combine operations, and compared with the method of generating test scripts based on recording using recording and playback tools, the unit test scripts corresponding to the unit test operations have a higher reuse rate and are easy to maintain. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1An application environment diagram of a black box testing method based on a graphical user interface provided in an embodiment of the present application;
[0021] Figure 2 A flowchart of a black box testing method based on a graphical user interface provided in an embodiment of the present application;
[0022] Figure 3 A schematic flow chart of a method for clustering basic test operations provided in an embodiment of the present application;
[0023] Figure 4 A block diagram of a black box testing device based on a graphical user interface provided in an embodiment of the present application;
[0024] Figure 5 An internal structure diagram of a computer device provided in an embodiment of the present application;
[0025] Figure 6 An internal structure diagram of another computer device provided in an embodiment of the present application;
[0026] Figure 7 An internal structure diagram of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0028] The black box testing method based on a graphical user interface provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through a communication network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0029] like Figure 2 As shown, the embodiment of the present application provides a black box testing method based on a graphical user interface, and the method is applied to Figure 1The terminal 102 or the server 104 in the example is used for explanation. It is understandable that the computer device may include at least one of the terminal and the server. The method comprises the following steps:
[0030] Step 201 , obtaining a unit test operation selected from predetermined unit test operations, and obtaining an operation set of the current test task according to a selection order among the selected unit test operations; wherein the unit test operation is obtained by clustering basic test operations.
[0031] Among them, the basic test operation refers to a single operation performed by the user on the graphical user interface, such as clicking a login control of the graphical user interface, entering characters under an input control, etc.
[0032] Specifically, multiple basic test operations can be obtained, and the basic test operations can be clustered, and at least two strongly associated basic test operations can be connected in a certain operation order to obtain a unit test operation. The unit test operation can be a "scenario fragment", for example, the unit test scenario can be "open software", "enter user settings", "modify user information", "exit software", etc.
[0033] Specifically, in response to the user's selection operation, the unit test operation selected from the predetermined unit test operations can be obtained, and the selected unit test operations can be combined according to the selection order between the selected unit test operations to obtain the test set of the current test task. Therefore, the user can combine the unit test operations in a simple drag-and-drop assembly manner to obtain the operation set of the current test task.
[0034] Step 202, for any unit test operation in the operation set, obtain a unit test script of the unit test operation; wherein the unit test script is obtained by combining basic test scripts corresponding to basic test operations in the unit test operation.
[0035] Herein, basic test scripts corresponding to at least one basic test operation included in any unit test operation in the operation set are combined to obtain a unit test script corresponding to the unit test operation.
[0036] Step 203, combining the unit test scripts of each unit test operation in the operation set to obtain a current test script of the current test task.
[0037] The current test script may call the unit test scripts corresponding to the unit test operations according to the order of the unit test operations in the current test task.
[0038] Step 204, calling the current test script to test the graphical user interface and obtaining the current test result.
[0039] Specifically, the current test script can be called to test the graphical user interface to obtain a test screen image, the real screen image corresponding to the current test task can be obtained, and the real screen image can be compared with the test screen image, and the current test result can be determined according to the comparison result.
[0040] It can be seen that in an embodiment of the present application, basic test operations can be clustered in advance to obtain unit test operations. Then the user can select the required unit test operations from each unit test operation, and combine them to obtain the operation set of the current test task. The current test script can be obtained by combining the unit test scripts corresponding to each unit test operation in the operation set. The current test script is called to complete the test of the graphical user interface. The current test script can be obtained by combining the unit test operations, without the need to manually write the test script, and the testing efficiency is higher. And through clustering, strongly associated basic test operations can be aggregated into unit test operations, which is more convenient for users to combine operations, and compared with the method of generating test scripts based on recording using recording and playback tools, the unit test scripts corresponding to the unit test operations have a higher reuse rate and are easy to maintain.
[0041] In some embodiments, a unit test operation is determined as follows:
[0042] Record basic test operations of the graphical user interface;
[0043] Based on the operation sequence between the basic test operations, the basic test operations are combined to obtain a test operation sequence;
[0044] Based on the order between different basic test operations in the test operation sequence, the basic test operations are clustered to obtain unit test operations.
[0045] Specifically, an open source recording tool may be used to record basic test operations performed by a user on a graphical user interface.
[0046] Specifically, the basic test operations may be connected based on the operation sequence between the basic test operations performed by the user on the graphical user interface to obtain a test operation sequence.
[0047] Specifically, the basic test operations may be clustered based on the order of different basic test operations included in each test operation sequence, and the strongly related basic test operations may be grouped together to obtain unit test operations.
[0048] It can be seen that in this embodiment, basic test operations can be obtained more conveniently by recording, and through the order between different basic test operations in the test operation sequence, strongly related basic test operations can be conveniently aggregated together to obtain unit test operations.
[0049] In some embodiments, based on the order of different basic test operations in the test operation sequence, clustering the basic test operations to obtain unit test operations includes:
[0050] Based on the order between different basic test operations in any test operation sequence, the i-th to j-th basic test operations in the test operation sequence are used as candidate basic operation groups; wherein i is less than j;
[0051] Determine whether the matching degree between the candidate basic operation group and each test operation sequence meets the preset matching condition;
[0052] If it is satisfied, j is added with the preset first step length as the new j, and the i-th to the new j-th basic test operations in the test operation sequence are used as new candidate basic operation groups, and it is determined whether the matching degree between the new candidate basic operation group and each test operation sequence meets the preset matching condition;
[0053] If not, the candidate basic operation group is used as the candidate operation group obtained by clustering the basic test operations, and i is updated with the new j, and the updated i plus the preset first step length is used as the updated j, until the updated j is greater than the total number of basic test operations in the test operation sequence;
[0054] Based on the candidate operation groups, determine the unit test operations.
[0055] Wherein, i and j are both positive integers.
[0056] The preset matching condition is a matching condition preset based on experience.
[0057] Specifically, the candidate basic operation group may be matched with all the test operation sequences respectively to obtain the matching degree between the candidate basic operation group and each test operation sequence, and the matching degree may be compared with the preset matching condition to determine whether the matching degree satisfies the preset matching condition.
[0058] The preset first step length is a step length value preset based on experience, for example, the preset first step length may be 1.
[0059] Specifically, the candidate operation group may be processed, such as deduplication processing, to obtain the unit test operation.
[0060] It can be seen that in this embodiment, the basic test operations can be conveniently clustered to obtain unit test operations through the above method.
[0061] like Figure 3 As shown, the present application embodiment provides a schematic flow chart of a method for clustering basic test operations. Figure 3, the present application provides a specific embodiment for clustering basic test operations. The implementation process of this specific embodiment is as follows:
[0062] Assume that the user has recorded three complete videos. A complete video starts from launching the graphical user interface and ends when exiting the graphical user interface.
[0063] According to the single operation steps, these three complete videos are broken down into the following three test operation sequences, where each number represents an operation step, i.e., the basic test operation:
[0064] The first test operation sequence: 01-02-03-09-08-09-10-99;
[0065] The second test operation sequence: 01-04-05-02-03-09-10-02-03-09-99;
[0066] The third test operation sequence: 01-06-07-02-03-09-13-99.
[0067] Since the complete video is recorded, 01 refers to starting the graphical user interface, and 99 refers to exiting the graphical user interface. There is no limit on the intermediate operation steps.
[0068] Starting from the first test operation sequence, initialize i to the first basic test operation 01, and j is the next position of i, then the candidate basic operation group is obtained as [i's position - j's position], that is, [01-02];
[0069] Search [01-02] from all test operation sequences. If the frequency of occurrence is less than 3, move i to the next position, and j to the next position, to obtain a new candidate basic operation group [02-03].
[0070] Search for [02-03] from all test operation sequences. The frequency of occurrence is 4, which is greater than 3. Then move j back one position and look at [02-03-09]. The frequency of occurrence is also greater than 3. Then continue to move j and look at [02-03-09-08]. The frequency of occurrence is not greater than 3 at this time. Then take [02-03-09] as the candidate operation group.
[0071] Continue to move i to j's position. j is next to i. The new candidate basic operation group is [09-10]. Search for [09-10] from all test operation sequences. If the frequency of occurrence is less than 3, i will be moved back one position. j is out of the sequence and the process ends.
[0072] Similarly, according to the above method, continue searching for the second test operation sequence and the third test operation sequence.
[0073] In some embodiments, determining whether the degree of matching between the candidate basic operation group and each test operation sequence satisfies a preset matching condition includes:
[0074] Determine the frequency of occurrence of the candidate basic operation group in each test operation sequence;
[0075] If the frequency is greater than a preset matching threshold, it is determined that the matching degree between the candidate basic operation group and each test operation sequence meets the preset matching condition.
[0076] The preset matching threshold is a matching threshold preset based on experience. For example, the preset matching threshold can be set to 2.
[0077] It can be seen that in this embodiment, the frequency of occurrence of the candidate basic operation in all test operation sequences can be used to conveniently determine whether the matching degree between the candidate basic operation group and each test operation sequence meets the preset matching condition.
[0078] In some embodiments, determining a unit test operation according to the candidate operation group includes:
[0079] Taking the mth candidate operation group as the target candidate operation group, and determining the relationship between the target candidate operation group and the nth candidate operation group according to the order between at least one basic test operation and at least one basic test operation included in the target candidate operation group, and according to the order between at least one basic test operation and at least one basic test operation included in the nth candidate operation group; wherein m is less than n;
[0080] If the relationship between the target candidate operation group and the nth candidate operation group satisfies at least one of the following, n is added with a preset second step length as a new n, until the new n is greater than the total number of candidate operation groups, and the target candidate operation group is determined as a unit test operation:
[0081] The relationship between the target candidate operation group and the nth candidate operation group is: if the target candidate operation group contains the nth candidate operation group, or the target candidate operation group is the same as the nth candidate operation group, then the nth candidate operation group is deleted;
[0082] The relationship between the target candidate operation group and the nth candidate operation group is: if the nth candidate operation group contains the target candidate operation group, the nth candidate operation group is used as a new target candidate operation group, and the mth candidate operation group is deleted;
[0083] The relationship between the target candidate operation group and the nth candidate operation group is: there is no inclusion relationship between the target candidate operation group and the nth candidate operation group.
[0084] Specifically, all obtained candidate operation groups may be sorted, and the mth candidate operation group is used as the target candidate operation group; wherein m and n are both positive integers.
[0085] The preset second step length is a step length preset based on experience, for example, the preset second step length can be set to 1.
[0086] Specifically, the target candidate operation group includes the nth candidate operation group, which means that the target candidate operation group also includes at least one basic test operation in addition to the nth candidate operation group. For example, if the target candidate operation group is: 01-02-03-08-10, and the nth candidate operation group is 01-02-03, it can be determined that the target candidate operation group includes the nth candidate operation group; wherein 01, 02, 03, 08 and 10 are all used to refer to basic test operations.
[0087] For example, if the target candidate operation group is 01-02-03-08-10 and the nth candidate operation group is 01-03-08, it can be determined that there is no inclusion relationship between the target candidate operation group and the nth candidate operation group. 01, 02, 03, 08 and 10 are all used to refer to basic test operations.
[0088] It can be seen that in this embodiment, the above method can be used to conveniently implement the deduplication operation of the candidate operation group. The more strongly associated steps are merged, the clearer the test script is, and the easier it is for the user to select an operation. The above method can be used to select the candidate operation group with the most steps in each candidate operation group with an inclusion relationship as a unit test operation.
[0089] In some embodiments, the method further comprises:
[0090] Based on the recording of the basic test operations of the graphical user interface, a basic test record of each basic test operation is obtained; wherein the basic test record includes event information and control information of the basic test operation corresponding to the basic test record;
[0091] A basic test script for a basic test operation corresponding to the basic test record is generated according to the basic test record.
[0092] Specifically, an open source recording tool can be used to obtain basic test records of each basic test operation during the recording of the basic test operation of the graphical user interface. Among them, event information refers to the user's operation behavior, such as clicking the mouse, double-clicking the mouse, inputting characters, etc. Among them, control information refers to the relevant information of the control object in the graphical user interface operated by the user, including the name, location, and page of the control object. An open source recording tool can be used to generate a basic test script for the basic test operation corresponding to the basic test record based on the basic test record.
[0093] It can be seen that in this embodiment, the basic test script corresponding to the basic test operation can be conveniently obtained by using the above method.
[0094] In some embodiments, obtaining a unit test operation selected from predetermined unit test operations includes:
[0095] Get the current annotation information of the current test task;
[0096] The current annotation information is matched with the function annotation information pre-configured for the unit test operation, and the unit test operation corresponding to the successfully matched function annotation information is determined as the unit test operation selected from the pre-determined unit test operations.
[0097] Specifically, function annotation information may be pre-configured for unit test operations, for example, the function annotation information may include "open software", "enter user settings", "modify user information", "exit software", etc. Users may select operations based on the pre-configured function annotation information for unit test operations.
[0098] It can be seen that in this embodiment, by pre-configuring function annotation information for unit test operations, the user's selection operation is more convenient and the test efficiency is improved.
[0099] In some embodiments, the method further comprises:
[0100] In response to an update event of any basic test operation in the graphical user interface, each unit test operation including the basic test operation is obtained, and each obtained unit test operation is synchronously updated.
[0101] Specifically, if any basic test operation in the graphical user interface is updated, all unit test operations including the basic test operation may be acquired, and the acquired unit test operations may be synchronously updated.
[0102] Furthermore, if any function in the graphical user interface is no longer needed, the unit test operation corresponding to the function can be deleted. Once the deletion operation is performed, the function will no longer appear in the current test task.
[0103] It can be seen that in this embodiment, the unit test operation can be maintained more conveniently through the above method.
[0104] It should be understood that, although the steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0105] Based on the same inventive concept, the embodiment of the present application also provides a black box testing device based on a graphical user interface. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the black box testing device based on a graphical user interface provided below can refer to the limitations of the black box testing method based on a graphical user interface above, and will not be repeated here.
[0106] like Figure 4 As shown, the embodiment of the present application provides a black box testing device 400 based on a graphical user interface, including:
[0107] A selection module 410 is used to obtain a unit test operation selected from various predetermined unit test operations, and obtain an operation set of the current test task according to a selection order between the selected unit test operations; wherein the unit test operation is obtained by clustering the basic test operations;
[0108] The acquisition module 420 is used to acquire a unit test script of any unit test operation in the operation set; wherein the unit test script is obtained by combining basic test scripts corresponding to basic test operations in the unit test operation;
[0109] A combining module 430 is used to combine the unit test scripts of each unit test operation in the operation set to obtain a current test script of the current test task;
[0110] The test module 440 is used to call the current test script to test the graphical user interface and obtain the current test result.
[0111] In some embodiments, in determining the unit test operation, the selection module 410 is specifically configured to:
[0112] Record basic test operations of the graphical user interface;
[0113] Based on the operation sequence between the basic test operations, the basic test operations are combined to obtain a test operation sequence;
[0114] Based on the order between different basic test operations in the test operation sequence, the basic test operations are clustered to obtain unit test operations.
[0115] In some embodiments, in terms of clustering basic test operations to obtain unit test operations based on the order between different basic test operations in the test operation sequence, the selection module 410 is specifically configured to:
[0116] Based on the order between different basic test operations in any test operation sequence, the i-th to j-th basic test operations in the test operation sequence are used as candidate basic operation groups; wherein i is less than j;
[0117] Determine whether the matching degree between the candidate basic operation group and each test operation sequence meets the preset matching condition;
[0118] If it is satisfied, j is added with the preset first step length as the new j, and the i-th to the new j-th basic test operations in the test operation sequence are used as new candidate basic operation groups, and it is determined whether the matching degree between the new candidate basic operation group and each test operation sequence meets the preset matching condition;
[0119] If not, the candidate basic operation group is used as the candidate operation group obtained by clustering the basic test operations, and i is updated with the new j, and the updated i plus the preset first step length is used as the updated j, until the updated j is greater than the total number of basic test operations in the test operation sequence;
[0120] Based on the candidate operation groups, determine the unit test operations.
[0121] In some embodiments, in determining whether the matching degree between the candidate basic operation group and each test operation sequence meets the preset matching condition, the selection module 410 is specifically used to:
[0122] Determine the frequency of occurrence of the candidate basic operation group in each test operation sequence;
[0123] If the frequency is greater than a preset matching threshold, it is determined that the matching degree between the candidate basic operation group and each test operation sequence meets the preset matching condition.
[0124] In some embodiments, in determining the unit test operation according to the candidate operation group, the selection module 410 is specifically used to:
[0125] Taking the mth candidate operation group as the target candidate operation group, and determining the relationship between the target candidate operation group and the nth candidate operation group according to the order between at least one basic test operation and at least one basic test operation included in the target candidate operation group, and according to the order between at least one basic test operation and at least one basic test operation included in the nth candidate operation group; wherein m is less than n;
[0126] If the relationship between the target candidate operation group and the nth candidate operation group satisfies at least one of the following, n is added with a preset second step length as a new n, until the new n is greater than the total number of candidate operation groups, and the target candidate operation group is determined as a unit test operation:
[0127] The relationship between the target candidate operation group and the nth candidate operation group is: if the target candidate operation group contains the nth candidate operation group, or the target candidate operation group is the same as the nth candidate operation group, then the nth candidate operation group is deleted;
[0128] The relationship between the target candidate operation group and the nth candidate operation group is: if the nth candidate operation group contains the target candidate operation group, the nth candidate operation group is used as a new target candidate operation group, and the mth candidate operation group is deleted;
[0129] The relationship between the target candidate operation group and the nth candidate operation group is: there is no inclusion relationship between the target candidate operation group and the nth candidate operation group.
[0130] In some embodiments, the acquisition module 420 is further configured to:
[0131] Based on the recording of the basic test operations of the graphical user interface, a basic test record of each basic test operation is obtained; wherein the basic test record includes event information and control information of the basic test operation corresponding to the basic test record;
[0132] A basic test script for a basic test operation corresponding to the basic test record is generated according to the basic test record.
[0133] In some embodiments, in terms of obtaining a unit test operation selected from predetermined unit test operations, the selection module 410 is specifically configured to:
[0134] Get the current annotation information of the current test task;
[0135] The current annotation information is matched with the function annotation information pre-configured for the unit test operation, and the unit test operation corresponding to the successfully matched function annotation information is determined as the unit test operation selected from the pre-determined unit test operations.
[0136] In some embodiments, the acquisition module 420 is further configured to:
[0137] In response to an update event of any basic test operation in the graphical user interface, each unit test operation including the basic test operation is obtained, and each obtained unit test operation is synchronously updated.
[0138] Each module in the black box testing device based on a graphical user interface can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0139] In some embodiments, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data that needs to be processed by the above-mentioned black box testing method based on a graphical user interface. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in the black box testing method based on a graphical user interface are implemented.
[0140] In some embodiments, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, the steps in the black box testing method based on the graphical user interface are implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen; the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0141] Those skilled in the art will understand that Figure 5 or Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0142] In some embodiments, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps in the above method embodiments are implemented.
[0143] In some embodiments, Figure 7 The figure shows an internal structure diagram of a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0144] In some embodiments, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0145] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0146] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0147] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0148] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A black box testing method based on graphical user interface, It is characterized in that include: Obtaining a unit test operation selected from each predetermined unit test operation, and obtaining an operation set of the current test task according to a selection order among the selected unit test operations; wherein the unit test operation is obtained by clustering basic test operations; For any unit test operation in the operation set, obtain a unit test script of the unit test operation; wherein the unit test script is obtained by combining basic test scripts corresponding to basic test operations in the unit test operation; Combining the unit test scripts of each unit test operation in the operation set to obtain a current test script of the current test task; The current test script is called to test the graphical user interface to obtain the current test result.
2. The method according to claim 1, It is characterized in that The unit test operation is determined as follows: Recording basic test operations of the graphical user interface; Based on the operation sequence between the basic test operations, the basic test operations are combined to obtain a test operation sequence; Based on the order between different basic test operations in the test operation sequence, the basic test operations are clustered to obtain unit test operations.
3. The method according to claim 2, It is characterized in that The clustering of the basic test operations to obtain unit test operations based on the order of different basic test operations in the test operation sequence includes: Based on the order between different basic test operations in any test operation sequence, taking the i-th to j-th basic test operations in the test operation sequence as candidate basic operation groups; wherein i is less than j; Determine whether the matching degree between the candidate basic operation group and each test operation sequence meets a preset matching condition; If so, j plus the preset first step length is used as the new j, and the i-th to the new j-th basic test operations in the test operation sequence are used as new candidate basic operation groups, and it is determined whether the matching degree between the new candidate basic operation group and each test operation sequence meets the preset matching condition; If not, the candidate basic operation group is used as a candidate operation group obtained by clustering the basic test operations, and i is updated by using the new j, and the updated i plus the preset first step length is used as the updated j, until the updated j is greater than the total number of basic test operations in the test operation sequence; A unit test operation is determined according to the candidate operation group.
4. The method according to claim 3, It is characterized in that The determining whether the matching degree between the candidate basic operation group and each test operation sequence meets a preset matching condition includes: Determining the frequency of occurrence of the candidate basic operation group in each test operation sequence; If the frequency is greater than a preset matching threshold, it is determined that the matching degree between the candidate basic operation group and each test operation sequence meets a preset matching condition.
5. The method according to claim 3, It is characterized in that The step of determining a unit test operation according to the candidate operation group includes: Taking the mth candidate operation group as the target candidate operation group, and determining the relationship between the target candidate operation group and the nth candidate operation group according to the order between at least one basic test operation included in the target candidate operation group and the at least one basic test operation, and according to the order between at least one basic test operation included in the nth candidate operation group and the at least one basic test operation; wherein m is less than n; If the relationship between the target candidate operation group and the nth candidate operation group satisfies at least one of the following, n is added with a preset second step length as a new n, until the new n is greater than the total number of the candidate operation groups, and the target candidate operation group is determined as a unit test operation: The relationship between the target candidate operation group and the nth candidate operation group is: if the target candidate operation group includes the nth candidate operation group, or the target candidate operation group is the same as the nth candidate operation group, then the nth candidate operation group is deleted; The relationship between the target candidate operation group and the nth candidate operation group is: if the nth candidate operation group includes the target candidate operation group, the nth candidate operation group is used as a new target candidate operation group, and the mth candidate operation group is deleted; The relationship between the target candidate operation group and the nth candidate operation group is: there is no inclusion relationship between the target candidate operation group and the nth candidate operation group.
6. The method according to any one of claims 2 to 5, It is characterized in that The method further comprises: Based on the recording of the basic test operations of the graphical user interface, a basic test record of each basic test operation is obtained; wherein the basic test record includes event information and control information of the basic test operation corresponding to the basic test record; A basic test script for a basic test operation corresponding to the basic test record is generated according to the basic test record.
7. The method according to claim 1, It is characterized in that The obtaining of a unit test operation selected from predetermined unit test operations includes: Get the current annotation information of the current test task; The current annotation information is matched with the function annotation information pre-configured for the unit test operation, and the unit test operation corresponding to the successfully matched function annotation information is determined as the unit test operation selected from the predetermined unit test operations.
8. The method according to claim 1, It is characterized in that The method further comprises: In response to an update event of any basic test operation in the graphical user interface, each unit test operation including the basic test operation is obtained, and each obtained unit test operation is synchronously updated.
9. A black box testing device based on a graphical user interface, It is characterized in that include: A selection module is used to obtain a unit test operation selected from various predetermined unit test operations, and obtain an operation set of the current test task according to a selection order between the selected unit test operations; wherein the unit test operation is obtained by clustering basic test operations; An acquisition module, used for acquiring a unit test script of any unit test operation in the operation set; wherein the unit test script is obtained by combining basic test scripts corresponding to basic test operations in the unit test operation; A combining module, used for combining the unit test scripts of each unit test operation in the operation set to obtain a current test script of the current test task; The test module is used to call the current test script to test the graphical user interface and obtain the current test result.
10. A computer device, comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
