CN117762796A - User interface testing method and device - Google Patents

User interface testing method and device Download PDF

Info

Publication number
CN117762796A
CN117762796A CN202311790166.3A CN202311790166A CN117762796A CN 117762796 A CN117762796 A CN 117762796A CN 202311790166 A CN202311790166 A CN 202311790166A CN 117762796 A CN117762796 A CN 117762796A
Authority
CN
China
Prior art keywords
user interface
scene
test
target
target scene
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311790166.3A
Other languages
Chinese (zh)
Inventor
余晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Hode Information Technology Co Ltd
Original Assignee
Shanghai Hode Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Hode Information Technology Co Ltd filed Critical Shanghai Hode Information Technology Co Ltd
Priority to CN202311790166.3A priority Critical patent/CN117762796A/en
Publication of CN117762796A publication Critical patent/CN117762796A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the application provides a user interface testing method, which comprises the following steps: acquiring a current user interface in test equipment; identifying a target scene corresponding to the user interface, wherein the target scene comprises a normal test scene and an abnormal scene; acquiring a rule script corresponding to the target scene; and executing the rule script to test the user interface, or executing the rule script to process the abnormal scene so as to enable the test equipment to return to normal test. The user interface testing method provided by the embodiment of the invention can be used for processing the abnormal condition of the automatic testing process of the user interface, and can flexibly process the random scene possibly appearing in the target APP, thereby ensuring the automatic testing efficiency of the user interface.

Description

User interface testing method and device
Technical Field
The present disclosure relates to the field of automatic testing, and in particular, to a user interface testing method, apparatus, computer device, and storage medium.
Background
User Interface (UI) automated testing is a form of software automated testing, focusing primarily on the operation of an automated user interface. It may simulate human user behavior such as clicking on a button, entering text, scrolling a page, etc., to verify the functionality and responsiveness of the user interface element.
In the related art, the automatic test of the user interface is generally in a flow linear relationship, so that abnormal conditions in the automatic test process cannot be processed, and random scenes possibly occurring in a target APP (application program) cannot be flexibly processed, so that the efficiency of the automatic test is affected.
Disclosure of Invention
The purpose of the present application is to provide a user interface testing method, a device, a computer device and a storage medium, which are used for solving the following technical problems: abnormal conditions of an automatic test process cannot be processed in the related art, random scenes possibly occurring aiming at a target APP cannot be flexibly processed, and the efficiency of the automatic test is affected.
One aspect of the embodiments of the present application provides a user interface testing method, including: acquiring a current user interface in test equipment; identifying a target scene corresponding to the user interface, wherein the target scene comprises a normal test scene and an abnormal scene; acquiring a rule script corresponding to the target scene; and executing the rule script to test the user interface, or executing the rule script to process the abnormal scene so as to enable the test equipment to return to normal test.
Optionally, the identifying the target scene corresponding to the user interface includes: and identifying the target scene corresponding to the user interface by adopting a preset identification mode, wherein the preset identification mode comprises at least one mode of single-point color matching, multi-point color matching, image matching and optical character identification.
Optionally, the identifying the target scene corresponding to the user interface further includes: performing scene detection on the user interface by adopting a plurality of scene test threads, wherein different scene test threads correspond to different scene detections; and determining the target scene according to the detection results of the scene test threads.
Optionally, at least part of the scene test threads correspond to one primary scene and a plurality of secondary scenes belonging to the primary scene.
Optionally, the identifying the target scene corresponding to the user interface includes: acquiring equipment resolution of equipment where a target material screenshot is located and resolution of the user interface, wherein the target material is used for image matching to determine the target scene; in the case that the resolution of the short side of the user interface is different from the resolution of the equipment, scaling the user interface in an equal ratio according to the short side of the resolution of the equipment to obtain a scaled user interface; and determining the target scene according to the scaled user interface and the target material.
Optionally, the identifying the target scene corresponding to the user interface further includes: acquiring the relative position of the target material screenshot; cutting the user interface according to the relative position to obtain a cut user interface; and determining the target scene according to the cut user interface and the target material.
Optionally, the rule script includes: in the case that the user interface includes a sliding operation, the sliding operation is completed by performing a plurality of movements according to a preset movement distance.
An aspect of an embodiment of the present application further provides a user interface testing apparatus, including: the first acquisition module is used for acquiring a current user interface in the test equipment; the identification module is used for identifying a target scene corresponding to the user interface, wherein the target scene comprises a normal test scene and an abnormal scene; the second acquisition module is used for acquiring a rule script corresponding to the target scene; and the execution module is used for executing the rule script to test the user interface, or executing the rule script to process the abnormal scene so as to enable the test equipment to return to normal test.
An aspect of the embodiments of the present application further provides a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor executing the computer program for implementing the steps of the user interface testing method described above.
An aspect of the embodiments of the present application further provides a computer-readable storage medium having a computer program stored therein, the computer program being executable by at least one processor to cause the at least one processor to perform the steps of the user interface testing method described above.
The user interface testing method, the device, the computer equipment and the storage medium provided by the embodiment of the application have the following advantages:
the method comprises the steps of obtaining a current user interface in test equipment, identifying a target scene corresponding to the user interface, wherein the target scene comprises a normal test scene and an abnormal scene, obtaining a rule script corresponding to the target scene, executing the rule script to test the user interface, or executing the rule script to process the abnormal scene so as to enable the test equipment to return to the normal test, identifying the scene corresponding to the current user interface to determine a corresponding execution script, realizing the normal test of the user interface, simultaneously realizing the processing of abnormal conditions occurring in the test process, and flexibly processing random scenes possibly occurring in a target APP, thereby ensuring the automatic test efficiency of the user interface.
Drawings
FIG. 1 schematically illustrates a flowchart of a user interface testing method according to an embodiment of the present application;
FIG. 2 is a flow chart of a sub-step of step S120 in FIG. 1;
FIG. 3 is a flowchart illustrating another sub-step of step S120 of FIG. 1;
FIG. 4 is a flowchart of a further sub-step of step S120 of FIG. 1;
FIG. 5 schematically illustrates a flow chart of a user interface testing apparatus according to a second embodiment of the present application;
fig. 6 schematically shows a hardware architecture diagram of a computer device according to a third embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
It should be noted that the descriptions of "first," "second," etc. in the embodiments of the present application are for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be regarded as not exist and not within the protection scope of the present application.
In the description of the present application, it should be understood that the numerical references before the steps do not identify the order of performing the steps, but are only used for convenience in describing the present application and distinguishing each step, and thus should not be construed as limiting the present application.
The following is an explanation of terms involved in the present application:
user Interface (UI) automation: one form of software automated testing focuses primarily on the operation of an automated user interface. It may simulate human user behavior such as clicking on a button, entering text, scrolling a page, etc., to verify the functionality and responsiveness of the user interface element. UI automation is widely applied to regression testing, functional testing and load testing, and can improve testing efficiency, reduce human errors and support continuous integration and deployment.
OpenCV: an open source library for real-time computer vision. It provides over 2500 optimization algorithms, including classical and latest computer vision and machine learning techniques. These functions make it the preferred library for image and video analysis, object and facial detection, image classification, and other tasks. The method has the advantages of cross-platform support, strong community support, real-time operation capability and the like, and is applied to various computer vision related fields such as automatic driving automobiles, robot navigation, face recognition systems and the like.
adb: a command line tool for communication allows a developer to interact with an android device. It enables developers to install and debug applications, copy files, run shell commands, manage device states, grab device logs, and the like.
In the related art, the automatic test of the user interface is generally in a flow linear relationship, so that abnormal conditions in the automatic test process cannot be processed, and random scenes possibly occurring aiming at a target APP cannot be flexibly processed, and the efficiency of the automatic test of the user interface is affected.
The user interface testing method can effectively cope with abnormal conditions of the user interface automatic testing process, can flexibly process random scenes possibly occurring in the target APP, and improves efficiency of the user interface automatic testing.
It should be noted that, the execution body of the user interface testing method in the embodiment of the present application may be a client or a server, where the client may be, but is not limited to, a variety of personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server may be implemented by using an independent server or a server cluster formed by multiple servers.
The user interface test scheme will be described below in terms of several embodiments, and for ease of understanding, an exemplary description will be given below with the client as the execution subject.
Example 1
Fig. 1 schematically illustrates a user interface testing method according to a first embodiment of the present application, and as shown in the drawing, may include steps S110 to S140, which are specifically described as follows:
step S110, a current user interface in the test equipment is obtained.
After the user interface test is started, the client can test the user interface according to a preset flow, and when the current user interface is tested, the current user interface in the test equipment is acquired.
Specifically, the client may perform screenshot on the current user interface, thereby obtaining the current user interface. The current user interface may include a user interface of a program corresponding to the user interface test and an interface of the test device, such as a popup window, which appears when the user interface tests.
Step S120, identifying a target scene corresponding to the user interface, where the target scene includes a normal test scene and an abnormal scene.
In an exemplary embodiment, step S120 may include: and identifying the target scene corresponding to the user interface by adopting a preset identification mode, wherein the preset identification mode comprises at least one mode of single-point color matching, multi-point color matching, image matching and Optical Character Recognition (OCR).
For example, in some scenarios, a user interface for some games may be identified in a single point color matching or a multiple point color matching manner where certain coordinates may have a different color than other scenarios.
Some game user interfaces may be identified using picture matching where certain picture elements are displayed in some scenarios.
Some game user interfaces may use OCR recognition if there is a particular text display in a different scene.
It will be appreciated that for a normal user interface in an application (e.g., game), one or more of the above pre-set recognition methods may be used to identify the target scene of the user interface. For the abnormal situation, such as a popup window, of the application program in the test process, the user interface corresponding to the abnormal situation can be identified by adopting one or more preset identification modes, so that the abnormal scene corresponding to the user interface can be determined. For example, other applications may prompt for updated portlets, OCR may be used to recognize text information such as "update" so that it may be determined that the current user interface includes a type of update portlets.
In an exemplary embodiment, as shown in fig. 2, step S120 may include steps S210 to S220:
step S210, performing scene detection on the user interface by adopting a plurality of scene test threads, wherein different scene test threads correspond to different scene detections.
For example, if the target application is known to have 10 different scenarios, 10 scenario test threads may be employed to perform scenario detection on the current user interface, one for each scenario test thread.
In an exemplary embodiment, at least a portion of the scenario test threads correspond to a primary scenario and a number of secondary scenarios belonging to the primary scenario.
The first-level scene is a large scene, and the second-level scene is a small scene belonging to the large scene. For example, one scenario test thread includes 2 secondary scenarios. Specifically, for the primary scene and the secondary scene, the primary identification feature and the secondary identification feature can be extracted respectively, then the recognition is performed according to the primary identification feature and the secondary identification feature, and finally the target scene corresponding to the current user interface is determined.
It can be understood that at least part of scene detection threads correspond to one primary scene and a plurality of secondary scenes belonging to the primary scene, and the features corresponding to the primary scene and the secondary scenes can be extracted and identified respectively, so that the identification speed is increased; furthermore, by refining the scene into a primary scene and a secondary scene, the scene can be further refined, while at least part of the scene detection threads are caused to detect a plurality of different scenes.
Step S220, determining a target scene according to detection results of the scene test threads.
For example, 5 scene test threads are adopted to detect the current user interface, if the detection result of one scene test thread is that the current user interface is the scene A corresponding to the scene test thread, then the target scene corresponding to the current user interface can be determined to be the scene A.
In the embodiment corresponding to step S210 to step S220, the scene detection is performed on the current user interface by using a plurality of scene test threads, wherein different scene detection test threads correspond to different scene detections, a target scene corresponding to the current user interface is determined according to the detection results of the plurality of scene test threads, the current user interface can be detected by the plurality of scene test threads at the same time, the target scene corresponding to the current user interface is rapidly determined, and the real-time performance of the scene detection is improved.
In an exemplary embodiment, as shown in fig. 3, step S120 may further include steps S310 to S330:
step S310, obtaining the device resolution of the device where the target material screenshot is located and the resolution of the current user interface, wherein the target material is used for image matching to determine the target scene.
Step S320, in the case that the resolution of the short side of the current user interface is different from the resolution of the device, scaling the current user interface in an equal ratio according to the short side of the resolution of the device to obtain the scaled user interface.
Step S330, determining a target scene according to the zoomed user interface and the target material.
In practical applications, steps S310 and S320 may be processed by a script written by OpenCV. Specifically, when the script is written, the device resolution of the device where the target material screenshot is located can be recorded, so that the device resolution of the device where the target material screenshot is located can be obtained when the script runs. When the current user interface is acquired, the resolution corresponding to the current user interface can be acquired; the resolution of the current user interface is compared with the device resolution of the device where the target material screenshot is located by the client, calculation is carried out according to the short side, if the short side resolution of the current user interface is different from the short side resolution of the device resolution corresponding to the target material, the resolution of the current user interface can be scaled in an equal ratio based on the short side resolution of the device resolution corresponding to the target material, the scaled user interface is obtained, and then the target scene corresponding to the current user interface is determined according to the scaled user interface and the target material. When the resolution of the current user interface is scaled equally, the scaling is preferably performed.
In the embodiment corresponding to step S310 to step S330, by acquiring the device resolution of the device where the target material screenshot is located and the resolution of the current user interface, in the case that the resolution of the short side of the current user interface is different from the device resolution corresponding to the target material, scaling the current user interface in an equal ratio according to the short side of the device resolution corresponding to the target material, and determining the target scene corresponding to the current user interface according to the scaled user interface and the target material, the suitability preprocessing of the current user interface can be performed, so that the reduction of the recognition capability caused by the difference of the material sizes is avoided, and the scene detection efficiency is improved.
In an exemplary embodiment, as shown in fig. 4, step S120 may further include steps S410 to S430:
step S410, the relative position of the target material screenshot is obtained.
Step S420, cutting the current user interface according to the relative position to obtain a cut user interface.
Step S430, determining a target scene according to the cut user interface and the target material.
In practical applications, step S410 and step S420 may be processed by a script written by OpenCV. Specifically, when the script is written, the relative position (percentage) of the target material screenshot can be recorded, so that the relative position of the target material screenshot can be obtained when the script runs, wherein the relative position of the target material screenshot can be calculated according to one side of the long side. When the script runs, the screen shot of the current user interface can be cut according to the relative position of the target material, the cut user interface is obtained, and then the target scene corresponding to the current user interface is determined according to the cut user interface and the target material.
Optionally, if the aspect ratio of the device screen corresponding to the current user interface is different from the aspect ratio of the device screen when writing the script, the device screen can be adjusted according to the set game picture distribution rule, for example, the user interfaces of some games are attached to two short sides on the screens with different aspect ratios to perform material distribution, and after performing length-width conversion, the device screen can be cut according to the fixed length; for another example, the user interface for some games is at 16:9 is the main part, the background edges are added on the two sides of the other transverse-longitudinal ratios, and in the case, the Liu of the screen can be removed, and the image cutting process mainly comprising the screen centering process is performed.
In the embodiment corresponding to step S410 to step S430, by acquiring the relative position of the target material screenshot, the current user interface is cut according to the relative position of the target material screenshot, the cut user interface is obtained, the target scene is determined according to the cut user interface and the target material, and the current user interface can be subjected to adaptive preprocessing, so that the recognition accuracy is improved.
And step S130, acquiring a rule script corresponding to the target scene.
Specifically, if the target scene corresponding to the current user interface is a normal test scene, a rule script corresponding to the normal test scene can be obtained; if the target scene corresponding to the current user interface is an abnormal scene, a rule script corresponding to the abnormal scene can be obtained.
And step S140, executing the rule script to test the user interface, or executing the rule script to process the abnormal scene so as to enable the test equipment to return to normal test.
Specifically, under the condition that the target scene corresponding to the current user interface is a normal test scene, executing the rule script corresponding to the target scene, and testing the user interface according to the rule script corresponding to the target scene, for example, clicking, sliding and other operations on a certain position; and executing the rule script corresponding to the target scene under the condition that the target scene corresponding to the current user interface is an abnormal scene, and processing the abnormal scene so as to enable the test equipment to return to normal test. For example, if the user interface is an abnormal scene of a popup, executing the rule script corresponding to the target scene may be closing the popup and then returning to the normal user interface test.
In practical application, the rule script may be run on the PC end to perform user interface test on mobile terminal devices such as mobile phones and tablets. Accordingly, the bottom framework of the rule script needs to have operation capability, and optionally, the control operation layer for the device can be mainly realized based on the command provided by the adb, and the operations of acquiring the screenshot of the device, clicking, sliding and the like at the corresponding position are realized through the command provided by the adb.
In an exemplary embodiment, the rule script may include: in the case that the current user interface includes a sliding operation, the sliding operation is completed by performing several movements according to a preset movement distance.
For example, for an operation requiring sliding such as operating a scroll bar, if the sliding method provided by adb is directly used once, the required distance may not be accurately moved due to inertia generated by the design of the client; and the sliding operation is completed by forming a command by a plurality of movements according to a preset movement distance (for example, 1 pixel (px) per movement).
Under the condition that the current user interface comprises sliding operation, the sliding operation is completed by moving for a plurality of times according to the preset moving distance, so that the sliding operation can be refined, and the accuracy of the user interface test is improved.
In addition, for some operation objects with relatively fixed positions, such as a 'confirmation' prompt box, the rule script can be set at a storage position after the first recognition, so that the calculation time is reduced. For some specific scenes, the pictures can be converted into numbers, and then the numbers are calculated according to rules to click. For example, for the numerical value of the user interface, the numerical value can be compared with the known numerical value picture to determine the corresponding numerical value, so that the picture can be converted into the numerical value, and the recognition efficiency is improved.
According to the user interface testing method, the current user interface in the testing equipment is obtained, the target scene corresponding to the user interface is identified, the target scene comprises a normal testing scene and an abnormal scene, the rule script corresponding to the target scene is obtained, the rule script is executed to test the user interface, or the rule script is executed to process the abnormal scene so that the testing equipment returns to the normal testing, the corresponding execution script can be determined by identifying the scene corresponding to the current user interface, the abnormal condition occurring in the testing process is processed while the normal testing of the user interface is realized, and the random scene possibly occurring in the target APP can be flexibly processed, so that the automatic testing efficiency of the user interface is ensured.
Example two
Fig. 5 schematically shows a block diagram of a user interface testing apparatus 500 according to a second embodiment of the present application, which user interface testing apparatus 500 may be divided into one or more program modules, which are stored in a storage medium and executed by one or more processors to complete the embodiments of the present application. Program modules in the embodiments of the present application refer to a series of computer program instruction segments capable of implementing specific functions, and the following description specifically describes the functions of each program module in the embodiment.
As shown in fig. 5, the user interface testing apparatus 500 may include a first acquisition module 510, an identification module 520, a second acquisition module 530, and an execution module 540.
A first obtaining module 510, configured to obtain a current user interface in the test device;
the identifying module 520 is configured to identify a target scenario corresponding to the user interface, where the target scenario includes a normal test scenario and an abnormal scenario;
a second obtaining module 530, configured to obtain a rule script corresponding to the target scene;
and the execution module 540 is configured to execute the rule script to perform a test on the user interface, or execute the rule script to process the abnormal scene so as to return the test device to a normal test.
In an exemplary embodiment, the identification module 520 is further configured to: and identifying the target scene corresponding to the user interface by adopting a preset identification mode, wherein the preset identification mode comprises at least one mode of single-point color matching, multi-point color matching, image matching and optical character identification.
In an exemplary embodiment, the identification module 520 is further configured to: performing scene detection on the user interface by adopting a plurality of scene test threads, wherein different scene test threads correspond to different scene detections; and determining the target scene according to the detection results of the scene test threads.
In an exemplary embodiment, at least some of the scenario test threads correspond to one primary scenario and several secondary scenarios belonging to the primary scenario.
In an exemplary embodiment, the identification module 520 is further configured to: acquiring equipment resolution of equipment where a target material screenshot is located and resolution of the user interface, wherein the target material is used for image matching to determine the target scene; in the case that the resolution of the short side of the user interface is different from the resolution of the equipment, scaling the user interface in an equal ratio according to the short side of the resolution of the equipment to obtain a scaled user interface; and determining the target scene according to the scaled user interface and the target material.
In an exemplary embodiment, the identification module 520 is further configured to: acquiring the relative position of the target material screenshot; cutting the user interface according to the relative position to obtain a cut user interface; and determining the target scene according to the cut user interface and the target material.
In an exemplary embodiment, the rule script includes: in the case that the user interface includes a sliding operation, the sliding operation is completed by performing a plurality of movements according to a preset movement distance.
Example III
Fig. 6 schematically shows a hardware architecture diagram of a computer device 600 suitable for a user interface test method according to a third embodiment of the present application. The computer device 600 may be a device capable of automatically performing numerical calculation and/or data processing according to instructions set or stored in advance. For example, it may be a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers), a gateway, or the like. As shown in fig. 6, computer device 600 includes at least, but is not limited to: the memory 610, processor 620, and network interface 630 may be communicatively linked to each other by a system bus. Wherein:
the memory 610 includes at least one type of computer-readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 610 may be an internal storage module of the computer device 600, such as a hard disk or memory of the computer device 600. In other embodiments, the memory 610 may also be an external storage device of the computer device 600, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the computer device 600. Of course, the memory 610 may also include both internal storage modules of the computer device 600 and external storage devices. In this embodiment, the memory 610 is typically used to store an operating system and various types of application software installed on the computer device 600, such as program code for a user interface test method. In addition, the memory 610 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 620 may be a central processing unit (Central Processing Unit, simply CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 620 is generally used to control the overall operation of the computer device 600, such as performing control and processing related to data interaction or communication with the computer device 600, and the like. In this embodiment, the processor 620 is configured to execute program codes or process data stored in the memory 610.
The network interface 630 may include a wireless network interface or a wired network interface, the network interface 630 typically being used to establish a communication link between the computer device 600 and other computer devices. For example, the network interface 630 is used to connect the computer device 600 to an external terminal through a network, establish a data transmission channel and a communication link between the computer device 600 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a global system for mobile communications (Global System of Mobile communication, abbreviated GSM), wideband code division multiple access (Wideband Code Division Multiple Access, abbreviated WCDMA), a 4G network, a 5G network, bluetooth (Bluetooth), wi-Fi, etc.
It should be noted that fig. 6 only shows a computer device having components 610-630, but it should be understood that not all of the illustrated components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the user interface testing method stored in the memory 610 may also be divided into one or more program modules and executed by one or more processors (the processor 620 in this embodiment) to complete the embodiments of the present application.
Example IV
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the user interface testing method of the embodiments.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of a computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card), etc. that are provided on the computer device. Of course, the computer-readable storage medium may also include both internal storage units of a computer device and external storage devices. In this embodiment, the computer readable storage medium is typically used to store an operating system and various types of application software installed on the computer device, such as program codes of the user interface test method in the embodiment, and the like. Furthermore, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may alternatively be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than what is shown or described, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (10)

1. A method for testing a user interface, comprising:
acquiring a current user interface in test equipment;
identifying a target scene corresponding to the user interface, wherein the target scene comprises a normal test scene and an abnormal scene;
acquiring a rule script corresponding to the target scene;
and executing the rule script to test the user interface, or executing the rule script to process the abnormal scene so as to enable the test equipment to return to normal test.
2. The method for testing a user interface according to claim 1, wherein the identifying the target scene corresponding to the user interface includes:
and identifying the target scene corresponding to the user interface by adopting a preset identification mode, wherein the preset identification mode comprises at least one mode of single-point color matching, multi-point color matching, image matching and optical character identification.
3. The method for testing a user interface according to claim 2, wherein the identifying the target scene corresponding to the user interface further comprises:
performing scene detection on the user interface by adopting a plurality of scene test threads, wherein different scene test threads correspond to different scene detections;
and determining the target scene according to the detection results of the scene test threads.
4. A user interface testing method according to claim 3, wherein at least part of said scenario test threads correspond to a primary scenario and a number of secondary scenarios belonging to said primary scenario.
5. The method for testing a user interface according to claim 1, wherein the identifying the target scene corresponding to the user interface includes:
acquiring equipment resolution of equipment where a target material screenshot is located and resolution of the user interface, wherein the target material is used for image matching to determine the target scene;
in the case that the resolution of the short side of the user interface is different from the resolution of the equipment, scaling the user interface in an equal ratio according to the short side of the resolution of the equipment to obtain a scaled user interface;
and determining the target scene according to the scaled user interface and the target material.
6. The method for testing a user interface according to claim 5, wherein the identifying the target scene corresponding to the user interface further comprises:
acquiring the relative position of the target material screenshot;
cutting the user interface according to the relative position to obtain a cut user interface;
and determining the target scene according to the cut user interface and the target material.
7. The method of any of claims 1-6, wherein the rule script comprises:
in the case that the user interface includes a sliding operation, the sliding operation is completed by performing a plurality of movements according to a preset movement distance.
8. A user interface testing apparatus, comprising:
the first acquisition module is used for acquiring a current user interface in the test equipment;
the identification module is used for identifying a target scene corresponding to the user interface, wherein the target scene comprises a normal test scene and an abnormal scene;
the second acquisition module is used for acquiring a rule script corresponding to the target scene;
and the execution module is used for executing the rule script to test the user interface, or executing the rule script to process the abnormal scene so as to enable the test equipment to return to normal test.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor is adapted to implement the steps of the user interface testing method of any one of claims 1 to 7 when the computer program is executed by the processor.
10. A computer readable storage medium, characterized in that it has stored therein a computer program executable by at least one processor to cause the at least one processor to perform the steps of the user interface testing method of any one of claims 1 to 7.
CN202311790166.3A 2023-12-22 2023-12-22 User interface testing method and device Pending CN117762796A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311790166.3A CN117762796A (en) 2023-12-22 2023-12-22 User interface testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311790166.3A CN117762796A (en) 2023-12-22 2023-12-22 User interface testing method and device

Publications (1)

Publication Number Publication Date
CN117762796A true CN117762796A (en) 2024-03-26

Family

ID=90325113

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311790166.3A Pending CN117762796A (en) 2023-12-22 2023-12-22 User interface testing method and device

Country Status (1)

Country Link
CN (1) CN117762796A (en)

Similar Documents

Publication Publication Date Title
CN109165162B (en) Test method and related equipment for vehicle-mounted system
CN110008110B (en) User interface testing method and device
CN107025174B (en) Method, device and readable storage medium for user interface anomaly test of equipment
US10657036B2 (en) Determining visual testing coverages
CN110175609B (en) Interface element detection method, device and equipment
US20180286030A1 (en) System and method for testing an electronic device
CN113901647B (en) Part technical specification compiling method and device, storage medium and electronic equipment
US20100318971A1 (en) Systems And Methods For Identifying Graphic User-Interface Components
KR20220093187A (en) Positioning method and apparatus, electronic device, computer readable storage medium
CN110765015A (en) Method for testing application to be tested and electronic equipment
CN112633341A (en) Interface testing method and device, computer equipment and storage medium
CN114724140A (en) Strawberry maturity detection method and device based on YOLO V3
CN112988568A (en) Game testing method and device and electronic equipment
CN112446850B (en) Adaptation test method and device and electronic equipment
CN117762796A (en) User interface testing method and device
CN113642642B (en) Control identification method and device
CN110716778A (en) Application compatibility testing method, device and system
CN115687146A (en) BIOS (basic input output System) test method and device, computer equipment and storage medium
CN113703637A (en) Inspection task coding method and device, electronic equipment and computer storage medium
CN114140812A (en) Primitive recognition method, device, equipment and medium
CN112380134A (en) WebUI automatic testing method based on image recognition
CN112559342A (en) Method, device and equipment for acquiring picture test image and storage medium
CN112559340A (en) Picture testing method, device, equipment and storage medium
US20160209989A1 (en) Record and replay of operations on graphical objects
CN110096447A (en) A kind of software and hardware automated testing method based on image recognition

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination