A method and device for generating test cases for user interface

Through the image recognition model, the user interface controls are identified and tested cases are generated, and the problem of low efficiency in manual identification and code writing in the prior art is solved, and efficient user interface testing is achieved.

CN110287111BActive Publication Date: 2025-04-22WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201910540156.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-21
Publication Date
2025-04-22
Estimated Expiration
2039-06-21

AI Technical Summary

Technical Problem

In the prior art, generating user interface test cases requires manual identification of controls and writing code, which is inefficient, affects test efficiency and increases costs.

Method used

The image recognition model is used to identify the image features of the user interface, determine the control module, including control type information and control position information, and then generate test cases based on these information and preset control operations.

Benefits of technology

No need to manually identify controls and write code, which significantly improves the efficiency of test case generation, thereby improving the efficiency of user interface testing and reducing test costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110287111B_ABST
    Figure CN110287111B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method and device for generating test cases for a user interface, which relates to the field of financial technology. The method includes: using an image recognition model to identify image features of a user interface, determining control modules in the user interface, each control module including control type information and control location information, and then generating test cases for the user interface according to each control module and preset control operations, without the need to manually identify controls in the user interface and write code to generate test cases, thereby improving the efficiency of generating test cases, further improving the testing efficiency of the user interface, and reducing the testing cost of the user interface. By comparing the differences between different versions of the user interface, it is determined whether the user interface is updated. If updated, the test cases of the user interface are regenerated to update the test cases of the historical version interface, without the need for manual update and maintenance, thereby improving the update efficiency of the test cases of the user interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of financial technology, and in particular, to a method and device for generating test cases for a user interface. Background Art

[0002] With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to Fintech. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. At present, there are more and more user interface software in the financial industry, and the requirements for automated testing of user interface software are also getting higher and higher. In some testing methods, when generating test cases, manual participation is required to identify controls in the user interface and manually write code to generate test cases. This method has low efficiency in generating test cases, which affects the test efficiency of the user interface and increases the test cost of the user interface. Summary of the invention

[0003] Due to the problem of low efficiency of methods that rely on manual generation of test cases, an embodiment of the present invention provides a method and device for generating test cases for a user interface.

[0004] In one aspect, an embodiment of the present invention provides a method for generating a test case for a user interface, comprising:

[0005] Get the user interface;

[0006] Using an image recognition model to identify image features of the user interface, and determining control modules in the user interface, each control module including control type information and control location information;

[0007] A test case for the user interface is generated according to each control module and preset control operations.

[0008] Optionally, generating a test case of the user interface according to each control module and a preset control operation includes:

[0009] Using a recurrent neural network model to decode the control type information and control location information of each control module, and generating a test code corresponding to the user interface;

[0010] Compile the test code corresponding to the user interface and the preset control operation to generate a test case for the user interface.

[0011] Optionally, it also includes:

[0012] The test case of the user interface is executed to obtain the test result of the user interface.

[0013] Optionally, it also includes:

[0014] Generate test case suites based on test cases for multiple user interfaces;

[0015] The test case set is executed to obtain test results of multiple user interfaces.

[0016] Optionally, the adopting an image recognition model to recognize image features of the user interface and determining a control module in the user interface further includes:

[0017] Comparing the user interface with a historical version interface of the user interface;

[0018] When it is determined that the difference between the user interface and the historical version interface is greater than a preset threshold, an image recognition model is used to recognize image features of the user interface to determine a control module in the user interface.

[0019] Optionally, it also includes:

[0020] The test cases of the user interface are used to update the test cases of the historical version interface.

[0021] In one aspect, an embodiment of the present invention provides a test case generating device for a user interface, comprising:

[0022] An acquisition module, used to acquire a user interface;

[0023] A recognition module, used to recognize image features of the user interface using an image recognition model, and determine control modules in the user interface, each control module including control type information and control location information;

[0024] The processing module is used to generate a test case for the user interface according to each control module and preset control operations.

[0025] Optionally, the processing module is specifically used for:

[0026] Using a recurrent neural network model to decode the control type information and control location information of each control module, and generating a test code corresponding to the user interface;

[0027] Compile the test code corresponding to the user interface and the preset control operation to generate a test case for the user interface.

[0028] Optionally, the processing module is further used for:

[0029] The test case of the user interface is executed to obtain the test result of the user interface.

[0030] Optionally, the processing module is further used for:

[0031] Generate test case suites based on test cases for multiple user interfaces;

[0032] The test case set is executed to obtain test results of multiple user interfaces.

[0033] Optionally, the identification is specifically used for:

[0034] Comparing the user interface with a historical version interface of the user interface;

[0035] When it is determined that the difference between the user interface and the historical version interface is greater than a preset threshold, an image recognition model is used to recognize image features of the user interface to determine a control module in the user interface.

[0036] Optionally, an update module is also included;

[0037] The update module is specifically used for:

[0038] The test cases of the user interface are used to update the test cases of the historical version interface.

[0039] On the one hand, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of a method for generating test cases for a user interface when executing the program.

[0040] On the one hand, an embodiment of the present invention provides a computer-readable storage medium storing a computer program executable by a computer device, which, when executed on the computer device, enables the computer device to execute the steps of a method for generating a test case for a user interface.

[0041] In the embodiment of the present invention, an image recognition model is used to recognize the image features of the user interface, and the control modules in the user interface are determined. Each control module includes control type information and control position information, and then a test case of the user interface is generated according to each control module and a preset control operation. It is not necessary to manually recognize the controls in the user interface and write code to generate test cases, thereby improving the efficiency of generating test cases, further improving the test efficiency of the user interface, and reducing the test cost of the user interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0043] Figure 1A schematic diagram of an application scenario provided by an embodiment of the present invention;

[0044] Figure 2 A flowchart of a method for generating a test case for a user interface provided by an embodiment of the present invention;

[0045] Figure 3 A schematic diagram of a user interface provided by an embodiment of the present invention;

[0046] Figure 4 A schematic diagram of a user interface provided by an embodiment of the present invention;

[0047] Figure 5 A flowchart of a method for generating a test case for a user interface provided by an embodiment of the present invention;

[0048] Figure 6 A schematic diagram of the structure of a test case generating device for a user interface provided by an embodiment of the present invention;

[0049] Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and beneficial effects of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention.

[0051] For ease of understanding, the terms involved in the embodiments of the present invention are explained below.

[0052] UI: (User Interface), the medium for interaction and information exchange between the system and users.

[0053] CNN: (Convolutional Neural Networks), a feed-forward neural network, consists of one or more convolutional layers and a fully connected layer at the top (corresponding to the classic neural network), as well as associated weights and pooling layers. Convolutional neural networks have excellent performance in image processing.

[0054] RNN: (Recurrent Neural Network), a type of neural network with short-term memory. In a recurrent neural network, neurons can not only receive information from other neurons, but also receive information from themselves, forming a network structure with loops.

[0055] DSL: (domain-specific language).

[0056] The test case generation method of the user interface in the embodiment of the present invention can be applied to the following Figure 1 The application scenario shown includes a front-end device 101 and a test system 102. The front-end device 101 can be a smart phone, a tablet computer or a portable personal computer, etc. The front-end device 101 pre-installs application software related to the financial industry, runs the application software, intercepts the user interface of the application software and sends the user interface to the test system 102. The test system 102 includes a continuous integration test platform 1021 and an update detection platform 1022. The continuous integration test platform 1021 uses an image recognition model to identify the image features of the user interface, determines the control module in the user interface, each control module includes control type information and control position information, and then generates a test case for the user interface according to each control module and the preset control operation, and then generates a test case set according to the test cases of multiple user interfaces. The continuous integration test platform 1021 executes the test case set to obtain test results of multiple user interfaces. The update detection platform 1022 compares the user interface with the historical version interface of the user interface. When it is determined that the difference between the user interface and the historical version interface is greater than a preset threshold, the test case of the user interface is used to update the test case of the historical version interface.

[0057] based on Figure 1 The application scenario diagram shown in the figure, the embodiment of the present invention provides a process of a method for generating a test case for a user interface, the process of the method can be executed by a test case generating device for a user interface, and the test case generating device for a user interface can be Figure 1 The test system 102 in Figure 2 As shown, the following steps are included:

[0058] Step S201, obtaining a user interface.

[0059] Specifically, the user interface is an image captured from the application software executed on the front-end device. Figure 3 The user interface shown includes a switch, an add button, and a slide bar.

[0060] Step S202: using an image recognition model to recognize image features of the user interface and determine a control module in the user interface.

[0061] Specifically, the image recognition model can be a convolutional neural network model, a feedforward neural network model, etc. Since different controls have different image features, the image recognition model recognizes the image features of the user interface and can divide the user interface into multiple control modules, each of which includes control type information and control location information. For example, Figure 4 As shown, the convolutional neural network model is used to identify Figure 3 The graphical features of the user interface shown will Figure 3 The user interface shown is divided into three control modules, which can be divided into a switch control module, an add button control module and a slide bar control module according to the control type. The switch control module includes the position information of the switch control, the add button control module includes the position information of the add button, and the slide bar control module includes the position information of the slide bar control.

[0062] Step S203: Generate a test case for the user interface according to each control module and preset control operations.

[0063] Specifically, control operations include clicking, inputting, sliding, etc.

[0064] In an embodiment of the present invention, an image recognition model is used to identify image features of a user interface, and control modules in the user interface are determined, each control module including control type information and control location information. Then, a test case for the user interface is generated according to each control module and preset control operations, without the need to manually identify controls in the user interface and write code to generate test cases, thereby improving the efficiency of generating test cases, and further improving the testing efficiency of the user interface and reducing the testing cost of the user interface.

[0065] Optionally, in the above step S203, the embodiment of the present invention provides at least the following two implementation methods for generating a test case for a user interface:

[0066] In a possible implementation, a recurrent neural network model is used to decode the control type information and control location information of each control module to generate a test code corresponding to the user interface. The test code corresponding to the user interface and the preset control operation are compiled to generate a test case for the user interface.

[0067] Specifically, the recurrent neural network model decodes the control type information and control position information of each control module, and each hidden state of the recurrent neural network model contains the context information of the control module. Then, the test code is generated according to the context information and the corresponding control module, wherein the test code can be a DSL code. Exemplarily, the recurrent neural network model is used to decode the control type information and control position information of the switch control module, and the DSL code corresponding to the control module is generated as: label (x, y, l, w) and switch (x, y, l, w), wherein label is a label, switch is a switch, x and y are the coordinates of the control, l is the length of the control, and w is the width of the control. The same method can be used to generate the DSL code corresponding to other control modules in the user interface, and finally the context information of the control module identified by the recurrent neural network model and the DSL code corresponding to the control module are used to obtain the DSL code of the user interface. The DSL code and the preset control operation corresponding to each control module in the user interface are compiled to generate a test case of the user interface. The recurrent neural network model is used to convert the control module in the user interface image into a test code, and then the test code and the control operation are compiled into a test case, so there is no need to manually write and maintain the test code, thereby improving the efficiency of generating test cases.

[0068] In a possible implementation, the test code corresponding to each control module is generated according to the control type information and control position information of each control module. Then, the control position information of each control module is combined with the test code corresponding to all control modules to generate the test code corresponding to the user interface. The test code corresponding to the user interface and the preset control operation are compiled to generate the test case of the user interface.

[0069] When testing the user interface, the embodiment of the present invention provides at least the following two testing methods:

[0070] In a possible implementation, after generating a test case for the user interface, the test case for the user interface may be executed to obtain a test result for the user interface. Furthermore, the test result for the user interface may be sent to relevant testers to implement testing of the user interface.

[0071] In another possible implementation, after the test cases of the user interface are generated, a test case set is generated according to the test cases of the multiple user interfaces, and then the test case set is executed to obtain the test results of the multiple user interfaces. Furthermore, a test report can be generated based on the test results of the multiple user interfaces and sent to the tester, thereby implementing the testing of batch user interfaces.

[0072] Optionally, in the above step S202, after obtaining the user interface, the user interface can be compared with the historical version interface of the user interface. When it is determined that the difference between the user interface and the historical version interface is greater than a preset threshold, an image recognition model is used to identify the image features of the user interface to determine the control module in the user interface.

[0073] Specifically, as the version of the application software is updated, the corresponding user interface may or may not be updated. Therefore, when the application software version is updated, it can be determined whether the user interface is updated first, and then further determined whether it is necessary to generate a test case for the user interface. The average hash (dhash) algorithm, the perceptual hash (phash) algorithm, the difference value hash (dhash) algorithm, etc. can be used to determine the difference between the user interface and the historical version interface. When the difference is greater than the preset threshold, it means that the user interface of the current version has changed compared to the historical version interface. When the test case of the historical version interface is used to test the current version of the user interface, the test result will be biased, so the test case needs to be regenerated. When the difference is not greater than the preset threshold, it means that the current version of the user interface has basically not changed compared to the historical version interface. The test case of the historical version interface can be used to test the current version of the user interface, and there is no need to repeatedly generate the test case of the user interface.

[0074] Furthermore, after generating the test case of the user interface, the test case of the user interface can be used to update the test case of the historical version interface. For example, the test case of the user interface can be directly replaced with the test case of the historical version interface. By comparing the difference between different versions of the user interface, it is determined whether the user interface is updated. If updated, the test case of the user interface is regenerated to update the test case of the historical version interface, without manual update and maintenance, thereby improving the update efficiency of the test case of the user interface.

[0075] In order to better explain the embodiment of the present invention, a method for generating a test case for a user interface provided by the embodiment of the present invention is described below in conjunction with a specific implementation scenario. The method is executed by a test case generating device for a user interface, such as Figure 5 As shown, the method comprises the following steps:

[0076] Step S501, obtaining a user interface.

[0077] Step S502: using a difference value hash algorithm to determine the difference between the user interface and the historical version interface of the user interface.

[0078] Step S503, determining whether the difference between the user interface and the historical version interface is greater than a preset threshold, if so, executing step S504, otherwise executing step S511.

[0079] Specifically, a difference test report between the user interface and a historical version interface of the user interface is generated.

[0080] Step S504: using a convolutional neural network model to identify image features of the user interface and determine a control module in the user interface.

[0081] Each control module includes control type information and control location information.

[0082] Step S505: Use a recurrent neural network model to decode the control type information and control location information of each control module to generate a test code corresponding to the user interface.

[0083] Step S506, compile the test code corresponding to the user interface and the preset control operation to generate a test case for the user interface.

[0084] Step S507: Use the test case of the user interface to update the test case of the historical version interface.

[0085] Step S508: Generate a test case set according to the test cases of the multiple user interfaces.

[0086] Step S509, executing the test case set to obtain test results of multiple user interfaces.

[0087] Step S510: Generate a test report and send the test report to a tester.

[0088] Step S511, execute the test case of the historical version interface to obtain the test result of the user interface.

[0089] In the embodiment of the present invention, an image recognition model is used to identify the image features of the user interface, and the control modules in the user interface are determined. Each control module includes control type information and control position information. Then, a test case of the user interface is generated according to each control module and a preset control operation, without the need to manually identify the controls in the user interface and write code to generate the test case, thereby improving the efficiency of generating the test case, further improving the test efficiency of the user interface, and reducing the test cost of the user interface. A recurrent neural network model is used to convert the controls in the user interface image into test code, and then the test code and the control operation are compiled into a test case, so there is no need to manually write and maintain the test code, thereby improving the efficiency of generating the test case. By comparing the difference between different versions of the user interface, it is determined whether the user interface is updated. If updated, the test case of the user interface is regenerated to update the test case of the historical version interface, without the need for manual update and maintenance, thereby improving the update efficiency of the test case of the user interface.

[0090] In order to better explain the embodiment of the present invention, a user interface testing method is introduced below by taking the user interface of financial application software as an example. The method is interactively executed by a front-end device and a testing system, and includes:

[0091] The financial application software to be tested is installed on the front-end device and the financial application software is run. The front-end device intercepts the user interface of the financial application software and sends the user interface to the test system. The intercepted user interface is set to include a login interface, a financial business operation interface, etc. For the login interface, the test system uses a convolutional neural network model to identify the image features of the login interface and determine the control modules in the login interface. The control modules in the login interface include a user name input box module, a password input box module, and a login button module. Each control module includes control type information and control location information. Then a recurrent neural network model is used to decode the control type information and control location information of each control module to generate the test code corresponding to the login interface. The test code corresponding to the login interface and the preset control operation are compiled to generate a test case for the login interface. Test cases for other user interfaces such as the financial business operation interface are generated in the same way as above, which will not be repeated here. A test case set is generated from the test cases of multiple user interfaces intercepted from the financial application software, and then the test cases are executed to generate a user interface test report for the financial application software and send the test report to the tester.

[0092] Based on the same technical concept, an embodiment of the present invention provides a test case generation device for a user interface, such as Figure 6 As shown, the device 600 includes:

[0093] An acquisition module 601 is used to acquire a user interface;

[0094] The recognition module 602 is used to recognize the image features of the user interface by using an image recognition model, and determine the control modules in the user interface, each control module including control type information and control position information;

[0095] The processing module 603 is used to generate a test case of the user interface according to each control module and preset control operations.

[0096] Optionally, the processing module 603 is specifically configured to:

[0097] Using a recurrent neural network model to decode the control type information and control location information of each control module, and generating a test code corresponding to the user interface;

[0098] Compile the test code corresponding to the user interface and the preset control operation to generate a test case for the user interface.

[0099] Optionally, the processing module 603 is further used for:

[0100] The test case of the user interface is executed to obtain the test result of the user interface.

[0101] Optionally, the processing module 603 is further used for:

[0102] Generate test case suites based on test cases for multiple user interfaces;

[0103] The test case set is executed to obtain test results of multiple user interfaces.

[0104] Optionally, the identification module 602 is specifically configured to:

[0105] Comparing the user interface with a historical version interface of the user interface;

[0106] When it is determined that the difference between the user interface and the historical version interface is greater than a preset threshold, an image recognition model is used to recognize image features of the user interface to determine a control module in the user interface.

[0107] Optionally, an update module 604 is also included;

[0108] The updating module 604 is specifically used for:

[0109] The test cases of the user interface are used to update the test cases of the historical version interface.

[0110] Based on the same technical concept, an embodiment of the present invention provides a computer device, such as Figure 7 As shown, it includes at least one processor 701 and a memory 702 connected to the at least one processor. The specific connection medium between the processor 701 and the memory 702 is not limited in the embodiment of the present invention. Figure 7 For example, the processor 701 and the memory 702 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.

[0111] In the embodiment of the present invention, the memory 702 stores instructions that can be executed by at least one processor 701. By executing the instructions stored in the memory 702, the at least one processor 701 can execute the steps included in the aforementioned test case generation method for the user interface.

[0112] Among them, the processor 701 is the control center of the computer device, which can use various interfaces and lines to connect various parts of the computer device, and generate test cases by running or executing instructions stored in the memory 702 and calling data stored in the memory 702. Optionally, the processor 701 may include one or more processing units, and the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 701. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.

[0113] The processor 701 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present invention may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0114] The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 702 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 702 is any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 702 in the embodiment of the present invention can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0115] Based on the same technical concept, an embodiment of the present invention provides a computer-readable storage medium storing a computer program executable by a computer device. When the program runs on the computer device, the computer device executes the steps of a test case generation method for a user interface.

[0116] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0117] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0118] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0119] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0120] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0121] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for generating test cases for a user interface, characterized in that: include: Get the user interface; Comparing the user interface with a historical version interface of the user interface; When it is determined based on the hash algorithm that the difference between the user interface and the historical version interface is greater than a preset threshold, it is determined that the user interface needs to be updated, and an image recognition model is used to identify image features of the user interface to determine control modules in the user interface, each control module including control type information and control location information; A recurrent neural network model is used to decode the control type information and control location information of each control module, wherein each hidden state of the recurrent neural network model contains context information of the control module, and a test code of the control module is generated according to the context information and the corresponding control module; Using the context information of each control module and the test code corresponding to each control module, generate the test code corresponding to the user interface; Compile the test code corresponding to the user interface and the preset control operation corresponding to each control module in the user interface to generate a test case for the user interface; Testing the user interface using the test case; If the difference between the user interface and the historical version interface is not greater than a preset threshold, the user interface is tested using the test case of the historical version interface.

2. The method according to claim 1, characterized in that Also includes: The test case of the user interface is executed to obtain the test result of the user interface.

3. The method according to claim 1, characterized in that Also includes: Generate test case suites based on test cases for multiple user interfaces; The test case set is executed to obtain test results of multiple user interfaces.

4. A test case generating device for a user interface, characterized in that: include: An acquisition module, used to acquire a user interface; An identification module, used for comparing the user interface with a historical version interface of the user interface; When it is determined based on the hash algorithm that the difference between the user interface and the historical version interface is greater than a preset threshold, it is determined that the user interface needs to be updated, and an image recognition model is used to identify image features of the user interface to determine control modules in the user interface, each control module including control type information and control location information; A processing module, used to decode the control type information and control location information of each control module by using a recurrent neural network model, wherein each hidden state of the recurrent neural network model contains context information of the control module, and generate a test code of the control module according to the context information and the corresponding control module; Using the context information of each control module and the test code corresponding to each control module, generate the test code corresponding to the user interface; Compile the test code corresponding to the user interface and the preset control operation corresponding to each control module in the user interface to generate a test case for the user interface, and use the test case to test the user interface; If the difference between the user interface and the historical version interface is not greater than a preset threshold, the user interface is tested using the test case of the historical version interface.

5. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of any one of the methods of claims 1 to 3 are implemented.

6. A computer-readable storage medium, characterized in that: It stores a computer program executable by a computer device. When the program is run on the computer device, the computer device executes the steps of any method described in claims 1 to 3.

Citation Information

Patent Citations

  • Automated test file generation method and apparatus

    CN106021102A