CN112383661A - Mobile terminal automation test method and device, electronic equipment and storage medium - Google Patents

Mobile terminal automation test method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112383661A
CN112383661A CN202011314392.0A CN202011314392A CN112383661A CN 112383661 A CN112383661 A CN 112383661A CN 202011314392 A CN202011314392 A CN 202011314392A CN 112383661 A CN112383661 A CN 112383661A
Authority
CN
China
Prior art keywords
tested
test
mobile terminal
task
interface
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.)
Granted
Application number
CN202011314392.0A
Other languages
Chinese (zh)
Other versions
CN112383661B (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202011314392.0A priority Critical patent/CN112383661B/en
Publication of CN112383661A publication Critical patent/CN112383661A/en
Application granted granted Critical
Publication of CN112383661B publication Critical patent/CN112383661B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/24Arrangements for testing

Abstract

The disclosure relates to a mobile terminal automation test method, a mobile terminal automation test device, electronic equipment and a storage medium. The method comprises the following steps: the method comprises the steps that a task to be tested is obtained, and a corresponding test interface is displayed on a mobile terminal; acquiring a current to-be-tested step of a task to be tested and an indicative element corresponding to the current to-be-tested step, and performing image recognition on a test interface to determine an element matched with the indicative element on the test interface as a target indicative element; and triggering a target indicative element and executing the current step to be tested. The mobile terminal automatic test method provided by the disclosure can determine the indicative elements on the test interface in an image recognition mode and trigger the indicative elements to execute the test steps without depending on an operating system interface, so that the compatibility of the automatic test of the mobile terminal can be improved.

Description

Mobile terminal automation test method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of automated testing, and in particular, to an automated testing method and apparatus for a mobile terminal, an electronic device, and a storage medium.
Background
In the related art, the automated testing of the mobile terminal generally utilizes test application program interfaces provided by different systems to locate an indicative element on the system interface and utilize the system to trigger the operation of the trigger element, so as to implement the automated location of the mobile terminal.
However, the existing automated testing method for the mobile terminal depends heavily on the interface of the operating system, and only can implement the automated testing of the application program obtained by adopting a specific development means on the specific operating system, so that the compatibility is low.
Disclosure of Invention
The present disclosure provides a method and an apparatus for automatically testing a mobile terminal, an electronic device, and a storage medium, so as to at least solve the problem of low compatibility of the automatic testing method for the mobile terminal in the related art. The technical scheme of the disclosure is as follows:
in a first aspect, an automated testing method for a mobile terminal is provided, including:
acquiring a task to be tested and displaying a corresponding test interface on a mobile terminal;
acquiring a current to-be-tested step of the task to be tested and an indicative element corresponding to the current to-be-tested step, and performing image recognition on the test interface to determine an element matched with the indicative element on the test interface as a target indicative element;
and triggering the target indicative element and executing the current step to be tested.
In an optional embodiment, the image recognition of the test interface to determine an element on the test interface matching the indicative element as a target indicative element includes: acquiring test script information matched with the current step to be tested; the test script information stores an element image of at least one indicative element; and comparing each indicative element on the test interface with the element image in the image recognition mode based on the test script information, and taking the indicative element matched with the element image on the test interface as the target indicative element.
In an alternative embodiment, said triggering said target indicative element, performing said current step to be tested, comprises: acquiring a trigger instruction aiming at the element image matched with the current step to be tested based on the test script information; triggering the target indicative element by using the trigger instruction, and executing the current step to be tested.
In an optional embodiment, the triggering the target indicative element with the trigger instruction, and executing the current step to be tested, includes: acquiring the image position of an element image of a target indicative element in a test interface; a trigger instruction is implemented in the image location to perform the current step to be tested.
In an alternative embodiment, the task to be tested comprises a plurality of steps to be tested; after the step of executing the current step to be tested, the method further comprises the following steps: displaying an execution interface after the current step to be tested is executed on the mobile terminal; if the current step to be tested is not the last step to be tested, determining a test result of the current step to be tested based on the execution interface; the last step to be tested is the last step to be tested in the task to be tested; and if the test result of the current step to be tested is successful, taking the execution interface as the test interface of the next step to be tested.
In an alternative embodiment, the task to be tested comprises a plurality of steps to be tested; after the step of executing the current step to be tested, the method further comprises the following steps: displaying an execution interface after the current step to be tested is executed on the mobile terminal; if the current step to be tested is not the last step to be tested, determining a test result of the current step to be tested based on the execution interface; the last step to be tested is the last step to be tested in the task to be tested; and if the test result of the current step to be tested is successful, taking the execution interface as the test interface of the next step to be tested.
In an optional embodiment, the mobile terminal automated testing method further includes: and if the test result of the current step to be tested is test failure, uploading the test result of the current step to be tested to a first server.
In an optional embodiment, the mobile terminal automated testing method further includes: and if the current step to be tested is the last step to be tested, taking the test result of the current step to be tested as the test result of the task to be tested, and uploading the test result of the task to be tested to the first server.
In an optional embodiment, the mobile terminal automated testing method further includes: and uploading the image of the test interface and the image of the execution interface to a second server for storage.
In an optional embodiment, the obtaining a task to be tested and displaying a corresponding test interface on the mobile terminal includes: receiving the task to be tested from a third server; determining a target to-be-tested template corresponding to the to-be-tested task from a plurality of preset to-be-tested templates according to the to-be-tested task; and determining a test interface corresponding to the task to be tested and a step to be tested according to the target template to be tested, and displaying the corresponding test interface.
In a second aspect, an automated testing device for a mobile terminal is provided, which includes:
the test task obtaining unit is configured to execute obtaining of a task to be tested and display of a corresponding test interface on the mobile terminal;
the indicating element determining unit is configured to execute the steps of obtaining the current to-be-tested step of the task to be tested and indicating elements corresponding to the current to-be-tested step, and perform image recognition on the test interface to determine elements matched with the indicating elements on the test interface as target indicating elements;
and the testing step execution unit is configured to trigger the target indicative element and execute the current step to be tested.
In an optional embodiment, the indication element determining unit is further configured to perform obtaining test script information matching the current step to be tested; the test script information stores an element image of at least one indicative element; and comparing each indicative element on the test interface with the element image in the image recognition mode based on the test script information, and taking the indicative element matched with the element image on the test interface as the target indicative element.
In an optional embodiment, the test step executing unit is further configured to execute, based on the test script information, obtaining a trigger instruction for the elemental image that matches the current step to be tested; triggering the target indicative element by using the trigger instruction, and executing the current step to be tested.
In an optional embodiment, the test step executing unit is further configured to execute acquiring an image position of an element image of the target indicative element in the test interface; implementing the trigger instruction in the image location to perform the current step to be tested.
In an alternative embodiment, the task to be tested comprises a plurality of steps to be tested; remove end automatic testing arrangement still includes: the execution interface switching unit is configured to execute the execution interface which is displayed on the mobile terminal after the current step to be tested is executed; if the current step to be tested is not the last step to be tested, determining a test result of the current step to be tested based on the execution interface; the last step to be tested is the last step to be tested in the task to be tested; and if the test result of the current step to be tested is successful, taking the execution interface as the test interface of the next step to be tested.
In an optional embodiment, the mobile terminal automated testing apparatus further includes: and the test result uploading module is configured to upload the test result of the current step to be tested to the first server if the test result of the current step to be tested is a test failure.
In an optional embodiment, the test result uploading module is further configured to execute, if the current step to be tested is the last step to be tested, taking the test result of the current step to be tested as the test result of the task to be tested, and uploading the test result of the task to be tested to the first server.
In an optional embodiment, the mobile terminal automated testing apparatus further includes: and the test image uploading module is configured to upload the image of the test interface and the image of the execution interface to a second server for storage.
In an optional embodiment, the test task obtaining unit is further configured to perform receiving the task to be tested from a third server; determining a target to-be-tested template corresponding to the to-be-tested task from a plurality of preset to-be-tested templates according to the to-be-tested task; and determining a test interface corresponding to the task to be tested and a step to be tested according to the target template to be tested, and displaying the corresponding test interface.
In a third aspect, an electronic device is provided, including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the mobile-end automated testing method described in any embodiment of the first aspect.
In a fourth aspect, a storage medium is provided, where instructions, when executed by a processor of an electronic device, enable the electronic device to perform the mobile-side automated testing method described in any one of the embodiments of the first aspect.
In a fifth aspect, a computer program product is provided, the program product comprising a computer program stored in a readable storage medium, from which the at least one processor of the device reads and executes the computer program, such that the device performs the mobile-side automated testing method described in any one of the embodiments of the first aspect.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
the method comprises the steps that a task to be tested is obtained, and a corresponding test interface is displayed on a mobile terminal; acquiring a current to-be-tested step of a task to be tested and an indicative element corresponding to the current to-be-tested step, and performing image recognition on a test interface to determine an element matched with the indicative element on the test interface as a target indicative element; and triggering a target indicative element and executing the current step to be tested. The mobile terminal automatic test method provided by the disclosure can determine the indicative elements on the test interface in an image recognition mode and trigger the indicative elements to execute the test steps without depending on an operating system interface, so that the compatibility of the automatic test of the mobile terminal can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Fig. 1 is a diagram illustrating an application environment of a method for automated testing of a mobile terminal according to an exemplary embodiment.
Fig. 2 is a flow chart illustrating a method for automated testing of a mobile terminal according to an exemplary embodiment.
FIG. 3 is a flow diagram illustrating the determination of a targeted indicative element according to an exemplary embodiment.
FIG. 4 is a flow diagram illustrating test step switching, according to an example embodiment.
Fig. 5 is a schematic diagram illustrating interface switching of a mobile terminal according to an example embodiment.
FIG. 6 is a diagram illustrating the acquisition of a task to be tested and the presentation of a test interface in accordance with an exemplary embodiment.
Fig. 7 is a flowchart illustrating a method for mobile-side automated testing according to another exemplary embodiment.
Fig. 8 is a flowchart illustrating a mobile-side automated testing method according to yet another exemplary embodiment.
Fig. 9 is a block diagram illustrating a mobile-side automated testing apparatus according to an example embodiment.
Fig. 10 is an internal block diagram of an electronic device shown in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The method for automatically testing the mobile terminal provided by the present disclosure can be applied to the application environment shown in fig. 1. The mobile terminal 101 interacts with the server 102 through a network. Specifically, the server 102 may issue a task to be tested to be executed to the mobile terminal 101, and the mobile terminal may display a corresponding test interface according to the task to be tested, and trigger after finding an indicative element matched with the current testing step on the test interface in an image recognition manner, to execute the current testing step. After the test is completed, the mobile terminal 101 may upload the test result to the server 102. The mobile terminal 101 may be, but is not limited to, various types of mobile phones, and the server 102 may be implemented by an independent server or a server cluster composed of a plurality of servers.
Fig. 2 is a flowchart illustrating a mobile terminal automated testing method according to an exemplary embodiment, where as shown in fig. 2, the mobile terminal automated testing method is used in the mobile terminal 101, and includes the following steps.
In step S201, the mobile terminal 101 obtains a task to be tested and displays a corresponding test interface on the mobile terminal 101.
The task to be tested refers to an automated testing task that needs to be executed by the mobile terminal 101, the task may be generated by a user of the mobile terminal through a testing program installed on the mobile terminal and used for automated testing, or the task to be tested is issued through the server 102 in communication connection with the mobile terminal 101, the testing interface is an interface displayed in the process of executing the automated testing on the task to be tested by the mobile terminal, and the mobile terminal 101 can obtain the task to be tested that needs to complete the automated testing and display the corresponding testing interface.
In step S202, the mobile terminal 101 obtains a current step to be tested of the task to be tested and an indicative element corresponding to the current step to be tested, and performs image recognition on the test interface to determine an element on the test interface, which is matched with the indicative element, as a target indicative element.
The indicative elements refer to some design elements displayed on the interface of the mobile terminal 101 for informing, guiding, and indicating a user to implement a certain pre-designed function through the mobile terminal, for example, a call icon displayed in the interface of the mobile terminal 101 may be a part of the indicative elements, the user may enter a dialing interface of a phone call by clicking the call icon, and for a play button displayed under a video play interface of the mobile terminal 101, the user may also be a part of the indicative elements, and the user may play a video by clicking the play button, and so on.
Specifically, after the mobile terminal 101 obtains the task to be tested, the current step to be tested may be determined first, and one task to be tested may include a plurality of steps to be tested, for example, for the mobile phone call function of the mobile terminal to be tested, the mobile phone call function needs to include a plurality of testing steps, the mobile phone number input is completed first, and the dial button is clicked to complete the dialing, so for the task to be tested, the current step to be tested and only the sexual element corresponding to the current step to be tested need to be determined first. If the current step to be tested needs to enter the dialing interface of the mobile phone, the corresponding indicative element is an icon of a certain mobile phone style, and if the current step to be tested needs to complete the input of the mobile phone number, the corresponding indicative element can be various number keys.
Because various indicative elements may be displayed on the interface of the mobile terminal 101, including a mobile phone style icon entering a dialing interface, or an information style icon entering a short message input interface, and the like, the mobile terminal 101 needs to first determine the indicative element corresponding to the current step to be tested, and determine an element matching the indicative element on the test interface in an image recognition mode, for example, if the current step to be tested needs to enter the mobile phone dialing interface, the mobile terminal 101 may find the mobile phone style icon in the image recognition mode to serve as the target indicative element.
In step S203, the mobile terminal 101 triggers the target indicative element to execute the current step to be tested.
The mobile terminal 101 finds the target indicative element on the test interface, and may perform a trigger operation on the obtained target indicative element to execute the current step to be tested.
In the automatic testing method for the mobile terminal, the mobile terminal 101 obtains a task to be tested and displays a corresponding testing interface on the mobile terminal; acquiring a current to-be-tested step of a task to be tested and an indicative element corresponding to the current to-be-tested step, and performing image recognition on a test interface to determine an element matched with the indicative element on the test interface as a target indicative element; and triggering a target indicative element and executing the current step to be tested. The mobile terminal automatic test method provided by the disclosure can determine the indicative elements on the test interface in an image recognition mode and trigger the indicative elements to execute the test steps without depending on an operating system interface, so that the compatibility of the automatic test of the mobile terminal can be improved.
In an exemplary embodiment, as shown in fig. 3, in step S202, the mobile terminal 101 performs image recognition on the test interface to determine an element on the test interface, which is matched with the indicative element, as the target indicative element, which may specifically be implemented by the following steps:
in step S301, the mobile terminal 101 obtains test script information matched with the current step to be tested; the test script information has stored therein an element image of at least one indicative element.
The test script information may be an automated test script that is compiled by a user in advance and used for executing different tasks to be tested, and may be stored in the mobile terminal 101 in advance. The different steps to be tested may also correspond to test script information, respectively, and the test script information may be compiled in a manner of triggering an element image of a certain indicative element. After the mobile terminal 101 obtains the current step to be tested, the matched test script information can be obtained according to the current step to be tested, and the element image of the indicative element included in the test script information is read out from the matched test script information.
In step S302, the mobile terminal 101 compares each indicative element on the test interface with the element image by using an image recognition method based on the test script information, and sets the indicative element on the test interface that matches the element image as a target indicative element.
Specifically, after obtaining the test script information, the mobile terminal 101 may compare the element image of the indicative element carried in the script information with each indicative element on the test interface one by one, and find the indicative element on the test interface that matches the element image, as the target indicative element. For example, if a test for entering a mobile phone dialing interface needs to be performed, a user may write script information for triggering an indicative element of a mobile phone style icon in advance, and when the test is performed, the mobile terminal 101 may obtain an element image of the mobile phone style icon from the script information, and find an indicative element matched with the element image of the mobile phone style icon on the test interface as a target indicative element in an image recognition matching manner based on the element image.
And, step S203 may include: the mobile terminal 101 acquires a trigger instruction aiming at the element image, which is matched with the current step to be tested, based on the test script information; and triggering the target indicative element by using the trigger instruction, and executing the current step to be tested.
The trigger instruction is an instruction for triggering an indicative element displayed on the mobile terminal 101, and may include multiple types, for example, drag and drop, click, long press, and the like for the indicative element, and the test script information may store multiple types of trigger instructions for an element image of the indicative element, and the trigger instructions are respectively used for executing different steps to be tested. Specifically, after obtaining the test script information, the mobile terminal 101 may read a trigger instruction for the element image in the current test step from the test script information, perform a trigger operation on the target indicative element by using the trigger instruction, and execute the current step to be tested.
Further, the mobile terminal 101 triggers the target indicative element by using the trigger instruction, and executes the current step to be tested, which may further include: the mobile terminal 101 acquires the image position of the element image of the target indicative element in the test interface; a trigger instruction is implemented in the image location to perform the current step to be tested.
The image position refers to an image position of an element image of the target indicative element on the mobile terminal 101, which is displayed on the corresponding test interface, and may be represented by coordinate position information. Specifically, after the mobile terminal 101 obtains the element image of the target indicative element through an image recognition method, the mobile terminal 101 may simultaneously record the coordinate position information of the element image in the test interface as the image position of the target indicative element, and implement the trigger instruction obtained by the mobile terminal 101 in the image position, so as to execute the current step to be tested.
In the above embodiment, the mobile terminal 101 may perform image recognition on the target indicative element based on the element image of the indicative element in the test script information to obtain an image position of the target indicative element in the test interface, and implement a trigger instruction matched with the test script information at the position to execute the current step to be tested, so that the stability and accuracy of the automatic test of the mobile terminal may be improved while the automatic test is completed without depending on an operating system interface to ensure compatibility.
In an exemplary embodiment, the task to be tested includes a plurality of steps to be tested, as shown in fig. 4, after step S203, the mobile terminal automated testing method may further include the steps of:
in step S401, the mobile terminal 101 displays an execution interface after executing the current step to be tested on the mobile terminal 101.
For example, as shown in fig. 5, in the process of automatically testing the mobile phone dialing, if the current step to be tested enters the mobile phone dialing interface by clicking the indicative element triggering the mobile phone style icon, the mobile phone dialing interface is the execution interface after the current step to be tested, and if the current step to be tested enters the mobile phone calling interface by clicking the indicative element triggering the mobile phone style icon, the mobile phone calling interface is the execution interface after the current step to be tested. Specifically, after the mobile terminal 101 executes the current step to be tested, the test interface displayed by the mobile terminal 101 may be switched to the execution interface displayed after the current step to be tested is executed.
In step S402, if the current step to be tested is not the last step to be tested, the mobile terminal 101 determines the test result of the current step to be tested based on the execution interface; the last step to be tested is the last step to be tested in the task to be tested.
The last testing step refers to the last testing step of the mobile terminal 101 in the whole task to be tested. Specifically, the mobile terminal 101 may determine whether the current step to be tested is the last step to be tested in the entire task to be tested, and then the mobile terminal 101 may determine whether the test result is successful according to the displayed execution interface, and if an indicative element triggering the mobile phone style icon appears but the short message input interface is entered, the test is failed, and if a dial input interface appears, the test is successful, and after the mobile terminal 101 executes each current step to be tested, the test result of the current step to be tested may be determined according to the displayed execution interface.
In step S403, if the test result of the current step to be tested is successful, the mobile terminal 101 uses the execution interface as the test interface of the next step to be tested.
Because the current step to be tested is not the last step to be tested in the task to be tested by the mobile terminal, after the execution of the test step is completed to obtain the execution interface, if the test result of the current step to be tested is judged to be successful, the next step to be tested needs to be continuously executed until the current step to be tested is the last step to be tested, and meanwhile, the obtained execution interface can also be used as the test interface of the next step to be tested to continuously execute the next step to be tested.
If the test result of the current step to be tested obtained in step S402 is a test failure, the mobile terminal 101 uploads the test result of the current step to be tested to the first server.
The first server is a platform server for storing an automated test result of the mobile terminal 101, and may be a part of the server 102, and when the test result of the mobile terminal 101 in the current step to be tested is a test failure, the test failure result may be uploaded to the first server for storage, and the first server may display the automated test result and a corresponding progress of the automated test.
In addition, if the current step to be tested is the last step to be tested, the mobile terminal 101 uses the test result of the current step to be tested as the test result of the task to be tested, and uploads the test result of the task to be tested to the first server.
If the current step to be tested is the last step to be tested, that is, after the current step to be tested is completed, the task to be tested of the mobile terminal 101 is also completed, the mobile terminal 101 may use the test result of the current step to be tested as the test result of the whole task to be tested, if the test result of the current step to be tested is successful, it indicates that the test result of the whole task to be tested is also successful, and if the test result of the current step to be tested is failed, it may also indicate that the test result of the whole task to be tested is failed, and the terminal may also upload the obtained test result of the task to be tested to the first server for storing the test result.
Meanwhile, the present embodiment may further include: the mobile terminal 101 uploads the image of the test interface and the image of the execution interface to the second server for storage.
The second server is mainly a cloud server for storing test files generated in the process of the automated test, such as a server for testing pictures, and may also be one of the components in the server 102. After the mobile terminal 101 finishes executing the current step to be tested to obtain the execution interface, the image of the test interface and the image of the execution interface, such as the screenshot of the test interface and the execution interface, may be uploaded to the second server for storage.
In the above embodiment, the mobile terminal 101 may use the execution interface obtained after executing the current step to be tested as the test interface corresponding to the next step to be tested, which may ensure the continuity of the automated test process, and in addition, may obtain the test result of the current step to be tested according to the obtained execution interface, and upload the test result and the execution interface obtained in the test process to the first server and the second server respectively for storage, so as to improve the traceability of the automated test result of the mobile terminal 101.
In an exemplary embodiment, as shown in fig. 6, step S201 may be specifically implemented by the following steps:
in step S601, the mobile terminal 101 receives a task to be tested from the third server.
The third server may be a task management platform for distributing tasks to be tested, may be used for managing one or more mobile terminals 101 for performing automated testing, and may also be a component of the server 102. Specifically, the third server may send a preconfigured automated testing task to the mobile terminal 101 as a task to be tested, and the mobile terminal 101 may execute an automated test according to the received task to be tested.
In step S602, the mobile terminal 101 determines a target template to be tested corresponding to the task to be tested from a plurality of preset templates to be tested according to the task to be tested.
The template to be tested may be a plurality of templates, which may be preset by a user, and respectively correspond to the automated tests executed in different application scenarios in different application software, for example, the template to be tested may include: the system comprises a template A to be tested, a template B to be tested and a template C to be tested, wherein the template A to be tested corresponds to an automatic test flow which needs to be executed by application software A under a scene 1, the template B to be tested corresponds to an automatic test flow which needs to be executed by the application software A under a scene 2, and the template C to be tested can be an automatic test flow which needs to be executed by the application software C under the scene 1. The user may configure a plurality of templates to be tested in advance for the mobile terminal 101, and after the mobile terminal 101 obtains a task to be tested sent by the third server, a template to be tested corresponding to the obtained test task may be obtained from the stored plurality of templates to be tested, and the obtained template to be tested is used as a target template to be tested.
In step S603, the mobile terminal 101 determines a test interface corresponding to the task to be tested and a step to be tested according to the target template to be tested, and displays the corresponding test interface.
After the mobile terminal 101 obtains the target template to be tested, it can determine the corresponding test interface according to the target template to be tested and display the test interface when the current step to be tested is performed. For example, the target template to be tested is an application scenario of the mobile terminal calling program for dialing from the desktop, then the mobile terminal 101 may determine and display the desktop of the mobile terminal 101 as a test interface according to the target template to be tested, and determine that the current step to be tested enters the dialing interface of the mobile phone by triggering an indicative element of the mobile phone style icon.
In the above embodiment, the mobile terminal 101 may pre-configure a plurality of templates to be tested, and after receiving the task to be tested from the third server, the mobile terminal may directly find the corresponding target template to be tested from the pre-stored templates to be tested, and display the corresponding test interface and obtain the current step to be tested, so that the efficiency of the automated test of the mobile terminal may be improved, and at the same time, when the process of the automated test needs to be modified, the whole test process does not need to be modified, and the expansibility of the automated test process of the mobile terminal may be further improved.
Fig. 7 is a flowchart illustrating a mobile terminal automated testing method according to an exemplary embodiment, where as shown in fig. 7, the mobile terminal automated testing method is used in the mobile terminal 101, and includes the following steps.
In step S701, the mobile terminal 101 receives a task to be tested from the third server; according to the task to be tested, determining a target template to be tested corresponding to the task to be tested from a plurality of preset templates to be tested;
in step S702, the mobile terminal 101 determines a test interface corresponding to the task to be tested and a step to be tested according to the target template to be tested, and displays the corresponding test interface;
in step S703, the mobile terminal 101 obtains test script information matched with the current step to be tested; the test script information stores an element image of at least one indicative element;
in step S704, the mobile terminal 101 compares each indicative element on the test interface with the element image in an image recognition manner based on the test script information, and uses the indicative element matched with the element image on the test interface as a target indicative element;
in step S705, the mobile terminal 101 obtains, based on the test script information, a trigger instruction for the elemental image, which is matched with the current step to be tested;
in step S706, the mobile terminal 101 obtains an image position of an element image of the target indicative element in the test interface; implementing a trigger instruction in the image position to execute the current step to be tested; displaying an execution interface after executing the current step to be tested on the mobile terminal 101; uploading the tested interface and the execution interface to a second server for storage in an image form;
in step S707, if the current step to be tested is not the last step to be tested, the mobile terminal 101 determines a test result of the current step to be tested based on the execution interface; the last step to be tested is the last step to be tested in the task to be tested;
in step S708, if the test result of the current step to be tested is successful, the mobile terminal 101 uses the execution interface as the test interface of the next step to be tested;
in step S709, if the current step to be tested is the last step to be tested, the mobile terminal 101 uses the test result of the current step to be tested as the test result of the task to be tested, and uploads the test result of the task to be tested to the first server.
In the above embodiment, the mobile terminal 101 may determine and trigger the indicative element on the test interface in an image recognition manner to execute the test step, without depending on an operating system interface, so that compatibility of an automated test of the mobile terminal may be improved, and perform image recognition on the target indicative element to obtain an image position of the target indicative element in the test interface, and trigger a trigger instruction matched with the test script information at the position to execute the current step to be tested, so as to improve stability and accuracy of the automated test of the mobile terminal. Meanwhile, an execution interface obtained after the current step to be tested is executed can be used as a test interface corresponding to the next step to be tested, so that the continuity of the automatic test process is ensured, the test result and the execution interface obtained in the test process are uploaded to the first server and the second server respectively for storage, and the traceability of the automatic test result of the mobile terminal 101 can be improved. Finally, a plurality of templates to be tested can be configured in advance, the efficiency of the automatic test of the mobile terminal can be improved, and meanwhile, when the process of the automatic test needs to be modified, the whole test flow does not need to be modified by only modifying the templates to be tested, so that the expansibility of the automatic test process of the mobile terminal is further improved.
In an exemplary embodiment, there is also provided a mobile terminal automation test method, which may be applied to test an application using a hybrid stack technology, as shown in fig. 8, and the method may include the following steps:
step a: the task management platform issues a test task to the test node;
step b: the test node receives the task list and runs a test script to circularly consume the test task;
step c: the testing node tests according to the testing task, by capturing a screen of the current equipment and using an image recognition algorithm to dynamically acquire indicative elements such as buttons, pictures, progress and the like, finds the positions of the indicative elements by using the pre-acquired indicative elements for generating key steps on the automatic link, and operates the indicative elements;
step d: the test node collects the automatic test results, the process, the result file and the like to a reporting platform;
step e: and after all task lists are processed, the task management platform can display the total task progress and results.
The automatic test method for the mobile terminal can realize the normal operation of the automatic test of the equipment of different brands, different resolutions and different systems, thereby improving the compatibility and stability of the automatic test scheme for the mobile terminal.
It should be understood that, although the steps in the flowcharts of the present disclosure are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in the figures may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the steps or stages is not necessarily sequential, but may be performed alternately or in alternation with other steps or at least some of the other steps or stages.
Fig. 9 is a block diagram of an automated testing apparatus for a mobile terminal according to an exemplary embodiment. Referring to fig. 9, the apparatus includes a test task acquiring unit 901, an indication element determining unit 902, and a test step executing unit 903.
The test task obtaining unit 901 is configured to execute obtaining of a task to be tested and display a corresponding test interface on the mobile terminal;
an indicating element determining unit 902, configured to perform obtaining a current to-be-tested step of a task to be tested and an indicating element corresponding to the current to-be-tested step, and perform image recognition on a test interface to determine an element on the test interface, which is matched with the indicating element, as a target indicating element;
a test step execution unit 903 configured to execute the trigger target indicative element, executing the current step to be tested.
In an exemplary embodiment, the indication element determining unit 902 is further configured to perform obtaining test script information matching the current step to be tested; the test script information stores an element image of at least one indicative element; and comparing each indicative element on the test interface with the element image in an image recognition mode based on the test script information, and taking the indicative element matched with the element image on the test interface as a target indicative element.
In an exemplary embodiment, the test step executing unit 903 is further configured to execute a trigger instruction for the element image, which is matched with the current step to be tested, based on the test script information; and triggering the target indicative element by using the trigger instruction, and executing the current step to be tested.
In an exemplary embodiment, the testing step executing unit 903 is further configured to obtain an image position of an element image of the target indicative element in the test interface; implementing the triggering instruction in the image position to execute the current step to be tested.
In an exemplary embodiment, the task to be tested includes a plurality of steps to be tested; remove end automatic testing arrangement still includes: the execution interface switching unit is configured to execute the execution interface which is displayed on the mobile terminal after the current step to be tested is executed; if the current step to be tested is not the last step to be tested, determining a test result of the current step to be tested based on the execution interface; the last step to be tested is the last step to be tested in the task to be tested; and if the test result of the current step to be tested is successful, taking the execution interface as the test interface of the next step to be tested.
In an exemplary embodiment, the mobile terminal automated testing device further includes: and the test result uploading module is configured to upload the test result of the current step to be tested to the first server if the test result of the current step to be tested is a test failure.
In an exemplary embodiment, the test result uploading module is further configured to execute, if the current step to be tested is the last step to be tested, taking the test result of the current step to be tested as the test result of the task to be tested, and uploading the test result of the task to be tested to the first server.
In an exemplary embodiment, the mobile terminal automated testing device further includes: and the test image uploading module is configured to upload the image of the test interface and the image of the execution interface to a second server for storage.
In an exemplary embodiment, the test task obtaining unit 901 is further configured to execute receiving a task to be tested from a third server; according to the task to be tested, determining a target template to be tested corresponding to the task to be tested from a plurality of preset templates to be tested; and determining a test interface corresponding to the task to be tested and a step to be tested according to the target template to be tested, and displaying the corresponding test interface.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 10 is a block diagram illustrating an apparatus 1000 for mobile-side automated testing, according to an example embodiment. For example, the device 1000 may be a mobile phone.
Referring to fig. 10, device 1000 may include one or more of the following components: processing component 1002, memory 1004, power component 1006, multimedia component 1008, audio component 1010, interface to input/output (I/O) 1012, sensor component 1014, and communications component 1016.
The processing component 1002 generally controls the overall operation of the device 1000, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 1002 may include one or more processors 1020 to execute instructions to perform all or a portion of the steps of the methods described above. Further, processing component 1002 may include one or more modules that facilitate interaction between processing component 1002 and other components. For example, the processing component 1002 may include a multimedia module to facilitate interaction between the multimedia component 1008 and the processing component 1002.
The memory 1004 is configured to store various types of data to support operation at the device 1000. Examples of such data include instructions for any application or method operating on device 1000, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1004 may be implemented by any type or combination of volatile or non-volatile storage devices, 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 memory, flash memory, magnetic or optical disks.
The power supply component 1006 provides power to the various components of the device 1000. The power components 1006 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 1000.
The multimedia component 1008 includes a screen that provides an output interface between the device 1000 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1008 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 1000 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 1010 is configured to output and/or input audio signals. For example, the audio component 1010 may include a Microphone (MIC) configured to receive external audio signals when the device 1000 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 1004 or transmitted via the communication component 1016. In some embodiments, audio component 1010 also includes a speaker for outputting audio signals.
I/O interface 1012 provides an interface between processing component 1002 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1014 includes one or more sensors for providing status assessment of various aspects of the device 1000. For example, sensor assembly 1014 may detect the open/closed status of device 1000, the relative positioning of components, such as a display and keypad of device 1000, the change in position of device 1000 or a component of device 1000, the presence or absence of user contact with device 1000, the orientation or acceleration/deceleration of device 1000, and the change in temperature of device 1000. The sensor assembly 1014 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1014 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1014 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
Communications component 1016 is configured to facilitate communications between device 1000 and other devices in a wired or wireless manner. The device 1000 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 1016 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 1016 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the device 1000 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 1004 comprising instructions, executable by the processor 1020 of the device 1000 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. An automated testing method for a mobile terminal, comprising:
acquiring a task to be tested and displaying a corresponding test interface on a mobile terminal;
acquiring a current to-be-tested step of the task to be tested and an indicative element corresponding to the current to-be-tested step, and performing image recognition on the test interface to determine an element matched with the indicative element on the test interface as a target indicative element;
and triggering the target indicative element and executing the current step to be tested.
2. The method according to claim 1, wherein the image recognition of the test interface to determine an element on the test interface matching the indicative element as a target indicative element comprises:
acquiring test script information matched with the current step to be tested; the test script information stores an element image of at least one indicative element;
and comparing each indicative element on the test interface with the element image in the image recognition mode based on the test script information, and taking the indicative element matched with the element image on the test interface as the target indicative element.
3. The method according to claim 2, wherein the triggering the target indicative element to perform the current step to be tested comprises:
acquiring a trigger instruction aiming at the element image matched with the current step to be tested based on the test script information;
triggering the target indicative element by using the trigger instruction, and executing the current step to be tested.
4. The method according to claim 3, wherein the triggering the target indicative element with the triggering instruction, and executing the current step to be tested, comprises:
acquiring the image position of the element image of the target indicative element in the test interface;
implementing the trigger instruction in the image location to perform the current step to be tested.
5. The mobile-end automated testing method according to claim 1, wherein the task to be tested comprises a plurality of steps to be tested; after the step of executing the current step to be tested, the method further comprises the following steps:
displaying an execution interface after the current step to be tested is executed on the mobile terminal;
if the current step to be tested is not the last step to be tested, determining a test result of the current step to be tested based on the execution interface; the last step to be tested is the last step to be tested in the task to be tested;
and if the test result of the current step to be tested is successful, taking the execution interface as the test interface of the next step to be tested.
6. The mobile-side automated testing method according to claim 5, further comprising:
and if the test result of the current step to be tested is test failure, uploading the test result of the current step to be tested to a first server.
7. The method according to any one of claims 1 to 6, wherein the obtaining of the task to be tested and the displaying of the corresponding test interface on the mobile terminal comprises:
receiving the task to be tested from a third server;
determining a target to-be-tested template corresponding to the to-be-tested task from a plurality of preset to-be-tested templates according to the to-be-tested task;
and determining a test interface corresponding to the task to be tested and a step to be tested according to the target template to be tested, and displaying the corresponding test interface.
8. The utility model provides a remove automatic testing arrangement of end which characterized in that includes:
the test task obtaining unit is configured to execute obtaining of a task to be tested and display of a corresponding test interface on the mobile terminal;
the indicating element determining unit is configured to execute the steps of obtaining the current to-be-tested step of the task to be tested and indicating elements corresponding to the current to-be-tested step, and perform image recognition on the test interface to determine elements matched with the indicating elements on the test interface as target indicating elements;
and the testing step execution unit is configured to trigger the target indicative element and execute the current step to be tested.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the mobile-end automated testing method of any of claims 1 to 7.
10. A storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the mobile-side automated testing method according to any one of claims 1 to 7.
CN202011314392.0A 2020-11-20 2020-11-20 Mobile terminal automatic test method and device, electronic equipment and storage medium Active CN112383661B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011314392.0A CN112383661B (en) 2020-11-20 2020-11-20 Mobile terminal automatic test method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011314392.0A CN112383661B (en) 2020-11-20 2020-11-20 Mobile terminal automatic test method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112383661A true CN112383661A (en) 2021-02-19
CN112383661B CN112383661B (en) 2023-05-02

Family

ID=74587238

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011314392.0A Active CN112383661B (en) 2020-11-20 2020-11-20 Mobile terminal automatic test method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112383661B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821433A (en) * 2021-08-31 2021-12-21 北京百度网讯科技有限公司 Method, device, equipment, medium and product for testing cloud mobile phone application program

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797911A (en) * 2016-09-02 2018-03-13 北京京东尚科信息技术有限公司 Method and apparatus for testing HTTP interface
CN107861862A (en) * 2017-06-27 2018-03-30 陆金所(上海)科技服务有限公司 UI automated testing methods, device and computer-readable recording medium
CN110297758A (en) * 2019-05-20 2019-10-01 深圳壹账通智能科技有限公司 User interface automated testing method, device and computer readable storage medium
CN110413524A (en) * 2019-07-26 2019-11-05 中国工商银行股份有限公司 For generating method and apparatus, the automated testing method of test script
CN111143188A (en) * 2018-11-02 2020-05-12 中移(杭州)信息技术有限公司 Method and equipment for automatically testing application
CN111767228A (en) * 2020-06-30 2020-10-13 平安国际智慧城市科技股份有限公司 Interface testing method, device, equipment and medium based on artificial intelligence
CN111881019A (en) * 2020-07-07 2020-11-03 北京三快在线科技有限公司 User interface testing method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797911A (en) * 2016-09-02 2018-03-13 北京京东尚科信息技术有限公司 Method and apparatus for testing HTTP interface
CN107861862A (en) * 2017-06-27 2018-03-30 陆金所(上海)科技服务有限公司 UI automated testing methods, device and computer-readable recording medium
CN111143188A (en) * 2018-11-02 2020-05-12 中移(杭州)信息技术有限公司 Method and equipment for automatically testing application
CN110297758A (en) * 2019-05-20 2019-10-01 深圳壹账通智能科技有限公司 User interface automated testing method, device and computer readable storage medium
CN110413524A (en) * 2019-07-26 2019-11-05 中国工商银行股份有限公司 For generating method and apparatus, the automated testing method of test script
CN111767228A (en) * 2020-06-30 2020-10-13 平安国际智慧城市科技股份有限公司 Interface testing method, device, equipment and medium based on artificial intelligence
CN111881019A (en) * 2020-07-07 2020-11-03 北京三快在线科技有限公司 User interface testing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821433A (en) * 2021-08-31 2021-12-21 北京百度网讯科技有限公司 Method, device, equipment, medium and product for testing cloud mobile phone application program

Also Published As

Publication number Publication date
CN112383661B (en) 2023-05-02

Similar Documents

Publication Publication Date Title
CN104834559B (en) Notification message display method and device
CN107133352B (en) Photo display method and device
CN106919629B (en) Method and device for realizing information screening in group chat
CN109359056B (en) Application program testing method and device
CN105975156A (en) Application interface display method and device
CN112241361A (en) Test case generation method and device and problem scene automatic reproduction method and device
CN108011990B (en) Contact management method and device
CN107562500B (en) Debugging device, method and equipment
CN113259226A (en) Information synchronization method and device, electronic equipment and storage medium
CN109684112B (en) Program file operation method, device, terminal and storage medium
CN109358788B (en) Interface display method and device and terminal
CN105446854A (en) Power consumption detection method, system, and terminal
CN105554087A (en) Information setting method and device
EP3125514A1 (en) Method and device for state notification
CN116069612A (en) Abnormality positioning method and device and electronic equipment
CN114020615A (en) Method, device, equipment and storage medium for testing remote multi-active financial system
CN112383661B (en) Mobile terminal automatic test method and device, electronic equipment and storage medium
CN106878654B (en) Video communication method and device
CN106528247B (en) Data refreshing method and device
CN106506808B (en) Method and device for prompting communication message
CN112256563A (en) Android application stability testing method and device, electronic equipment and storage medium
CN105094510A (en) Text processing method, device and system
CN106354595B (en) Mobile terminal, hardware component state detection method and device
CN114430370B (en) Method, device, equipment and storage medium for determining network slice
EP3182650A1 (en) Method and apparatus for traffic monitoring

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