Application testing method, device, equipment and storage medium

Through image recognition and optical character recognition technology, the position of the application page control is obtained and touch operation instructions are generated, which solves the problem of poor universality of cross-terminal test scripts, and realizes automated testing of multi-terminal applications, reduces testing costs and improves efficiency.

CN113325976BActive Publication Date: 2025-08-19BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110583470.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-27
Publication Date
2025-08-19
Estimated Expiration
2041-05-27

AI Technical Summary

Technical Problem

In the prior art, the testing of applications requires writing separate test scripts for different test models, resulting in poor non-university and low testing efficiency. There are many styles of test pages for the same APP, making it difficult to quickly go online.

Method used

Through image recognition and optical character recognition technology, control position information in application pages is obtained, touch operation instructions are generated, and cross-terminal automatic testing is realized.

Benefits of technology

It realizes automated testing of multi-end application pages, reduces testing costs, improves testing efficiency, simplifies the complexity of test scripts, and supports testing of different types of devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113325976B_ABST
    Figure CN113325976B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, device, and storage medium for testing an application. The method includes: after obtaining a page to be tested of the application on a second device, determining the location information of a control in the page to be tested that can trigger a page change, generating a control instruction for triggering a touch operation on the control based on the location information, sending the control instruction to the second device, and monitoring page changes of the application on the second device. The above-mentioned testing solution can be used for testing application pages on different types of devices, has high versatility, reduces application testing costs, and improves testing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a method, apparatus, device, and storage medium for testing an application. Background Art

[0002] With the rapid development of mobile Internet in recent years, the number of application programs (APPs) has also experienced explosive growth. Corresponding APP performance testing has become an important link before the APP is launched.

[0003] Different test models require separate test scripts, which have poor universality on different terminal test machines. In addition, for the test pages of the same APP, the test efficiency is low due to the various page styles, which is not conducive to the rapid launch of the APP. Summary of the Invention

[0004] The embodiments of the present application provide a method, apparatus, device, and storage medium for testing an application program to improve the testing efficiency of the application program on different test models.

[0005] A first aspect of an embodiment of the present application provides a method for testing an application program, which is applied to a first device, where the first device is connected to a second device. The method includes:

[0006] Obtaining a page to be tested of the application on the second device, where the page to be tested includes a control that can trigger a page change;

[0007] Determine the position information of the control on the page to be tested;

[0008] generating a first control instruction according to the position information, where the first control instruction is used to trigger a touch operation on the control;

[0009] sending the first control instruction to the second device;

[0010] Generate a test result based on page changes of the application on the second device.

[0011] In an optional embodiment of the present application, the control includes an icon control; and determining the position information of the control on the page to be tested includes:

[0012] The position information of the icon control on the page to be tested is determined by an image recognition model, and the image recognition model is obtained by training based on a deep learning model.

[0013] In an optional embodiment of the present application, the control includes a text control; and determining the position information of the control on the page to be tested includes:

[0014] Determine whether there is preset text on the page to be tested by optical character recognition (OCR) technology;

[0015] If the preset text exists, the position information of the text control including the preset text on the page to be tested is determined.

[0016] In an optional embodiment of the present application, determining the position information of the control on the page to be tested includes:

[0017] The location information of the control on the page to be tested is determined by calling a third-party service interface; the third-party service interface includes an image recognition service interface and / or an OCR text recognition service interface.

[0018] In an optional embodiment of the present application, the position information includes the first position coordinates of the control on the page to be tested; and generating the first control instruction according to the position information includes:

[0019] Performing coordinate conversion on the first position coordinates to obtain second position coordinates, where the second position coordinates are the position coordinates of the control on the second device;

[0020] The first control instruction is generated according to the second position coordinates.

[0021] In an optional embodiment of the present application, performing coordinate conversion on the first position coordinates to obtain the second position coordinates includes:

[0022] Perform coordinate conversion on the first position coordinates according to the screen resolution of the second device to obtain the second position coordinates.

[0023] A second aspect of an embodiment of the present application provides a testing device for an application program, comprising:

[0024] an acquisition module, configured to acquire a page to be tested of the application on the second device, wherein the page to be tested includes a control that can trigger a page change;

[0025] A processing module, configured to determine position information of the control on the page to be tested;

[0026] generating a first control instruction according to the position information, where the first control instruction is used to trigger a touch operation on the control;

[0027] a sending module, configured to send the first control instruction to the second device;

[0028] The processing module is further configured to generate a test result according to page changes of the application on the second device.

[0029] In an optional embodiment of the present application, the control includes an icon control; and the processing module is specifically configured to:

[0030] The position information of the icon control on the page to be tested is determined by an image recognition model, and the image recognition model is obtained by training based on a deep learning model.

[0031] In an optional embodiment of the present application, the control includes a text control; and the processing module is specifically configured to:

[0032] Determine whether there is preset text on the page to be tested by optical character recognition (OCR) technology;

[0033] If the preset text exists, the position information of the text control including the preset text on the page to be tested is determined.

[0034] In an optional embodiment of the present application, the processing module is specifically configured to:

[0035] The location information of the control on the page to be tested is determined by calling a third-party service interface; the third-party service interface includes an image recognition service interface and / or an OCR text recognition service interface.

[0036] In an optional embodiment of the present application, the position information includes the first position coordinates of the control on the page to be tested; the processing module is specifically configured to:

[0037] Performing coordinate conversion on the first position coordinates to obtain second position coordinates, where the second position coordinates are the position coordinates of the control on the second device;

[0038] The first control instruction is generated according to the second position coordinates.

[0039] In an optional embodiment of the present application, the processing module is specifically configured to:

[0040] Perform coordinate conversion on the first position coordinates according to the screen resolution of the second device to obtain the second position coordinates.

[0041] A third aspect of the embodiments of the present application provides an electronic device, including:

[0042] Memory;

[0043] processor; and

[0044] computer programs;

[0045] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in any one of the first aspects.

[0046] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method as described in any one of the first aspects.

[0047] A fifth aspect of the embodiments of the present application provides a computer program product, including a computer program, which implements any one of the methods in the first aspect when executed by a processor.

[0048] Embodiments of the present application provide an application testing method, apparatus, device, and storage medium. The method includes: after obtaining a page to be tested of the application on a second device, determining the location information of a control on the page to be tested that can trigger a page change; generating a control instruction for triggering a touch operation on the control based on the location information; sending the control instruction to the second device; and monitoring page changes of the application on the second device. The above-described testing solution can be used for application page testing on different types of devices, has high versatility, reduces application testing costs, and improves testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0050] Figure 1 Scenario diagram of the application testing method provided in the embodiment of the present application Figure 1 ;

[0051] Figure 2 Scenario diagram of the application testing method provided in the embodiment of the present application Figure 2 ;

[0052] Figure 3 Schematic diagram of the process of testing the application provided in the embodiment of the present application Figure 1 ;

[0053] Figure 4 Schematic diagram of the process of testing the application provided in the embodiment of the present application Figure 2 ;

[0054] Figure 5 A schematic diagram of the structure of a testing device for an application provided in an embodiment of the present application;

[0055] Figure 6 This is a hardware structure diagram of the electronic device provided in an embodiment of the present application.

[0056] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0057] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0058] The terms "first," "second," and the like in the description, claims, and accompanying drawings of the embodiments of the present application are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, such that the embodiments of the present application described herein can be practiced in an order other than that illustrated or described herein.

[0059] It should be understood that the terms "include" and "have" and any variations thereof as used herein are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus that includes a series of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, product or apparatus.

[0060] In the description of the embodiments of the present application, the term "corresponding" may indicate a direct or indirect correspondence between the two, or an association relationship between the two, or a relationship between indication and being indicated, configuration and being configured, etc.

[0061] Existing app testing solutions require separate test scripts for Android and iOS terminals, which are not universal. Testers need to have certain coding skills to write scripts, making it difficult to get started, time-consuming, and labor-intensive, and script execution stability is low.

[0062] In order to lower the threshold for automated testing and implement a universal test script for multiple terminals, an embodiment of the present application proposes a testing method for an application program to solve the automated testing of APP pages. This method is based on image recognition and optical character recognition (OCR) technology to obtain the position information of page elements such as icons and text controls, and generates touch operations for each page element based on the position information, thereby realizing automated click operations and monitoring page changes of APP in actual applications. The above-mentioned testing scheme realizes the automated testing of APP pages on multiple terminals, reduces testing costs, and improves testing efficiency.

[0063] Before introducing the test solution for the application provided in this application, a brief introduction to the application scenarios of the test solution is first given.

[0064] For example, Figure 1 Scenario diagram of the application testing method provided in the embodiment of the present application Figure 1 ,like Figure 1 As shown, the scenario includes a first device 11 and a second device 12 , and the first device 11 is communicatively connected with the second device 12 .

[0065] In this embodiment, the first device 11 is pre-installed with an image recognition model, which is used to identify the location of icon controls in the image to be detected. The image recognition model can be trained based on a deep learning model. The first device 11 is also pre-installed with an optical character recognition (OCR) algorithm that can automatically recognize text information in the image to be detected.

[0066] In a possible implementation of this embodiment, the first device 11 obtains the page to be tested of the second device, and based on the image recognition model and / or OCR algorithm, it can automatically generate touch operations of corresponding icons or text controls in the page to be tested, simulate page click operations, and realize automated testing of application page switching.

[0067] For example, Figure 2 Scenario diagram of the application testing method provided in the embodiment of the present application Figure 2 ,like Figure 2 As shown, the scenario includes a first device 11, a second device 12, a first server 13, and a second server 14. The first device 11 is in communication connection with the second device 12, the first server 13, and the second server 14, respectively.

[0068] In this embodiment, the first server 13 pre-installs an image recognition model, which is used to identify the location of icon controls in the image to be detected. The image recognition model can be trained based on a deep learning model. The second server 14 pre-installs an optical character recognition (OCR) algorithm that can automatically recognize text information in the image to be detected.

[0069] In a possible implementation of this embodiment, the first device 11 can obtain the position information of the icon control or text control in the page to be tested by calling the first interface of the first server 13 and the second interface of the second server 14, thereby generating a touch operation of the corresponding icon or text control in the page to be tested, simulating a page click operation, and realizing automated testing of application page switching.

[0070] The first device 11 includes but is not limited to laptops, desktop computers, etc., and the second device 12 includes but is not limited to mobile devices with display functions such as smartphones and tablets. The first server 13 and the second server can be third-party servers that provide open source, cross-platform APP automated testing.

[0071] Based on the above application scenarios, the technical solutions provided by the embodiments of the present application are described in detail below through specific embodiments. It should be noted that the technical solutions provided by the embodiments of the present application may include part or all of the following contents, and the following specific embodiments may be combined with each other. For the same or similar concepts or processes, some embodiments may not be repeated.

[0072] Figure 3 Schematic diagram of the process of testing the application provided in the embodiment of the present application Figure 1 The application testing method provided in this embodiment can be applied to Figure 1 or Figure 2 The first device 11 shown, or other apparatuses capable of executing the testing method, is not limited in this embodiment.

[0073] like Figure 3 As shown, the application testing method of this embodiment includes the following steps:

[0074] Step 201: Acquire a page to be tested of an application on a second device, where the page to be tested includes a control that can trigger page changes.

[0075] In this embodiment, the first device is a test device, and the second device is a device under test based on any operating system. The first device and the second device are in communication. An application can be loaded on the second device. By executing the test script of this embodiment on the first device, the page switching of the application in response to a click operation on the second device (i.e., a different test model) is simulated.

[0076] In this embodiment, the control that can trigger page changes in the page to be tested includes at least one of an icon control and a text control.

[0077] Step 202: Determine the location information of the control on the page to be tested.

[0078] In this embodiment, the position information of the control on the page to be tested may be determined by image recognition and / or optical character recognition technology.

[0079] In an optional embodiment of the present application, the control of the page to be tested includes an icon control, and the position information of the icon control on the page to be tested can be determined by an image recognition model preset by the first device.

[0080] The position information of the icon control includes the center coordinates of the icon control on the page to be tested and the length and width of the icon control.

[0081] In this embodiment, the image recognition model is trained based on a deep learning model. Common deep learning models include convolutional neural network (CNN) models and recurrent neural network (RNN) models, and this embodiment does not impose any restrictions on these models.

[0082] The following describes the training process of the image recognition model. Model training includes the following steps:

[0083] Step 1: Establish an initial image recognition model;

[0084] Step 2: Obtain image samples and annotation results for the image samples. The image samples include screenshots of different types or styles of pages in the application to be tested. The page screenshots contain icon controls, and users can jump to different pages by clicking on the icon controls. The annotation results include the location box of the icon control in the page screenshot and the icon control's identifier.

[0085] Step 3: Use the image sample as the input of the image recognition model, use the annotation result of the image sample as the output of the image recognition model, train the initial image recognition model, and obtain the final image recognition model.

[0086] In actual applications, the input of the above-mentioned image recognition model is the page to be tested, and the output of the image recognition model includes the position coordinates of the icon control, that is, the position box of the icon control.

[0087] Optionally, in some embodiments, the output of the image recognition model also includes the identification of the icon control, that is, the type of the icon control, such as a "return" control, a "cancel" control, a "close" control, etc., and the confidence level corresponding to the identification of each icon control.

[0088] For example, a user may input the identifier of an icon control, such as the identifier of a "Return" control, and obtain a recognition result of the "Return" control in the page to be tested by calling an image recognition model. The recognition result includes the position of the "Return" control in the page to be tested and the confidence level corresponding to the position. For example, the positions of the "Return" control in the page to be tested include position 1 and position 2, and the confidence levels corresponding to position 1 and position 2 are 80% and 20%, respectively. Based on the recognition result, "Return" controls with lower confidence levels may be eliminated, for example, "Return" controls with confidence levels less than a preset threshold (e.g., the preset threshold is 60%) may be eliminated.

[0089] For example, if the user does not enter the identifier of an icon control, the image recognition model will return the recognition results of all controls on the current page to be detected. For example, the model will output recognition result 1 for the "Return" control, recognition result 2 for the "Cancel" control, and recognition result 3 for the "Close" control. The recognition result of each control includes the control's identifier, location, and confidence level.

[0090] The above embodiment adds data filtering to the model output results, retaining only data processing results with high accuracy, thereby improving the accuracy of model detection.

[0091] The first device of this embodiment uses the above-mentioned image recognition model to detect icon controls on the page to be tested, which can greatly improve the detection accuracy and efficiency.

[0092] In an optional embodiment of the present application, the controls of the page to be tested include text controls, and OCR technology can be used to determine whether preset text exists on the page to be tested. If it is determined that preset text exists on the page to be tested, the position information of the text control including the preset text on the page to be tested is determined.

[0093] The position information of the text control includes the center coordinates of the text on the page to be tested and the length and width of the text.

[0094] Among them, OCR technology refers to the process of analyzing, identifying and processing image files of text materials to obtain text and layout information. That is, the text in the image is identified and returned in the form of text. OCR processing mainly includes image preprocessing, text detection and text recognition. Common image preprocessing includes geometric transformation (perspective, distortion, rotation, etc.), distortion correction, blur removal, image enhancement and light correction. Text detection is to detect the location and range of the text, and usually also includes layout analysis and text line detection. Text recognition is to identify the text content on the basis of text detection, and convert the text information in the image into text information. It should be noted that the page screenshot of this embodiment usually does not involve the above-mentioned image preprocessing process, and mainly performs text detection and text recognition.

[0095] Step 203: Generate a first control instruction according to the position information of the control on the page to be tested, where the first control instruction is used to trigger a touch operation on the control.

[0096] In this embodiment, the position information of the control on the page to be tested includes the first position coordinates (ie, the center position coordinates) of the control on the page to be tested and the length and width of the control.

[0097] In an optional embodiment of the present application, the first position coordinates are converted to obtain second position coordinates, and then the first control instruction is generated based on the second position coordinates. The second position coordinates are the position coordinates of the control on the second device, that is, the physical coordinates of the page to be tested displayed on the screen of the second device.

[0098] In an optional embodiment of the present application, the first position coordinates can be converted into second position coordinates in combination with the screen resolution of the second device, and a first control instruction for the control can be generated based on the second position coordinates to simulate the touch operation instruction actually received.

[0099] In the above embodiment, considering that the page to be detected obtained by the first device may have been obtained through image compression, the first position coordinates determined by the image recognition model or OCR technology are the relative coordinates of the control on the page to be detected, namely the first position coordinates mentioned above. Therefore, in order to simulate a touch operation on the control on the second device, it is necessary to convert the relative coordinates of the control on the page to be detected into the physical coordinates of the control displayed on the second device, namely the second position coordinates mentioned above.

[0100] Step 204: Send a first control instruction to the second device.

[0101] Step 205: Generate a test result based on page changes of the application on the second device.

[0102] Specifically, the jump pages for different pages can be predefined, and the page jump is compared with the predefined jump page to determine whether the page jump is successful. For example, taking the login operation as an example, if the page pops up a "Login Successful" prompt after the login is successful, it is determined that the login operation was successful. If the prompt does not pop up, it is determined that the login operation failed.

[0103] Specifically, if the page jump of the application on the second device fails, or the jump page is incorrect (ie, it does not jump according to the preset path), a page abnormality test report can be generated.

[0104] It should be noted that if the page to be tested includes multiple controls, a first control instruction for each control can be generated according to the location information of each control, and the first control instruction for each control can be executed on the second device in turn to obtain multiple test records.

[0105] The application testing method provided in this embodiment obtains the application's page to be tested on a second device, determines the location information of a control on the page to be tested that can trigger a page change, generates a control instruction for triggering a touch operation on the control based on the location information, sends the control instruction to the second device, and monitors the application's page changes on the second device. This testing solution can be used to test application pages on different types of devices, is highly versatile, reduces application testing costs, and improves testing efficiency.

[0106] Figure 4 Schematic diagram of the process of testing the application provided in the embodiment of the present application Figure 2 ,like Figure 4 As shown, the application testing method of this embodiment includes the following steps:

[0107] Step 301: Acquire a page to be tested of an application on a second device, where the page to be tested includes a control that can trigger page changes.

[0108] Step 302: Determine the location information of the control on the page to be tested by calling a third-party service interface.

[0109] Step 303: Generate a first control instruction according to the position information of the control on the page to be tested, where the first control instruction is used to trigger a touch operation on the control.

[0110] Step 304: Send a first control instruction to the second device.

[0111] Step 305: Generate a test result based on page changes of the application on the second device.

[0112] In this embodiment, the third-party service interface includes: an image recognition service interface, and / or an OCR text recognition service interface.

[0113] In an optional embodiment of the present application, the position information of the icon control on the page to be tested is obtained by calling the image recognition service interface. That is, the first device can obtain the position information of the icon control on the page to be tested by calling the image recognition service interface provided by the third-party server.

[0114] In an optional embodiment of the present application, the position information of the text control on the page to be tested is obtained by calling the OCR text recognition service interface. That is, the first device can obtain the position information of the text control on the page to be tested by calling the OCR text recognition service interface provided by the third-party server.

[0115] The application testing method provided in this embodiment obtains the page to be tested of the application on the second device, obtains the location information of the icon control and text control on the page to be tested by calling the image recognition and OCR text recognition interfaces provided by a third-party server, and then generates a control instruction for triggering a touch operation on the control based on the location information, and sends the control instruction to the second device to monitor the page changes of the application on the second device. The above scheme utilizes the external interface provided by the network server and only needs to encapsulate the method of calling the image recognition service and the OCR service. During testing, only the icon control identifier or text information to be recognized needs to be passed in, thereby greatly simplifying the complexity of the test script and achieving the effect of writing the script in natural language. The test script is highly versatile and supports automated testing of application pages of various test models, reducing the testing cost of the application and improving the testing efficiency.

[0116] The above describes the test method of the application provided by the embodiment of the present application. The following describes the test device of the application provided by the embodiment of the present application.

[0117] The embodiment of the present application can divide the functional modules of the test device of the application according to the above method embodiment. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. The following is an example of dividing each functional module corresponding to each function.

[0118] Figure 5 This is a schematic diagram of the structure of the test device for the application provided in the embodiment of the present application. Figure 5 As shown, the application testing device 400 provided in this embodiment includes: an acquisition module 401 , a processing module 402 and a sending module 403 .

[0119] An acquisition module 401 is configured to acquire a page to be tested of the application on the second device, where the page to be tested includes a control that can trigger a page change;

[0120] Processing module 402, configured to determine the position information of the control on the page to be tested;

[0121] generating a first control instruction according to the position information, where the first control instruction is used to trigger a touch operation on the control;

[0122] A sending module 403 is configured to send the first control instruction to the second device;

[0123] The processing module 402 is further configured to generate a test result according to page changes of the application on the second device.

[0124] In an optional embodiment of the present application, the control includes an icon control; the processing module 402 is specifically configured to:

[0125] The position information of the icon control on the page to be tested is determined by an image recognition model, and the image recognition model is obtained by training based on a deep learning model.

[0126] In an optional embodiment of the present application, the control includes a text control; the processing module 402 is specifically configured to:

[0127] Determine whether there is preset text on the page to be tested by optical character recognition (OCR) technology;

[0128] If the preset text exists, the position information of the text control including the preset text on the page to be tested is determined.

[0129] In an optional embodiment of the present application, the processing module 402 is specifically configured to:

[0130] The location information of the control on the page to be tested is determined by calling a third-party service interface; the third-party service interface includes an image recognition service interface and / or an OCR text recognition service interface.

[0131] In an optional embodiment of the present application, the position information includes the first position coordinates of the control on the page to be tested; the processing module 402 is specifically configured to:

[0132] Performing coordinate conversion on the first position coordinates to obtain second position coordinates, where the second position coordinates are the position coordinates of the control on the second device;

[0133] The first control instruction is generated according to the second position coordinates.

[0134] In an optional embodiment of the present application, the processing module is specifically configured to:

[0135] Perform coordinate conversion on the first position coordinates according to the screen resolution of the second device to obtain the second position coordinates.

[0136] The application testing device provided in this embodiment can execute the technical solution of any of the above method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.

[0137] Figure 6The hardware structure diagram of the electronic device provided in the embodiment of the present application is as follows: Figure 6 As shown, the electronic device 500 provided in this embodiment includes:

[0138] Memory 501;

[0139] Processor 502; and

[0140] computer programs;

[0141] Among them, the computer program is stored in the memory 501 and is configured to be executed by the processor 502 to implement the technical solution of any of the above method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.

[0142] Optionally, the memory 501 can be independent or integrated with the processor 502. When the memory 501 is a device independent of the processor 502, the electronic device 500 further includes a bus 503 for connecting the memory 501 and the processor 502.

[0143] The embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by the processor 502 to implement the technical solution in any of the aforementioned method embodiments.

[0144] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the technical solution in any of the aforementioned method embodiments.

[0145] An embodiment of the present application further provides a chip, including: a processing module and a communication interface, wherein the processing module can execute the technical solution in any of the aforementioned method embodiments.

[0146] Furthermore, the chip also includes a storage module (such as a memory), the storage module is used to store instructions, the processing module is used to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module enables the processing module to execute the technical solution in any of the aforementioned method embodiments.

[0147] It should be understood that the processor described above may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASICs). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.

[0148] The memory may include a high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk.

[0149] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be classified into address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.

[0150] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0151] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an application-specific integrated circuit (ASIC). Of course, the processor and storage medium can also exist as discrete components in an electronic device.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for testing an application, characterized in that: Applied to a first device, the first device is connected to a second device, and the second device is a device under test, the method includes: Obtaining a page to be tested of the application on the second device, where the page to be tested includes a control that can trigger a page change; Determine the position information of the control on the page to be tested; the position information includes the center position coordinates of the control on the page to be tested; Performing coordinate conversion on the center position coordinates of the control to obtain second position coordinates, where the second position coordinates are the position coordinates of the control on the second device; generating a first control instruction according to the second position coordinates, where the first control instruction is used to trigger a touch operation on the control; sending the first control instruction to the second device; generating a test result based on page changes of the application on the second device; Among them, when the page to be tested includes multiple icon controls, the coordinate conversion of the center position coordinates of the control is performed before obtaining the second position coordinates, and the method also includes: determining the confidence corresponding to the icon control; and eliminating the icon control whose confidence is less than a preset threshold.

2. The method according to claim 1, characterized in that The control includes an icon control; and determining the position information of the control on the page to be tested includes: The position information of the icon control on the page to be tested is determined by an image recognition model, and the image recognition model is obtained by training based on a deep learning model.

3. The method according to claim 1, characterized in that The control includes a text control; and determining the position information of the control on the page to be tested includes: Determine whether there is preset text on the page to be tested by optical character recognition (OCR) technology; If the preset text exists, the position information of the text control including the preset text on the page to be tested is determined.

4. The method according to claim 1, wherein Determining the position information of the control on the page to be tested includes: The location information of the control on the page to be tested is determined by calling a third-party service interface; the third-party service interface includes an image recognition service interface and / or an OCR text recognition service interface.

5. The method according to any one of claims 1 to 4, characterized in that The performing coordinate conversion on the center position coordinates of the control to obtain second position coordinates includes: Perform coordinate conversion on the center position coordinates of the control according to the screen resolution of the second device to obtain the second position coordinates.

6. A testing device for an application, characterized in that: include: an acquisition module, configured to acquire a page to be tested of the application on the second device, wherein the page to be tested includes a control that can trigger a page change; The second device is connected to the testing apparatus, and the second device is a device under test; A processing module, configured to determine position information of the control on the page to be tested; The position information includes the center position coordinates of the control on the page to be tested; Performing coordinate conversion on the center position coordinates of the control to obtain second position coordinates, where the second position coordinates are the position coordinates of the control on the second device; generating a first control instruction according to the second position coordinates, where the first control instruction is used to trigger a touch operation on the control; a sending module, configured to send the first control instruction to the second device; The processing module is further configured to generate a test result based on page changes of the application on the second device; The processing module is further configured to, when the page to be tested includes multiple icon controls, determine the confidence levels corresponding to the icon controls before performing coordinate conversion on the center position coordinates of the controls to obtain second position coordinates; and eliminate icon controls whose confidence levels are less than a preset threshold.

7. The device according to claim 6, characterized in that The control includes an icon control; the processing module is specifically configured to: The position information of the icon control on the page to be tested is determined by an image recognition model, and the image recognition model is obtained by training based on a deep learning model.

8. The device according to claim 6, characterized in that The control includes a text control; the processing module is specifically used to: Determine whether there is preset text on the page to be tested by optical character recognition (OCR) technology; If the preset text exists, the position information of the text control including the preset text on the page to be tested is determined.

9. The device according to claim 6, characterized in that The processing module is specifically used to: The location information of the control on the page to be tested is determined by calling a third-party service interface; the third-party service interface includes an image recognition service interface and / or an OCR text recognition service interface.

10. The device according to any one of claims 6 to 9, characterized in that The processing module is specifically used to: Perform coordinate conversion on the center position coordinates of the control according to the screen resolution of the second device to obtain the second position coordinates.

11. An electronic device, characterized in that: include: Memory; processor; as well as computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method according to any one of claims 1 to 5.

12. A computer-readable storage medium, characterized in that A computer program is stored thereon, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 5.

13. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 5 when executed by a processor.

Citation Information

Patent Citations

  • Test method and device applied to electronic equipment, computing equipment and medium

    CN110413529A