CN117056241B - Application program testing method and device for mobile terminal - Google Patents

Application program testing method and device for mobile terminal Download PDF

Info

Publication number
CN117056241B
CN117056241B CN202311325019.9A CN202311325019A CN117056241B CN 117056241 B CN117056241 B CN 117056241B CN 202311325019 A CN202311325019 A CN 202311325019A CN 117056241 B CN117056241 B CN 117056241B
Authority
CN
China
Prior art keywords
mobile terminal
script engine
script
control information
test
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.)
Active
Application number
CN202311325019.9A
Other languages
Chinese (zh)
Other versions
CN117056241A (en
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.)
Richinfo Technology Co ltd
Original Assignee
Richinfo 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 Richinfo Technology Co ltd filed Critical Richinfo Technology Co ltd
Priority to CN202311325019.9A priority Critical patent/CN117056241B/en
Publication of CN117056241A publication Critical patent/CN117056241A/en
Application granted granted Critical
Publication of CN117056241B publication Critical patent/CN117056241B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application program testing method and device for the mobile terminal are used for solving the problem that the type of a test script of an application program to be tested is not matched with that of a target mobile terminal, and when the target mobile terminal cannot run the test script of the application program to be tested, the method comprises the following steps: creating at least one application test script engine for the target mobile terminal; generating a script engine manager according to the application test script engine; converting the type of the script to be tested into a target script type executable by the target mobile terminal by a script engine manager; the script to be tested after dispatching the conversion type from the script engine manager tests the application program to be tested, so that the problem of difficult test caused by unmatched test script types in the application program test for the mobile terminal in the prior art is solved.

Description

Application program testing method and device for mobile terminal
Technical Field
The invention relates to the technical field of application program testing for mobile terminals, in particular to an application program testing method and device for a mobile terminal.
Background
The mobile terminal Application program (app) needs to be updated and iterated continuously, regression testing of model compatibility is required before each app version is released, testing work is strict, and testing workload is heavy. In particular, for some app-emerging functionality and crash problems, the test team often requires significant effort and time to replicate these problems, and therefore, partially automated script testing is typically used instead of manual testing.
Currently, automated test scripts are roughly divided into two categories, one is UiAutomator provided by *** native, and the other is key-press puck automated script. But both of these solutions do not meet the test requirements. The UIAutomator automation script can be used only by connecting with a computer, has fewer functions, cannot complete the test in the webview page, has imperfect functional API packaging, and cannot perform multi-thread task operation. The key eidolon automation script needs to carry out root on the mobile phone, uses super permission, obtains control information by a method, can only be operated by coordinate blind clicking, cannot accurately click a control, and cannot automatically adapt to different mobile phone screens.
Disclosure of Invention
The invention aims to solve the technical problem that in the prior art, when the type of the test script is not matched with the tested terminal, the test is difficult, so that the application program testing method and device for the mobile terminal are provided.
In order to solve the above technical problems, the embodiments of the present disclosure at least provide an application program testing method and apparatus for a mobile terminal.
In a first aspect, an embodiment of the present disclosure provides an application program testing method for a mobile terminal, where a type of a test script of a tested application program is not matched with a target mobile terminal, and when the target mobile terminal cannot run the test script of the tested application program, the method includes:
creating at least one application test script engine for the target mobile terminal;
generating a script engine manager according to the application test script engine;
converting the type of the script to be tested into a target script type executable by a target mobile terminal by the script engine manager;
and testing the tested application program from the to-be-tested script after dispatching the conversion type by the script engine manager.
Optionally, the creating at least one application test script engine for the target mobile terminal includes: acquiring control information of the target mobile terminal, and packaging the control information; creating a selector interface for the control information, wherein the selector selection rule comprises depth-first search of the control information and breadth-first search of the control information; encapsulating a control operation interface of the target mobile terminal; constructing a script engine factory based on the encapsulated control information, the selector interface and the encapsulated operation interface; at least one application test script engine for the mobile terminal is created from the script engine factory.
Optionally, the control information includes: control ID, control type, control text, control click, control slide, control coordinates, and control hierarchical depth.
Optionally, the type of the script to be tested is javascript, and the type of the target script is java.
Optionally, before constructing a script engine factory based on the encapsulated control information, the selector interface, and the encapsulated operation interface, the creating at least one application test script engine for the target mobile terminal further comprises: encapsulating the image processing capability of the target mobile terminal; constructing a script engine factory based on the encapsulated control information, the selector interface and the encapsulated operation interface as follows: a script engine factory is constructed based on the encapsulated control information, the selector interface, the encapsulated operation interface, and the encapsulated image processing capabilities.
Optionally, the target mobile terminal is an android mobile phone, and the obtaining control information of the target mobile terminal is: and acquiring control information of the target mobile terminal through the android system barrier-free service.
Optionally, constructing a script engine factory based on the encapsulated control information, the selector interface, the encapsulated operation interface, and the encapsulated image processing capability comprises: under the condition that the control information can not be acquired, extracting a corresponding intercepted screen image through the image processing capability, and searching the coordinate of the corresponding color of the image by utilizing the RGB value; and realizing target operation through the coordinates of the corresponding image.
In a second aspect, an embodiment of the present disclosure provides an application program testing apparatus for a mobile terminal, where the apparatus is configured to test an application program under test when a test script type of the application program under test does not match with the apparatus, and the apparatus includes:
the test script engine creation module is used for creating at least one application program test script engine for the target mobile terminal;
the script engine manager generation module is used for generating a script engine manager according to the application program test script engine;
the test script type conversion module is used for converting the type of the script to be tested into the type of the target script executable by the target mobile terminal by the script engine manager;
and the test execution module is used for testing the tested application program from the to-be-tested script after the script engine manager dispatches the conversion type.
In a third aspect, the disclosed embodiments of the invention also provide a computer device comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect, or any of the possible implementations of the first aspect.
In a fourth aspect, the disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the first aspect, or any of the possible implementation manners of the first aspect.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the solution creates at least one application test script engine for the target mobile terminal; then a script engine manager is generated according to the application program test script engine; the script engine manager converts the type of the script to be tested into the type of the target script executable by the target mobile terminal, realizes the test of the application program to be tested, realizes the bridging between different test script languages by means of the open source engine, realizes the processing of images based on the open CV open source computer visual library, builds a running time environment on two big bases, encapsulates the commonly used api and the control selector, thus realizing the simple script writing by using javascript, solving the problems of difficult test in the prior art due to unmatched test script type and the tested terminal, and having the characteristics of low learning cost, convenient function expansibility, no need of recompilation in code debugging and the like.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a flowchart of an application testing method for a mobile terminal according to an embodiment of the present disclosure;
FIG. 2 is a flow chart of another method for testing applications for a mobile terminal according to an embodiment of the present disclosure;
FIG. 3 is a functional block diagram of an application testing apparatus for a mobile terminal according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a computer device according to an embodiment of the present disclosure;
FIG. 5 is a functional block diagram illustrating yet another method for testing applications of a mobile terminal according to an embodiment of the present disclosure;
FIG. 6 is a diagram showing the logical structure of an image processing capability package in the method of FIG. 5;
fig. 7 shows a flow diagram of the method of fig. 5.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the invention. Rather, they are merely examples of apparatus and methods consistent with aspects of the invention as detailed in the accompanying summary.
Example 1
As shown in fig. 1, in a flowchart of an application program testing method for a mobile terminal provided by an embodiment of the present invention, a type of a test script of a tested application program is not matched with a target mobile terminal, and when the target mobile terminal cannot run the test script of the tested application program, the method includes:
s11: at least one application test script engine for the target mobile terminal is created.
S12: the script engine manager is generated from the application test script engine.
S13: and converting the type of the script to be tested into the type of the target script executable by the target mobile terminal by the script engine manager.
S14: and testing the tested application program by dispatching the to-be-tested scripts with the conversion type from the script engine manager.
It can be understood that, according to the technical scheme provided by the embodiment, at least one application test script engine for the target mobile terminal is created; then a script engine manager is generated according to the application program test script engine; the script engine manager converts the type of the script to be tested into the type of the target script executable by the target mobile terminal, realizes the test of the application program to be tested, realizes the bridging between different test script languages by means of the open source engine, realizes the processing of images based on the open CV open source computer visual library, builds a running time environment on two big bases, encapsulates the commonly used api and the control selector, thus realizing the simple script writing by using javascript, solving the problems of difficult test in the prior art due to unmatched test script type and the tested terminal, and having the characteristics of low learning cost, convenient function expansibility, no need of recompilation in code debugging and the like.
Example 2
As shown in fig. 2, in another flowchart of an application program testing method for a mobile terminal provided by an embodiment of the present invention, a type of a test script of a tested application program is not matched with a target mobile terminal, and when the target mobile terminal cannot run the test script of the tested application program, the method includes:
s21: at least one application test script engine for the target mobile terminal is created.
S22: the script engine manager is generated from the application test script engine.
S23: and converting the type of the script to be tested into the type of the target script executable by the target mobile terminal by the script engine manager.
S24: and testing the tested application program by dispatching the to-be-tested scripts with the conversion type from the script engine manager.
In some alternative embodiments, S21 may be implemented by:
s211: and acquiring control information of the target mobile terminal, and packaging the control information.
The target mobile terminal is an android mobile phone, and control information of the target mobile terminal is obtained through barrier-free service of an android system.
S212: a selector interface is created for the control information, and the selector selection rules comprise a depth-first search of the control information and a breadth-first search of the control information.
S213: and encapsulating a control operation interface of the target mobile terminal.
S214: the image processing capabilities of the target mobile terminal are encapsulated.
S215: a script engine factory is constructed based on the encapsulated control information, the selector interface, the encapsulated operation interface, and the encapsulated image processing capabilities.
S216: at least one application test script engine for the mobile terminal is created from the script engine factory.
In some alternative embodiments, the control information includes: control ID, control type, control text, control click, control slide, control coordinates, and control hierarchical depth.
In some alternative embodiments, the type of script to be tested is javascript, and the type of target script is java.
Specifically, in some alternative embodiments, S215 includes (not shown):
s2151: under the condition that control information cannot be acquired, a corresponding cut-out screen image is extracted through the image processing capability, and the RGB value is utilized to find out the coordinates of the corresponding color of the image.
S2152: and realizing target operation through the coordinates of the corresponding image.
It can be understood that, according to the technical scheme provided by the embodiment, at least one application test script engine for the target mobile terminal is created; then a script engine manager is generated according to the application program test script engine; the script engine manager converts the type of the script to be tested into the type of the target script executable by the target mobile terminal, realizes the test of the application program to be tested, realizes the bridging between different test script languages by means of the open source engine, realizes the processing of images based on the open CV open source computer visual library, builds a running time environment on two big bases, encapsulates the commonly used api and the control selector, thus realizing the simple script writing by using javascript, solving the problems of difficult test in the prior art due to unmatched test script type and the tested terminal, and having the characteristics of low learning cost, convenient function expansibility, no need of recompilation in code debugging and the like.
Example 3
As shown in fig. 3, the embodiment of the present invention further provides an application program testing device for a mobile terminal, for testing an application program under test when a test script type of the application program under test does not match with the device, where the device includes:
a test script engine creation module 31 for creating at least one application test script engine for the target mobile terminal;
a script engine manager generation module 32 for generating a script engine manager from an application test script engine;
a test script type conversion module 33, configured to convert, by the script engine manager, a type of a script to be tested into a target script type executable by the target mobile terminal;
the test execution module 34 is configured to test the tested application program from the script to be tested after the script engine manager schedules the conversion type.
In some alternative embodiments, the test script engine creation module 31 comprises:
the control information encapsulation sub-module 311 is configured to obtain control information of the target mobile terminal, and encapsulate the control information;
a selector interface creation sub-module 312 for creating a selector interface for the control information, the selector selection rule including a depth-first search of the control information and a breadth-first search of the control information;
an operation interface encapsulation sub-module 313 for encapsulating a control operation interface of the target mobile terminal;
a script engine factory building sub-module 314 for building a script engine factory based on the encapsulated control information, the selector interface, and the encapsulated operation interface;
the test script engine creation sub-module 315 is for creating at least one application test script engine for the mobile terminal from the script engine factory.
In some alternative embodiments, the control information includes: control ID, control type, control text, control click, control slide, control coordinates, and control hierarchical depth.
In some alternative embodiments, the type of script to be tested is javascript, and the type of target script is java.
In some alternative embodiments, the test script engine creation module 31 further comprises:
an image processing capability packaging sub-module for packaging the image processing capability of the target mobile terminal;
the script engine factory building sub-module 314 builds a script engine factory based on the encapsulated control information, the selector interface, the encapsulated operation interface, and the encapsulated image processing capabilities.
In some alternative embodiments, the test script engine creation module 31 obtains the control information of the target mobile terminal through the android system barrier-free service.
In some alternative embodiments, script engine factory building sub-module 314 comprises:
the image coordinate extraction unit is used for extracting a corresponding intercepted screen image through the image processing capability under the condition that control information cannot be acquired, and then searching the coordinate of the corresponding color of the image by utilizing the RGB value;
and the operation execution unit is used for realizing target operation through the coordinates of the corresponding image.
It can be understood that, according to the technical scheme provided by the embodiment, at least one application test script engine for the target mobile terminal is created; then a script engine manager is generated according to the application program test script engine; the script engine manager converts the type of the script to be tested into the type of the target script executable by the target mobile terminal, realizes the test of the application program to be tested, realizes the bridging between different test script languages by means of the open source engine, realizes the processing of images based on the open CV open source computer visual library, builds a running time environment on two big bases, encapsulates the commonly used api and the control selector, thus realizing the simple script writing by using javascript, solving the problems of difficult test in the prior art due to unmatched test script type and the tested terminal, and having the characteristics of low learning cost, convenient function expansibility, no need of recompilation in code debugging and the like.
Example 4
Based on the same technical concept, the embodiment of the application also provides a computer device, which comprises a memory 1 and a processor 2, as shown in fig. 4, the memory 1 stores a computer program, and the processor 2 implements any one of the application program testing methods for the mobile terminal when executing the computer program.
The memory 1 includes at least one type of readable storage medium including flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 1 may in some embodiments be an internal storage unit, such as a hard disk, of an application testing system for a mobile terminal. The memory 1 may in other embodiments also be an external storage device for an application testing system of a mobile terminal, 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. Further, the memory 1 may also include both an internal storage unit and an external storage device for an application testing system of the mobile terminal. The memory 1 may be used not only for storing application software installed in an application test system for a mobile terminal and various types of data, such as code of an application test program for a mobile terminal, etc., but also for temporarily storing data that has been output or is to be output.
The processor 2 may in some embodiments be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor or other data processing chip for running program code or processing data stored in the memory 1, for example executing application test programs for mobile terminals or the like.
It can be understood that, according to the technical scheme provided by the embodiment, at least one application test script engine for the target mobile terminal is created; then a script engine manager is generated according to the application program test script engine; the script engine manager converts the type of the script to be tested into the type of the target script executable by the target mobile terminal, realizes the test of the application program to be tested, realizes the bridging between different test script languages by means of the open source engine, realizes the processing of images based on the open CV open source computer visual library, builds a running time environment on two big bases, encapsulates the commonly used api and the control selector, thus realizing the simple script writing by using javascript, solving the problems of difficult test in the prior art due to unmatched test script type and the tested terminal, and having the characteristics of low learning cost, convenient function expansibility, no need of recompilation in code debugging and the like.
In order to facilitate the reader to understand the technical scheme of the embodiment of the invention, the technical details in the scheme are described in detail below through specific examples.
The embodiment of the invention provides an application program testing method and device for a mobile terminal, which are APP automatic testing methods based on android barrier-free service and JS engine capability, and are described in detail below.
1. And (5) obtaining and operating the barrier-free information to package.
And the information returned by the android barrier-free service comprises information such as a control ID, a control type, a control text, a control click, a control sliding, a control coordinate, a control hierarchical depth and the like, and a selector interface is created, so that the rule selected by the selector is not limited to the control depth-first search and the breadth-first search under different conditions such as the ID, the control type and the text.
And (5) encapsulating operation interfaces such as clicking, sliding, long-pressing, inputting and the like of the control.
Obtaining a webview control through the android barrier-free control, and packaging the dom available information under the webview. The selector interface and the operation interface are respectively realized.
And packaging the control information acquisition interface and the operation interface.
2. And processing and packaging the image.
The image binarization, color finding, acquaintance, image change and other capabilities are packaged through the expansion of OpenCV (cross-platform computer vision), so that the corresponding coordinates can be extracted through the binarization processing, color finding, image recognition and the like of the image information under the condition that the control cannot acquire information, and clicking, long-pressing, sliding and other operations are realized through the coordinates.
3. And creating a script engine running time construction and running environment management.
And designing a script engine factory, creating a plurality of script running times according to the factory, adding a script management class, managing the running state of each script, and capturing error report crashes among different scripts so as not to influence other scripts.
And packaging the java thread pool, calling a method for the new javascript thread, redefining a timer, and enabling the support of countdown timing and interval timing.
The mobile phone common application information, operation authority, I/O operation, network request and the like are packaged, and the javascript can be directly called to acquire the application information, apply for the authority, the I/O operation, the network request and the like.
According to the method, the information method of the APP to be tested is obtained through the barrier-free service permission of the android, and the bridge connection scheme is made through the rho engine, so that the problem that code compiling is needed for each operation of the android is solved, script development difficulty and time are reduced, and development efficiency is improved. The runtime environment constructed by mapping related methods on the basis of a rho engine and an android barrier-free service comprises a JS directly-callable control operation method, mobile phone information acquisition, I/O operation, a network frame, multithreading, authority application, picture operation and the like. And a root or a computer is not required to be linked, so that the threshold of the use environment is reduced. And accurately operating the control according to the analysis of the layout information. The acquisition of the layout information is separated from the PC end or a third party tool.
Simple javascript is used to map the android native language. Debugging of the supporting script does not require recompilation of the framework. And the encapsulation of the common script API is perfected, so that the writing of the script is further simplified. And the multithreading is supported, the acquisition of webview nodes is increased, the image processing is increased, and the reusability of the framework is increased.
Based on script compiling-free automatic execution, one can automatically and intelligently complete testing work of some fixed scenes, such as functional regression testing of app versions, and the other can automatically reproduce functional problems and crashability problems which are frequently found in apps fed back by some users, so that part of testing productivity is liberated, app publishing efficiency is improved, and acquisition and part of operation of application controls are realized by means of android system barrier-free service (AccessibilityService). By means of an open source Rhino engine, bridging between a javascript grammar and a java grammar is achieved, processing of images is achieved based on an OpenCV open source computer vision library, a running time environment is built on two large bases, a commonly used api and a control selector are packaged, simple script writing can be achieved through the javascript, and the method has the advantages of being low in learning cost, convenient in function expansibility, free of recompilation in code debugging and the like.
The disclosed embodiments also provide a computer readable storage medium having a computer program stored thereon, which when executed by a processor performs the steps of the application testing method for a mobile terminal in the above method embodiments. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
The computer program product of the application program testing method for a mobile terminal provided by the embodiment of the present invention includes a computer readable storage medium storing program codes, and the instructions included in the program codes may be used to execute the steps of the application program testing method for a mobile terminal in the above method embodiment, and specifically, refer to the above method embodiment and are not repeated herein.
The disclosed embodiments also provide a computer program which, when executed by a processor, implements any of the methods of the previous embodiments. The computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It is to be understood that the same or similar parts in the above embodiments may be referred to each other, and that in some embodiments, the same or similar parts in other embodiments may be referred to.
It should be noted that in the description of the present invention, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Furthermore, in the description of the present invention, unless otherwise indicated, the meaning of "plurality" means at least two.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, where the program may be stored in a computer readable storage medium, and where the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.

Claims (6)

1. An application program testing method for a mobile terminal, wherein the type of a test script of a tested application program is not matched with a target mobile terminal, and when the target mobile terminal cannot run the test script of the tested application program, the method comprises the following steps:
creating at least one application test script engine for the target mobile terminal;
generating a script engine manager according to the application test script engine;
converting the type of the script to be tested into a target script type executable by a target mobile terminal by the script engine manager;
testing the tested application program from the script to be tested after dispatching the conversion type by the script engine manager;
the creating at least one application test script engine for the target mobile terminal comprises:
acquiring control information of the target mobile terminal, and packaging the control information;
creating a selector interface for the control information, wherein the selector selection rule comprises depth-first search of the control information and breadth-first search of the control information;
encapsulating a control operation interface of the target mobile terminal;
constructing a script engine factory based on the encapsulated control information, the selector interface and the encapsulated operation interface;
creating at least one application test script engine for the mobile terminal according to the script engine factory;
before constructing a script engine factory based on the encapsulated control information, the selector interface, and the encapsulated operation interface, the creating at least one application test script engine for the target mobile terminal further comprises:
encapsulating the image processing capability of the target mobile terminal;
constructing a script engine factory based on the encapsulated control information, the selector interface and the encapsulated operation interface as follows: constructing a script engine factory based on the encapsulated control information, the selector interface, the encapsulated operation interface, and the encapsulated image processing capability;
constructing a script engine factory based on the encapsulated control information, the selector interface, the encapsulated operation interface, and the encapsulated image processing capability includes:
under the condition that the control information can not be acquired, capturing a screen image through the image processing capability, and searching the coordinate of the corresponding color of the image by utilizing the RGB value;
realizing target operation through coordinates of the corresponding images;
the target mobile terminal is an android mobile phone, and the control information of the target mobile terminal is obtained by: and acquiring control information of the target mobile terminal through the android system barrier-free service.
2. The application testing method for a mobile terminal according to claim 1, wherein the control information includes: control ID, control type, control text, control click, control slide, control coordinates, and control hierarchical depth.
3. The application program testing method for a mobile terminal according to claim 2, wherein the type of the script to be tested is javascript, and the type of the target script is java.
4. An application program testing apparatus for a mobile terminal, wherein the apparatus is configured to test an application program under test when a test script type of the application program under test does not match the apparatus, the apparatus comprising:
the test script engine creation module is used for creating at least one application program test script engine for the target mobile terminal;
the script engine manager generation module is used for generating a script engine manager according to the application program test script engine;
the test script type conversion module is used for converting the type of the script to be tested into the type of the target script executable by the target mobile terminal by the script engine manager;
the test execution module is used for testing the tested application program from the to-be-tested script after the script engine manager dispatches the conversion type;
the test script engine creation module includes: the control information encapsulation sub-module is used for acquiring control information of the target mobile terminal and encapsulating the control information; the selector interface creation sub-module is used for creating a selector interface for the control information, and the selector selection rule comprises depth-first search of the control information and breadth-first search of the control information; the operation interface encapsulation submodule is used for encapsulating a control operation interface of the target mobile terminal; the script engine factory building sub-module is used for building a script engine factory based on the encapsulated control information, the selector interface and the encapsulated operation interface; a test script engine creation sub-module for creating at least one application test script engine for the mobile terminal from a script engine factory;
the test script engine creation module further comprises: an image processing capability packaging sub-module for packaging the image processing capability of the target mobile terminal; the script engine factory building sub-module builds a script engine factory based on the encapsulated control information, the selector interface, the encapsulated operation interface and the encapsulated image processing capability;
the script engine factory building submodule includes: the image coordinate extraction unit is used for extracting a corresponding intercepted screen image through the image processing capability under the condition that control information cannot be acquired, and then searching the coordinate of the corresponding color of the image by utilizing the RGB value; the operation execution unit is used for realizing target operation through the coordinates of the corresponding image;
the target mobile terminal is an android mobile phone, and the control information of the target mobile terminal is obtained by: and acquiring control information of the target mobile terminal through the android system barrier-free service.
5. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication over the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the application testing method for a mobile terminal as claimed in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, performs the application testing method for a mobile terminal according to any of claims 1 to 3.
CN202311325019.9A 2023-10-13 2023-10-13 Application program testing method and device for mobile terminal Active CN117056241B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311325019.9A CN117056241B (en) 2023-10-13 2023-10-13 Application program testing method and device for mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311325019.9A CN117056241B (en) 2023-10-13 2023-10-13 Application program testing method and device for mobile terminal

Publications (2)

Publication Number Publication Date
CN117056241A CN117056241A (en) 2023-11-14
CN117056241B true CN117056241B (en) 2024-01-26

Family

ID=88655864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311325019.9A Active CN117056241B (en) 2023-10-13 2023-10-13 Application program testing method and device for mobile terminal

Country Status (1)

Country Link
CN (1) CN117056241B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104679644A (en) * 2013-11-28 2015-06-03 比亚迪股份有限公司 Testing method and system for application program in mobile terminal
CN105740148A (en) * 2016-01-29 2016-07-06 博雅网信(北京)科技有限公司 Script engine system of mobile terminal automation test and testing method
CN108415826A (en) * 2018-01-12 2018-08-17 深圳壹账通智能科技有限公司 Test method, terminal device and the computer readable storage medium of application
CN112148610A (en) * 2020-09-28 2020-12-29 深圳壹账通智能科技有限公司 Test case execution method and device, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060230319A1 (en) * 2005-04-12 2006-10-12 Ryali Jogarao M Automated migration of software instructions

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104679644A (en) * 2013-11-28 2015-06-03 比亚迪股份有限公司 Testing method and system for application program in mobile terminal
CN105740148A (en) * 2016-01-29 2016-07-06 博雅网信(北京)科技有限公司 Script engine system of mobile terminal automation test and testing method
CN108415826A (en) * 2018-01-12 2018-08-17 深圳壹账通智能科技有限公司 Test method, terminal device and the computer readable storage medium of application
CN112148610A (en) * 2020-09-28 2020-12-29 深圳壹账通智能科技有限公司 Test case execution method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN117056241A (en) 2023-11-14

Similar Documents

Publication Publication Date Title
US10579344B2 (en) Converting visual diagrams into code
US8347272B2 (en) Call graph dependency extraction by static source code analysis
CN111881019B (en) User interface testing method and device
US10176077B2 (en) Generating breakpoints for cross-layer debugging
CN105378658A (en) Automatic source code generation
CN110955409A (en) Method and device for creating resources on cloud platform
CN111338925A (en) Applet test method, device and system, electronic equipment and storage medium
Tuovenen et al. MAuto: Automatic mobile game testing tool using image-matching based approach
US20120110383A1 (en) Method and apparatus for off-line analyzing crashed programs
CN117056241B (en) Application program testing method and device for mobile terminal
CN117370203A (en) Automatic test method, system, electronic equipment and storage medium
CN111459810A (en) Method of constructing application program, programming apparatus, and computer-readable storage medium
CN113641594B (en) Cross-terminal automatic testing method and related device
CN112711427A (en) Method and device for acquiring mirror image file
CN111078529A (en) Client write-in module testing method and device and electronic equipment
CN113688031B (en) Test positioning method based on byte code enhancement technology
US20230115334A1 (en) Identifying computer instructions enclosed by macros and conflicting macros at build time
US11544179B2 (en) Source traceability-based impact analysis
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
CN114791885A (en) Interface test method, device, equipment and medium
CN114371986A (en) User interface test case updating method, device and storage medium
CN111414301B (en) Method and device for debugging application program
CN113360194B (en) Python-based drive generation method and system and electronic equipment
EP1868099A1 (en) Bug management tool
CN115964262A (en) Debugging method, device and system

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
GR01 Patent grant
GR01 Patent grant