CN112905451A - Automatic testing method and device for application program - Google Patents

Automatic testing method and device for application program Download PDF

Info

Publication number
CN112905451A
CN112905451A CN202110142228.4A CN202110142228A CN112905451A CN 112905451 A CN112905451 A CN 112905451A CN 202110142228 A CN202110142228 A CN 202110142228A CN 112905451 A CN112905451 A CN 112905451A
Authority
CN
China
Prior art keywords
interactive visual
target interface
target
visual element
text box
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
CN202110142228.4A
Other languages
Chinese (zh)
Other versions
CN112905451B (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 Co Wheels Technology Co Ltd
Original Assignee
Beijing Co Wheels 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 Co Wheels Technology Co Ltd filed Critical Beijing Co Wheels Technology Co Ltd
Priority to CN202110142228.4A priority Critical patent/CN112905451B/en
Publication of CN112905451A publication Critical patent/CN112905451A/en
Application granted granted Critical
Publication of CN112905451B publication Critical patent/CN112905451B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application discloses an automatic testing method and device for an application program, and relates to the technical field of automatic testing. The method of the present application comprises: step S1: analyzing the first target interface to obtain element related information corresponding to each interactive visual element contained in the first target interface, wherein the first target interface is a user interface currently displayed by the application program to be tested, and the element related information corresponding to the interactive visual elements comprises the following steps: interacting unique identification and position information corresponding to the visual elements; step S2: placing unique identifiers corresponding to a plurality of interactive visual elements into a first element array according to a random sequence; step S3: and sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element. The method and the device are suitable for the process of testing the functions of the interactive visual elements in the user interface of the application program.

Description

Automatic testing method and device for application program
Technical Field
The present application relates to the field of automated testing technologies, and in particular, to an automated testing method and apparatus for an application program.
Background
The application program test is an indispensable part in the application program development process, and aims to find the defects in the application program, so that the development cost and the maintenance cost of the application program are reduced, and the quality of the application program is promoted. Among the various types of application tests, the application test that is closest to the user's needs is to test the functionality of multiple interactive visual elements in the application user interface.
Currently, in order to simulate different operation logics of different users, the functions of multiple interactive visual elements in an application program user interface are tested by randomly clicking in the user interface. However, in the process of randomly clicking in the user interface, there is a certain probability that the interactive visual elements in the user interface cannot be clicked, so that the efficiency of testing the functions of the interactive visual elements in the application user interface is low.
Disclosure of Invention
The embodiment of the application provides an automatic testing method and device for an application program, and mainly aims to improve the testing efficiency of testing the functions of a plurality of interactive visual elements in a user interface of the application program.
In order to solve the above technical problem, an embodiment of the present application provides the following technical solutions:
in a first aspect, the present application provides a method for automatically testing an application program, the method comprising:
step S1: analyzing a first target interface to obtain element related information corresponding to each interactive visual element included in the first target interface, wherein the first target interface is a user interface currently displayed by an application program to be tested, and the element related information corresponding to the interactive visual elements comprises: unique identification and position information corresponding to the interactive visual elements;
step S2: placing the unique identifiers corresponding to the interactive visual elements into a first element array according to a random sequence;
step S3: and sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
Optionally, in step S1: analyzing a first target interface to obtain element related information corresponding to each interactive visual element contained in the first target interface, including:
analyzing the first target interface through a target interface to obtain element related information corresponding to each visual element contained in the first target interface, wherein the target interface is an automatic test framework interface, and the element related information corresponding to the visual element includes: attribute information, a unique identifier and position information corresponding to the visual element, wherein the attribute information corresponding to the visual element is used for marking the category of the visual element;
and determining a plurality of interactive visual elements contained in the first target interface according to the attribute information corresponding to each visual element.
Optionally, the interactive visual element is an interactive picture element, a button element, or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface comprises the following steps:
when the currently clicked interactive visual element is an input text box element, acquiring a plurality of preset text data meeting an input rule corresponding to the input text box element from a preset text array;
selecting target preset text data from the preset text data;
and inputting the target preset text data into the input text box element.
Optionally, the interactive visual element is an interactive picture element, a button element, or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface comprises the following steps:
determining a plurality of input text box elements contained in the first target interface;
acquiring a plurality of preset text data meeting the input rule corresponding to each input text box element from a preset text array;
arranging and combining a plurality of preset text data corresponding to each input text box element to generate a plurality of data sets, wherein each data set comprises one preset text data corresponding to each input text box element;
selecting a target data set from a plurality of data sets;
when the currently clicked interactive visual element is an input text box element, extracting target preset text data corresponding to the input text box element from the target data set, and inputting the target preset text data into the input text box element.
Optionally, in the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, after each interactive visual element is clicked in the first target interface in sequence, the method further comprises the following steps:
step S4: receiving verification information fed back by a server;
step S5: determining whether target preset text data input to each input text box element is legal or not according to the verification information; if the user interface is legal, jumping to a second target interface, and carrying out automatic testing on a plurality of interactive visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface; if not, go to step S6;
step S6: acquiring the number of trial and error times corresponding to the first target interface, and judging whether the number of trial and error times corresponding to the first target interface is smaller than a preset trial and error time threshold value corresponding to the first target interface; and if the trial-and-error times corresponding to the first target interface are smaller than the preset trial-and-error times threshold corresponding to the first target interface, updating the trial-and-error times corresponding to the first target interface, emptying the first element array, and returning to the step S2.
Optionally, the method further includes:
step S7: if the trial-and-error times corresponding to the first target interface are judged to be larger than or equal to the preset trial-and-error time threshold corresponding to the first target interface, acquiring the priority corresponding to each interactive visual element, and putting the unique identifiers corresponding to the interactive visual elements into a second element array according to the priority corresponding to each interactive visual element;
step S8: according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface;
step S9: receiving verification information fed back by a server;
step S10: determining whether target preset text data input to each input text box element is legal or not according to the verification information; if the interactive visual elements are legal, jumping to the second target interface, and carrying out automatic testing on the interactive visual elements in the second target interface; if not, the process returns to step S8.
Optionally, the method further includes:
and generating a test log and storing the test log into a local storage space.
In a second aspect, the present application further provides an apparatus for automated testing of an application, the apparatus comprising:
the analysis unit is configured to analyze a first target interface to obtain element-related information corresponding to each interactive visual element included in the first target interface, where the first target interface is a user interface currently displayed by an application to be tested, and the element-related information corresponding to the interactive visual element includes: unique identification and position information corresponding to the interactive visual elements;
the first putting unit is used for putting the unique identifiers corresponding to the interactive visual elements into a first element array according to a random sequence;
and the first clicking unit is used for sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
Optionally, the parsing unit includes:
an analysis module, configured to analyze the first target interface through a target interface to obtain element-related information corresponding to each visual element included in the first target interface, where the target interface is an automatic test framework interface, and the element-related information corresponding to the visual element includes: attribute information, a unique identifier and position information corresponding to the visual element, wherein the attribute information corresponding to the visual element is used for marking the category of the visual element;
and the first determining module is used for determining a plurality of interactive visual elements contained in the first target interface according to the attribute information corresponding to each visual element.
Optionally, the interactive visual element is an interactive picture element, a button element, or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the first click unit includes:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a plurality of preset text data meeting an input rule corresponding to an input text box element from a preset text array when a currently clicked interactive visual element is the input text box element;
the first selection module is used for selecting target preset text data from the preset text data;
and the first input module is used for inputting the target preset text data into the input text box element.
Optionally, the interactive visual element is an interactive picture element, a button element, or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the first click unit includes:
a second determination module to determine a plurality of input text box elements included in the first target interface;
the second acquisition module is used for acquiring a plurality of preset text data meeting the input rule corresponding to each input text box element from a preset text array;
the processing module is used for carrying out permutation and combination processing on a plurality of preset text data corresponding to each input text box element to generate a plurality of data sets, wherein each data set comprises one preset text data corresponding to each input text box element;
a second selection module, configured to select a target data set from the plurality of data sets;
and the second input module is used for extracting target preset text data corresponding to the input text box element from the target data set and inputting the target preset text data into the input text box element when the currently clicked interactive visual element is the input text box element.
Optionally, the apparatus further comprises:
the first receiving unit is used for receiving verification information fed back by a server after the first clicking unit sequentially clicks each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element;
a first determining unit configured to determine whether target preset text data input to each of the input text box elements is legal or not according to the verification information; when the target preset text data input to each input text box element is determined to be legal, jumping to a second target interface, and performing automatic testing on a plurality of interactive visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface;
the judging unit is used for acquiring the number of trial and error times corresponding to the first target interface when the target preset text data input to any one input text box element is determined to be illegal, and judging whether the number of trial and error times corresponding to the first target interface is smaller than a preset threshold value of the number of trial and error times corresponding to the first target interface or not; and when the trial-and-error times corresponding to the first target interface are judged to be smaller than the preset trial-and-error time threshold corresponding to the first target interface, updating the trial-and-error times corresponding to the first target interface, emptying the first element array, and controlling the first putting unit and the first clicking unit to automatically test the plurality of interactive visual elements in the first target interface again.
Optionally, the apparatus further comprises:
the second input unit is used for acquiring the priority corresponding to each interactive visual element when the judging unit judges that the trial-and-error times corresponding to the first target interface are greater than or equal to a preset trial-and-error time threshold corresponding to the first target interface, and inputting the unique identifiers corresponding to the interactive visual elements into a second element array according to the priority corresponding to each interactive visual element;
the second clicking unit is used for sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array and the position information corresponding to each interactive visual element;
the second receiving unit is used for receiving the verification information fed back by the server;
a second determining unit, configured to determine whether target preset text data input to each of the input text box elements is legal according to the verification information; when the target preset text data input to each input text box element is determined to be legal, jumping to a second target interface, and carrying out automatic testing on a plurality of interactive visual elements in the second target interface; and when the target preset text data input to any one of the input text box elements is determined to be illegal, controlling the second clicking unit to automatically test the plurality of interactive visual elements in the first target interface again.
Optionally, the apparatus further comprises:
and the storage unit is used for generating a test log and storing the test log into a local storage space.
In a third aspect, an embodiment of the present application provides a storage medium, where the storage medium includes a stored program, and when the program runs, a device on which the storage medium is located is controlled to execute the automated testing method for the application program according to the first aspect.
In a fourth aspect, embodiments of the present application provide an apparatus for automated testing of an application, the apparatus comprising a storage medium; and one or more processors, the storage medium coupled with the processors, the processors configured to execute program instructions stored in the storage medium; the program instructions when executed perform the method for automated testing of an application program of the first aspect.
By means of the technical scheme, the technical scheme provided by the application at least has the following advantages:
the application provides an automatic testing method and device of an application program, after a target terminal device analyzes and obtains a unique identifier and position information corresponding to each interactive visual element contained in a user interface to be tested (namely a first target interface) of the application program to be tested, the target terminal device puts the unique identifications corresponding to the interactive visual elements into a first element array according to a random sequence, determining the position of each interactive visual element in the first target interface according to the position information corresponding to each interactive visual element, determining the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array, and clicking each interactive visual element in the first target interface in sequence, thereby realizing that the interactive visual elements contained in the first target interface are clicked in a random order. Because the unique identifiers corresponding to the interactive visual elements are repeatedly placed into the first element array according to the random sequence, and each interactive visual element is sequentially clicked in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface, different operation logics of different users can be simulated, namely, the simulation of clicking the interactive visual elements contained in the first target interface according to different sequences is realized; moreover, one interactive visual element in the first target interface can be clicked by the target terminal device in each click operation, so that the test efficiency of testing the functions of a plurality of interactive visual elements in the user interface to be tested of the application program to be tested can be effectively improved.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present application will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the present application are illustrated by way of example and not by way of limitation in the figures of the accompanying drawings and in which like reference numerals refer to similar or corresponding parts and in which:
FIG. 1 is a flowchart illustrating an automated testing method for an application according to an embodiment of the present disclosure;
FIG. 2 is a flow chart of another method for automated testing of an application provided by an embodiment of the present application;
FIG. 3 is a block diagram illustrating an apparatus for automated testing of an application according to an embodiment of the present disclosure;
fig. 4 shows a block diagram of an automated testing apparatus for another application provided in the embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which this application belongs.
An embodiment of the present application provides an automated testing method for an application program, as shown in fig. 1, the method includes:
101. and analyzing the first target interface to obtain element related information corresponding to each interactive visual element contained in the first target interface.
The first target interface is a user interface currently displayed by the application program to be tested, and the element related information corresponding to the interactive visual elements comprises the following steps: and the position information corresponding to the interactive visual elements is used for indicating the positions of the interactive visual elements in the first target interface.
In this embodiment of the application, the execution subject in each step is a target terminal device for running an application to be tested, and the target terminal device may be, but is not limited to: smart phones, tablet computers, and the like, the operating system of the target terminal device may be, but is not limited to: IOS systems, android systems, and the like.
In the embodiment of the application, when the functions of a plurality of interactive visual elements in a certain user interface of an application program to be tested need to be tested, the application program to be tested is operated in the target terminal equipment, and then the target terminal equipment is controlled to output and display the user interface to be tested, namely the target terminal equipment is controlled to output and display a first target interface; after the first target interface is output and displayed, the target terminal device can analyze the first target interface, so as to obtain element related information corresponding to each interactive visual element contained in the first target interface, that is, obtain a unique identifier and position information corresponding to each interactive visual element.
102. And placing the unique identifiers corresponding to the interactive visual elements into the first element array according to a random sequence.
In this embodiment of the application, after the target terminal device obtains, through parsing, the unique identifier and the position information corresponding to each interactive visual element included in the first target interface, it is necessary to place, according to a random order, the unique identifiers corresponding to the multiple interactive visual elements into the first element array, so that the subsequent target terminal device sequentially clicks each interactive visual element in the first target interface according to an order of the unique identifier corresponding to each interactive visual element in the first element array, and thus the multiple interactive visual elements included in the first target interface are clicked in the random order.
103. And sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
In the embodiment of the application, after the target terminal device puts the unique identifiers corresponding to the plurality of interactive visual elements included in the first target interface into the first element array according to the random sequence, each interactive visual element can be clicked in sequence in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, firstly, determining the position of each interactive visual element in the first target interface according to the position information corresponding to each interactive visual element, then, according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface, and clicking each interactive visual element in the first target interface in sequence, thereby realizing that the interactive visual elements contained in the first target interface are clicked in a random order.
It should be noted that, by repeating the test methods described in the above steps 102 to 103, different operation logics of different users can be simulated, that is, a plurality of interactive visual elements included in the first target interface are clicked in different orders.
The embodiment of the application provides an automatic testing method for an application program, and after a target terminal device analyzes and obtains a unique identifier and position information corresponding to each interactive visual element included in a user interface to be tested (namely a first target interface) of the application program to be tested, the target terminal device puts the unique identifications corresponding to the interactive visual elements into a first element array according to a random sequence, determining the position of each interactive visual element in the first target interface according to the position information corresponding to each interactive visual element, determining the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array, and clicking each interactive visual element in the first target interface in sequence, thereby realizing that the interactive visual elements contained in the first target interface are clicked in a random order. Because the unique identifiers corresponding to the interactive visual elements are repeatedly placed into the first element array according to the random sequence, and each interactive visual element is sequentially clicked in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface, different operation logics of different users can be simulated, namely, the simulation of clicking the interactive visual elements contained in the first target interface according to different sequences is realized; moreover, one interactive visual element in the first target interface can be clicked by the target terminal device in each click operation, so that the test efficiency of testing the functions of a plurality of interactive visual elements in the user interface to be tested of the application program to be tested can be effectively improved.
For the purpose of more detailed description, the embodiment of the present application provides another automated testing of an application program, specifically as shown in fig. 2, the method includes:
201. and analyzing the first target interface to obtain element related information corresponding to each interactive visual element contained in the first target interface.
In the embodiment of the application, when the functions of a plurality of interactive visual elements in a certain user interface of an application program to be tested need to be tested, the application program to be tested is operated in the target terminal equipment, and then the target terminal equipment is controlled to output and display the user interface to be tested, namely the target terminal equipment is controlled to output and display a first target interface; after the first target interface is output and displayed, the target terminal device can analyze the first target interface, so as to obtain element related information corresponding to each interactive visual element contained in the first target interface, that is, obtain a unique identifier and position information corresponding to each interactive visual element. In the following, how the target terminal device parses the first target interface to obtain the element-related information corresponding to each interactive visual element included in the first target interface will be described in detail.
(1) And analyzing the first target interface through the target interface to obtain element related information corresponding to each visual element contained in the first target interface.
Wherein, the target interface is an automatic test frame interface; wherein, the element related information corresponding to the visual element comprises: attribute information, a unique identifier and position information corresponding to the visual elements, wherein the attribute information corresponding to the visual elements is used for marking the categories of the visual elements;
in this embodiment of the application, the target terminal device first needs to analyze the first target interface through the target interface (i.e., the automatic test framework interface), so as to obtain element-related information corresponding to each visual element included in the first target interface, that is, obtain attribute information, unique identifier, and location information corresponding to each visual element.
(2) And determining a plurality of interactive visual elements contained in the first target interface according to the attribute information corresponding to each visual element.
In this embodiment of the application, after obtaining the attribute information, the unique identifier, and the location information corresponding to each visual element included in the first target interface, the target terminal device may determine which visual element or visual elements are interactive visual elements according to the attribute information corresponding to each visual element, thereby determining a plurality of interactive visual elements included in the first target interface, and further achieving obtaining the unique identifier and the location information corresponding to each interactive visual element included in the first target interface.
Specifically, in this step, when the attribute information corresponding to a certain visual element is an interactive picture, a button, or an input text box, it is determined that the visual element is an interactive visual element, but is not limited thereto.
202. And placing the unique identifiers corresponding to the interactive visual elements into the first element array according to a random sequence.
In step 202, the unique identifiers corresponding to the multiple interactive visual elements are placed in the first element array according to a random order, which may refer to the description of the corresponding part in fig. 1, and will not be described again in this embodiment of the present application.
203. And sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
In this embodiment, after the unique identifiers corresponding to the multiple interactive visual elements included in the first target interface are placed in the first element array according to the random sequence, the target terminal device may sequentially click each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, that is, first, according to the position information corresponding to each interactive visual element, determine the position of each interactive visual element in the first target interface, and then sequentially click each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface.
Further, in this embodiment of the application, the interactive visual element may specifically be any one of an interactive picture element, a button element, or an input text box element, and when a certain interactive visual element is an interactive picture element or a button element, the target terminal device does not need to perform additional operations after clicking the interactive visual element; when a certain interactive visual element is an input text box element, after the target terminal device clicks the input text box element, text data needs to be input into the input text box element.
Specifically, in this step, the target terminal device may input text data into the input text box element in the following two ways:
the preset text array comprises a plurality of preset text data, and the preset text data can be specifically as follows: mobile phone number, identification card number, identifying code, etc.; when a certain interactive visual element is an input text box element, the element-related information corresponding to the interactive visual element analyzed in step 201 further includes: the input rule corresponding to the input text box element may be, but is not limited to: the length of the text data is a preset length threshold, the text data is composed of all digits, the text data is composed of all letters, the text data is composed of mixed digits and letters, and the like.
(1) When the currently clicked interactive visual element is determined to be an input text box element, firstly, acquiring a plurality of preset text data meeting an input rule corresponding to the input text box element from a preset text array; secondly, selecting target preset text data from the preset text data; and finally, inputting the target preset text data into the input text box element. The text data can be input into each input text box element in the first target interface in turn according to the method.
It should be noted that, in the actual application process, the specific process of the target terminal device selecting the target preset text data from the preset text data is as follows: sequencing the plurality of preset text data according to the sequence of each preset text data in the preset text array, and selecting the first preset text data in the sequenced plurality of preset text data as target preset text data when carrying out a first round of automatic test; when the second round of automated testing is performed, the second preset text data of the sorted preset text data is selected as the target preset text data …, and so on.
(2) Firstly, determining a plurality of input text box elements contained in a first target interface according to attribute information corresponding to each interactive visual element contained in the first target interface, and acquiring a plurality of preset text data meeting an input rule corresponding to each input text box element from a preset text array; secondly, carrying out permutation and combination processing on a plurality of preset text data corresponding to each input text box element to generate a plurality of data sets, wherein any one data set comprises one preset text data corresponding to each input text box element; then, selecting a target data set from the plurality of data sets; and finally, when the currently clicked interactive visual element is determined to be the input text box element, extracting target preset text data corresponding to the input text box element from the target data set, and inputting the target preset text data into the input text box element. The text data can be input into each input text box element in the first target interface in turn according to the method.
For example, the first target interface includes an input text box element a, an input text box element B, and an input text box element C, preset text data a and B meeting the input rule of the input text box element a, preset text data C meeting the input rule of the input text box element B, and preset text data d and e meeting the input rule of the input text box element C are obtained in a preset text array, and after the preset text data a, the preset text data B, the preset text data C, the preset text data d, and the preset text data e are arranged and combined, a plurality of data sets are obtained: the method comprises the following steps of 1, 2, 3, 4, 1, d, 2, 3, c and e.
It should be noted that, in the actual application process, the specific process of selecting the target data set from the multiple data sets by the target terminal device is as follows: sequencing the plurality of data sets, and selecting a first data set in the sequenced plurality of data sets as a target data set when a first round of automatic test is carried out; when performing a second round of automated testing, a second data set of the ordered plurality of data sets is selected as the target data set …, and so on.
It should be noted that, in the related art, the following are: after the input text box element is clicked, text data is input into the input text box element in a mode of randomly clicking a soft keyboard, so that the high probability that the text data input into the input text box element in the related technical scheme does not meet the input rule corresponding to the input text box element, a large amount of time is consumed for inputting the text data into the input text box element, and the test efficiency of automatic testing is low; but in the embodiment of the application: after the input text box element is clicked, the preset text data meeting the input rule corresponding to the input text box element is obtained from the preset text array, and the obtained preset text data is input into the input text box element, so that a large amount of time is not consumed for inputting the text data into the input text box element, and the test efficiency of the automatic test can be effectively improved.
204. Receiving verification information fed back by the server side, and determining whether target preset text data input to each input text box element is legal or not according to the verification information; if the interactive visual elements are legal, jumping to a second target interface, and carrying out automatic testing on the interactive visual elements in the second target interface; if not, the process proceeds to step 205.
Wherein the second target interface is a next user interface of the first target interface.
In the embodiment of the application, after the target terminal equipment sequentially clicks each interactive visual element and inputs target preset text data to each input text box element, request information containing a plurality of target preset text data is sent to the server side, and after the server side verifies the legality of the plurality of target preset text data, the server side feeds back verification information to the target terminal equipment; after receiving the verification information fed back by the server, the target terminal equipment can determine whether the target preset text data input to each input text box element is legal or not according to the verification information fed back by the server; when the target preset text data input to each input text box element is determined to be legal, the target terminal equipment can control to jump to a second target interface, and according to the test method for automatically testing the interactive visual elements in the first target interface, the interactive visual elements in the second target interface are automatically tested; when it is determined that the target preset text data input to any one of the input text box elements is not legal, step 205 is entered.
205. Acquiring the number of trial and error times corresponding to the first target interface, and judging whether the number of trial and error times corresponding to the first target interface is smaller than a preset trial and error time threshold value corresponding to the first target interface; if yes, updating the trial-and-error times corresponding to the first target interface, emptying the first element array, and returning to the step 202; if not, go to step 206.
The preset trial-and-error number threshold may be, but is not limited to: 30 times, 50 times, 70 times, 100 times, etc.
In the embodiment of the application, when it is determined that target preset text data input to any input text box element is illegal, the target terminal device needs to acquire the number of trial and error times corresponding to the first target interface and judge whether the number of trial and error times corresponding to the first target interface is smaller than a preset threshold value of the number of trial and error times corresponding to the first target interface; when the number of trial and error times corresponding to the first target interface is judged to be smaller than the preset number threshold value of trial and error times corresponding to the first target interface, updating the number of trial and error times corresponding to the first target interface, emptying the first element array, and automatically testing the plurality of interactive visual elements in the first target interface by adopting the testing method recorded in the step 202 and the step 203 again; and when it is determined that the number of trial and error times corresponding to the first target interface is greater than or equal to the preset threshold number of trial and error times corresponding to the first target interface, entering step 206.
It should be noted that, in the actual application process, when it is determined that the target preset text data input to the partial input text box element is legal according to the verification information fed back by the server and the target preset text data input to the partial input text box element is illegal, for the input text box element for which the legal text data is input in the present round of automated testing process, when the target terminal device performs the next round of automated testing, the target preset text data input last time may be input to the input text box elements again, but the present invention is not limited thereto.
206. And acquiring the priority corresponding to each interactive visual element, and placing the unique identifiers corresponding to the interactive visual elements into the second element array according to the priority corresponding to each interactive visual element.
In this embodiment of the application, when it is determined that the trial-and-error number corresponding to the first target interface is greater than or equal to the preset trial-and-error number threshold corresponding to the first target interface, the target terminal device obtains the priority corresponding to each interactive visual element included in the first target interface, and places the unique identifiers corresponding to the multiple interactive visual elements into the second element array according to the priority corresponding to each interactive visual element, so that the subsequent target terminal device can click the multiple interactive visual elements in sequence in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array, thereby achieving the purpose of clicking the multiple interactive visual elements according to the priorities of the multiple interactive visual elements.
Further, in this embodiment of the application, the target terminal device needs to receive, in advance, the priority corresponding to each interactive visual element included in the first target interface input by the test worker, and store the priority corresponding to each interactive visual element in the local storage space, so that the target terminal device can obtain, in the local storage space, the priority corresponding to each interactive visual element included in the first target interface.
207. And sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array and the position information corresponding to each interactive visual element.
In the embodiment of the application, after the target terminal device puts the unique identifiers corresponding to the multiple interactive visual elements into the second element array according to the priority corresponding to each interactive visual element contained in the first target interface, each interactive visual element can be clicked in the first target interface in turn according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array and the position information corresponding to each interactive visual element, firstly, determining the position of each interactive visual element in the first target interface according to the position information corresponding to each interactive visual element, then, according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array and the position of each interactive visual element in the first target interface, and clicking each interactive visual element in the first target interface in sequence, thereby realizing that the interactive visual elements are clicked according to the priority of the interactive visual elements.
Specifically, in this step, when a certain interactive visual element is an interactive picture element or a button element, the target terminal device does not need to perform additional operations after clicking the interactive visual element; when a certain interactive visual element is an input text box element, after clicking the interactive visual element, the target terminal device also needs to input text data into the input text box element, where, with regard to the specific manner in which the target terminal device inputs text data into the input text box element, reference may be made to the description of the corresponding part in step 203, which will not be described herein again in this embodiment of the present application.
208. Receiving verification information fed back by the server side, and determining whether target preset text data input to each input text box element is legal or not according to the verification information; if the interactive visual elements are legal, jumping to a second target interface, and carrying out automatic testing on the interactive visual elements in the second target interface; if not, go back to step 207.
In the embodiment of the application, after the target terminal equipment sequentially clicks each interactive visual element and inputs target preset text data to each input text box element, request information containing a plurality of target preset text data is sent to the server side, and after the server side verifies the legality of the plurality of target preset text data, the server side feeds back verification information to the target terminal equipment; after receiving the verification information fed back by the server, the target terminal equipment can determine whether the target preset text data input to each input text box element is legal or not according to the verification information fed back by the server; when the target preset text data input to each input text box element is determined to be legal, the target terminal equipment can control to jump to a second target interface, and according to the test method for automatically testing the interactive visual elements in the first target interface, the interactive visual elements in the second target interface are automatically tested; and when the target preset text data input to any input text box element is determined to be illegal, automatically testing the plurality of interactive visual elements in the first target interface by adopting the testing method recorded in the step 207 again.
Further, in this embodiment of the application, after completing the automated testing of the interactive visual elements of each user interface in the application to be tested, the target terminal device generates a test log in which the whole automated testing process is recorded, and stores the generated test log in the local storage space, so that a test worker can know the whole automated testing process according to the test log, thereby adjusting and optimizing the interactive visual elements in each user interface in the application to be tested.
Further, as an implementation of the method shown in fig. 1 and fig. 2, another embodiment of the present application further provides an automatic testing apparatus for an application program. The embodiment of the apparatus corresponds to the embodiment of the method, and for convenience of reading, details in the embodiment of the apparatus are not repeated one by one, but it should be clear that the apparatus in the embodiment can correspondingly implement all the contents in the embodiment of the method. The device is applied to improve the test efficiency of testing the functions of a plurality of interactive visual elements in an application program user interface, and specifically as shown in fig. 3, the device comprises:
an analyzing unit 301, configured to analyze a first target interface to obtain element-related information corresponding to each interactive visual element included in the first target interface, where the first target interface is a user interface currently displayed by an application to be tested, and the element-related information corresponding to the interactive visual element includes: unique identification and position information corresponding to the interactive visual elements;
a first placing unit 302, configured to place unique identifiers corresponding to a plurality of interactive visual elements into a first element array according to a random order;
a first clicking unit 303, configured to click each interactive visual element in the first target interface in sequence according to the order of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
Further, as shown in fig. 4, the parsing unit 301 includes:
an analyzing module 3011, configured to analyze the first target interface through a target interface to obtain element-related information corresponding to each visual element included in the first target interface, where the target interface is an automatic test framework interface, and the element-related information corresponding to the visual element includes: attribute information, a unique identifier and position information corresponding to the visual element, wherein the attribute information corresponding to the visual element is used for marking the category of the visual element;
the first determining module 3012 is configured to determine, according to the attribute information corresponding to each visual element, a plurality of interactive visual elements included in the first target interface.
Further, as shown in fig. 4, the interactive visual element is an interactive picture element, a button element, or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the first click unit 303 includes:
a first obtaining module 3031, configured to obtain, when a currently clicked interactive visual element is an input text box element, a plurality of preset text data that meet an input rule corresponding to the input text box element in a preset text array;
a first selecting module 3032, configured to select a target preset text data from the preset text data;
a first input module 3033, configured to input the target preset text data into the input text box element.
Further, as shown in fig. 4, the interactive visual element is an interactive picture element, a button element, or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the first click unit 303 includes:
a second determining module 3034, configured to determine a plurality of input text box elements included in the first target interface;
a second obtaining module 3035, configured to obtain, in a preset text array, a plurality of preset text data that meet an input rule corresponding to each input text box element;
a processing module 3036, configured to perform permutation and combination processing on a plurality of preset text data corresponding to each input text box element to generate a plurality of data sets, where each data set includes one preset text data corresponding to each input text box element;
a second selecting module 3037, configured to select a target data set from the plurality of data sets;
a second input module 3038, configured to, when a currently clicked interactive visual element is an input text box element, extract target preset text data corresponding to the input text box element in the target data set, and input the target preset text data into the input text box element.
Further, as shown in fig. 4, the apparatus further includes:
a first receiving unit 304, configured to receive, by the first clicking unit 303, verification information fed back by the server after each interactive visual element is clicked in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element;
a first determining unit 305 for determining whether target preset text data input to each of the input text box elements is legal or not based on the verification information; when the target preset text data input to each input text box element is determined to be legal, jumping to a second target interface, and performing automatic testing on a plurality of interactive visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface;
a determining unit 306, configured to, when it is determined that target preset text data input to any one of the input text box elements is illegal, obtain trial and error times corresponding to the first target interface, and determine whether the trial and error times corresponding to the first target interface are smaller than a preset trial and error time threshold corresponding to the first target interface; when the trial-and-error times corresponding to the first target interface are judged to be smaller than the preset trial-and-error times threshold corresponding to the first target interface, updating the trial-and-error times corresponding to the first target interface, emptying the first element array, and controlling the first putting unit 302 and the first clicking unit 303 to perform automatic testing on the plurality of interactive visual elements in the first target interface again.
Further, as shown in fig. 4, the apparatus further includes:
a second placing unit 307, configured to, when the determining unit 306 determines that the number of trial and error times corresponding to the first target interface is greater than or equal to a preset threshold of trial and error times corresponding to the first target interface, obtain a priority corresponding to each interactive visual element, and place unique identifiers corresponding to a plurality of interactive visual elements into a second element array according to the priority corresponding to each interactive visual element;
a second clicking unit 308, configured to click, in the first target interface, each interactive visual element in turn according to an order of the unique identifier corresponding to each interactive visual element in the second element array and position information corresponding to each interactive visual element;
a second receiving unit 309, configured to receive verification information fed back by the server;
a second determining unit 310, configured to determine whether the target preset text data input to each of the input text box elements is legal according to the verification information; when the target preset text data input to each input text box element is determined to be legal, jumping to a second target interface, and carrying out automatic testing on a plurality of interactive visual elements in the second target interface; and when determining that the target preset text data input to any one of the input text box elements is illegal, controlling the second clicking unit 308 to automatically test the interactive visual elements in the first target interface again.
Further, as shown in fig. 4, the apparatus further includes:
the storage unit 311 is configured to generate a test log, and store the test log in a local storage space.
The embodiment of the application provides an automatic testing method and device of an application program, and after a target terminal device analyzes and obtains a unique identifier and position information corresponding to each interactive visual element contained in a user interface to be tested (namely a first target interface) of the application program to be tested, the target terminal device puts the unique identifications corresponding to the interactive visual elements into a first element array according to a random sequence, determining the position of each interactive visual element in the first target interface according to the position information corresponding to each interactive visual element, determining the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array, and clicking each interactive visual element in the first target interface in sequence, thereby realizing that the interactive visual elements contained in the first target interface are clicked in a random order. Because the unique identifiers corresponding to the interactive visual elements are repeatedly placed into the first element array according to the random sequence, and each interactive visual element is sequentially clicked in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface, different operation logics of different users can be simulated, namely, the simulation of clicking the interactive visual elements contained in the first target interface according to different sequences is realized; moreover, one interactive visual element in the first target interface can be clicked by the target terminal device in each click operation, so that the test efficiency of testing the functions of a plurality of interactive visual elements in the user interface to be tested of the application program to be tested can be effectively improved.
The automatic testing device of the application program comprises a processor and a memory, wherein the analysis unit, the first putting unit, the first clicking unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the testing efficiency of testing the functions of the interactive visual elements in the user interface of the application program is improved by adjusting the kernel parameters.
The embodiment of the application provides a storage medium, which comprises a stored program, wherein when the program runs, the device where the storage medium is located is controlled to execute the automatic testing method of the application program.
The storage medium may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The embodiment of the application also provides an automatic testing device of the application program, which comprises a storage medium; and one or more processors, the storage medium coupled with the processors, the processors configured to execute program instructions stored in the storage medium; and when the program instruction runs, the automatic testing method of the application program is executed.
The embodiment of the application provides equipment, the equipment comprises a processor, a memory and a program which is stored on the memory and can run on the processor, and the following steps are realized when the processor executes the program:
step S1: analyzing a first target interface to obtain element related information corresponding to each interactive visual element included in the first target interface, wherein the first target interface is a user interface currently displayed by an application program to be tested, and the element related information corresponding to the interactive visual elements comprises: unique identification and position information corresponding to the interactive visual elements;
step S2: placing the unique identifiers corresponding to the interactive visual elements into a first element array according to a random sequence;
step S3: and sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
Further, the step S1: analyzing a first target interface to obtain element related information corresponding to each interactive visual element contained in the first target interface, including:
analyzing the first target interface through a target interface to obtain element related information corresponding to each visual element contained in the first target interface, wherein the target interface is an automatic test framework interface, and the element related information corresponding to the visual element includes: attribute information, a unique identifier and position information corresponding to the visual element, wherein the attribute information corresponding to the visual element is used for marking the category of the visual element;
and determining a plurality of interactive visual elements contained in the first target interface according to the attribute information corresponding to each visual element.
Further, the interactive visual element is an interactive picture element, a button element or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface comprises the following steps:
when the currently clicked interactive visual element is an input text box element, acquiring a plurality of preset text data meeting an input rule corresponding to the input text box element from a preset text array;
selecting target preset text data from the preset text data;
and inputting the target preset text data into the input text box element.
Further, the interactive visual element is an interactive picture element, a button element or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface comprises the following steps:
determining a plurality of input text box elements contained in the first target interface;
acquiring a plurality of preset text data meeting the input rule corresponding to each input text box element from a preset text array;
arranging and combining a plurality of preset text data corresponding to each input text box element to generate a plurality of data sets, wherein each data set comprises one preset text data corresponding to each input text box element;
selecting a target data set from a plurality of data sets;
when the currently clicked interactive visual element is an input text box element, extracting target preset text data corresponding to the input text box element from the target data set, and inputting the target preset text data into the input text box element.
Further, in the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, after each interactive visual element is clicked in the first target interface in sequence, the method further comprises the following steps:
step S4: receiving verification information fed back by a server;
step S5: determining whether target preset text data input to each input text box element is legal or not according to the verification information; if the user interface is legal, jumping to a second target interface, and carrying out automatic testing on a plurality of interactive visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface; if not, go to step S6;
step S6: acquiring the number of trial and error times corresponding to the first target interface, and judging whether the number of trial and error times corresponding to the first target interface is smaller than a preset trial and error time threshold value corresponding to the first target interface; and if the trial-and-error times corresponding to the first target interface are smaller than the preset trial-and-error times threshold corresponding to the first target interface, updating the trial-and-error times corresponding to the first target interface, emptying the first element array, and returning to the step S2.
Further, the method further comprises:
step S7: if the trial-and-error times corresponding to the first target interface are judged to be larger than or equal to the preset trial-and-error time threshold corresponding to the first target interface, acquiring the priority corresponding to each interactive visual element, and putting the unique identifiers corresponding to the interactive visual elements into a second element array according to the priority corresponding to each interactive visual element;
step S8: according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface;
step S9: receiving verification information fed back by a server;
step S10: determining whether target preset text data input to each input text box element is legal or not according to the verification information; if the interactive visual elements are legal, jumping to the second target interface, and carrying out automatic testing on the interactive visual elements in the second target interface; if not, the process returns to step S8.
Further, the method further comprises:
and generating a test log and storing the test log into a local storage space.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device: step S1: analyzing a first target interface to obtain element related information corresponding to each interactive visual element included in the first target interface, wherein the first target interface is a user interface currently displayed by an application program to be tested, and the element related information corresponding to the interactive visual elements comprises: unique identification and position information corresponding to the interactive visual elements; step S2: placing the unique identifiers corresponding to the interactive visual elements into a first element array according to a random sequence; step S3: and sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (16)

1. An automated testing method for an application program, comprising:
step S1: analyzing a first target interface to obtain element related information corresponding to each interactive visual element included in the first target interface, wherein the first target interface is a user interface currently displayed by an application program to be tested, and the element related information corresponding to the interactive visual elements comprises: unique identification and position information corresponding to the interactive visual elements;
step S2: placing the unique identifiers corresponding to the interactive visual elements into a first element array according to a random sequence;
step S3: and sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
2. The method according to claim 1, wherein the step S1: analyzing a first target interface to obtain element related information corresponding to each interactive visual element contained in the first target interface, including:
analyzing the first target interface through a target interface to obtain element related information corresponding to each visual element contained in the first target interface, wherein the target interface is an automatic test framework interface, and the element related information corresponding to the visual element includes: attribute information, a unique identifier and position information corresponding to the visual element, wherein the attribute information corresponding to the visual element is used for marking the category of the visual element;
and determining a plurality of interactive visual elements contained in the first target interface according to the attribute information corresponding to each visual element.
3. The method of claim 2, wherein the interactive visual element is an interactive picture element, a button element or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface comprises the following steps:
when the currently clicked interactive visual element is an input text box element, acquiring a plurality of preset text data meeting an input rule corresponding to the input text box element from a preset text array;
selecting target preset text data from the preset text data;
and inputting the target preset text data into the input text box element.
4. The method of claim 2, wherein the interactive visual element is an interactive picture element, a button element or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further includes: the input rule corresponding to the input text box element; the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface comprises the following steps:
determining a plurality of input text box elements contained in the first target interface;
acquiring a plurality of preset text data meeting the input rule corresponding to each input text box element from a preset text array;
arranging and combining a plurality of preset text data corresponding to each input text box element to generate a plurality of data sets, wherein each data set comprises one preset text data corresponding to each input text box element;
selecting a target data set from a plurality of data sets;
when the currently clicked interactive visual element is an input text box element, extracting target preset text data corresponding to the input text box element from the target data set, and inputting the target preset text data into the input text box element.
5. The method according to claim 3 or 4, wherein, at the step S3: according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element, after each interactive visual element is clicked in the first target interface in sequence, the method further comprises the following steps:
step S4: receiving verification information fed back by a server;
step S5: determining whether target preset text data input to each input text box element is legal or not according to the verification information; if the user interface is legal, jumping to a second target interface, and carrying out automatic testing on a plurality of interactive visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface; if not, go to step S6;
step S6: acquiring the number of trial and error times corresponding to the first target interface, and judging whether the number of trial and error times corresponding to the first target interface is smaller than a preset trial and error time threshold value corresponding to the first target interface; and if the trial-and-error times corresponding to the first target interface are smaller than the preset trial-and-error times threshold corresponding to the first target interface, updating the trial-and-error times corresponding to the first target interface, emptying the first element array, and returning to the step S2.
6. The method of claim 5, further comprising:
step S7: if the trial-and-error times corresponding to the first target interface are judged to be larger than or equal to the preset trial-and-error time threshold corresponding to the first target interface, acquiring the priority corresponding to each interactive visual element, and putting the unique identifiers corresponding to the interactive visual elements into a second element array according to the priority corresponding to each interactive visual element;
step S8: according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array and the position information corresponding to each interactive visual element, sequentially clicking each interactive visual element in the first target interface;
step S9: receiving verification information fed back by a server;
step S10: determining whether target preset text data input to each input text box element is legal or not according to the verification information; if the interactive visual elements are legal, jumping to the second target interface, and carrying out automatic testing on the interactive visual elements in the second target interface; if not, the process returns to step S8.
7. The method of claim 5, further comprising:
and generating a test log and storing the test log into a local storage space.
8. An automated testing device for an application program, comprising:
the analysis unit is configured to analyze a first target interface to obtain element-related information corresponding to each interactive visual element included in the first target interface, where the first target interface is a user interface currently displayed by an application to be tested, and the element-related information corresponding to the interactive visual element includes: unique identification and position information corresponding to the interactive visual elements;
the first putting unit is used for putting the unique identifiers corresponding to the interactive visual elements into a first element array according to a random sequence;
and the first clicking unit is used for sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element.
9. The apparatus of claim 8, wherein the parsing unit comprises:
an analysis module, configured to analyze the first target interface through a target interface to obtain element-related information corresponding to each visual element included in the first target interface, where the target interface is an automatic test framework interface, and the element-related information corresponding to the visual element includes: attribute information, a unique identifier and position information corresponding to the visual element, wherein the attribute information corresponding to the visual element is used for marking the category of the visual element;
and the first determining module is used for determining a plurality of interactive visual elements contained in the first target interface according to the attribute information corresponding to each visual element.
10. The apparatus of claim 9, wherein the interactive visual element is an interactive picture element, a button element or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further comprises: the input rule corresponding to the input text box element; the first click unit includes:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a plurality of preset text data meeting an input rule corresponding to an input text box element from a preset text array when a currently clicked interactive visual element is the input text box element;
the first selection module is used for selecting target preset text data from the preset text data;
and the first input module is used for inputting the target preset text data into the input text box element.
11. The apparatus of claim 9, wherein the interactive visual element is an interactive picture element, a button element or an input text box element, and when the interactive visual element is the input text box element, the element-related information corresponding to the interactive visual element further comprises: the input rule corresponding to the input text box element; the first click unit includes:
a second determination module to determine a plurality of input text box elements included in the first target interface;
the second acquisition module is used for acquiring a plurality of preset text data meeting the input rule corresponding to each input text box element from a preset text array;
the processing module is used for carrying out permutation and combination processing on a plurality of preset text data corresponding to each input text box element to generate a plurality of data sets, wherein each data set comprises one preset text data corresponding to each input text box element;
a second selection module, configured to select a target data set from the plurality of data sets;
and the second input module is used for extracting target preset text data corresponding to the input text box element from the target data set and inputting the target preset text data into the input text box element when the currently clicked interactive visual element is the input text box element.
12. The apparatus of claim 10 or 11, further comprising:
the first receiving unit is used for receiving verification information fed back by a server after the first clicking unit sequentially clicks each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the first element array and the position information corresponding to each interactive visual element;
a first determining unit configured to determine whether target preset text data input to each of the input text box elements is legal or not according to the verification information; when the target preset text data input to each input text box element is determined to be legal, jumping to a second target interface, and performing automatic testing on a plurality of interactive visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface;
the judging unit is used for acquiring the number of trial and error times corresponding to the first target interface when the target preset text data input to any one input text box element is determined to be illegal, and judging whether the number of trial and error times corresponding to the first target interface is smaller than a preset threshold value of the number of trial and error times corresponding to the first target interface or not; and when the trial-and-error times corresponding to the first target interface are judged to be smaller than the preset trial-and-error time threshold corresponding to the first target interface, updating the trial-and-error times corresponding to the first target interface, emptying the first element array, and controlling the first putting unit and the first clicking unit to automatically test the plurality of interactive visual elements in the first target interface again.
13. The apparatus of claim 12, further comprising:
the second input unit is used for acquiring the priority corresponding to each interactive visual element when the judging unit judges that the trial-and-error times corresponding to the first target interface are greater than or equal to a preset trial-and-error time threshold corresponding to the first target interface, and inputting the unique identifiers corresponding to the interactive visual elements into a second element array according to the priority corresponding to each interactive visual element;
the second clicking unit is used for sequentially clicking each interactive visual element in the first target interface according to the sequence of the unique identifier corresponding to each interactive visual element in the second element array and the position information corresponding to each interactive visual element;
the second receiving unit is used for receiving the verification information fed back by the server;
a second determining unit, configured to determine whether target preset text data input to each of the input text box elements is legal according to the verification information; when the target preset text data input to each input text box element is determined to be legal, jumping to a second target interface, and carrying out automatic testing on a plurality of interactive visual elements in the second target interface; and when the target preset text data input to any one of the input text box elements is determined to be illegal, controlling the second clicking unit to automatically test the plurality of interactive visual elements in the first target interface again.
14. The apparatus of claim 12, further comprising:
and the storage unit is used for generating a test log and storing the test log into a local storage space.
15. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, a device where the storage medium is located is controlled to execute the automatic test method of the application program according to any one of claims 1 to 7.
16. An apparatus for automated testing of an application, the apparatus comprising a storage medium; and one or more processors, the storage medium coupled with the processors, the processors configured to execute program instructions stored in the storage medium; the program instructions when executed perform a method of automated testing of an application program according to any of claims 1 to 7.
CN202110142228.4A 2021-02-02 2021-02-02 Automatic testing method and device for application program Active CN112905451B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110142228.4A CN112905451B (en) 2021-02-02 2021-02-02 Automatic testing method and device for application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110142228.4A CN112905451B (en) 2021-02-02 2021-02-02 Automatic testing method and device for application program

Publications (2)

Publication Number Publication Date
CN112905451A true CN112905451A (en) 2021-06-04
CN112905451B CN112905451B (en) 2023-08-25

Family

ID=76121408

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110142228.4A Active CN112905451B (en) 2021-02-02 2021-02-02 Automatic testing method and device for application program

Country Status (1)

Country Link
CN (1) CN112905451B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220596A (en) * 2021-06-17 2021-08-06 中国农业银行股份有限公司 Application testing method, device, equipment, storage medium and program product
CN115587352A (en) * 2022-10-10 2023-01-10 奇安信科技集团股份有限公司 Privacy security monitoring method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615538A (en) * 2015-02-05 2015-05-13 天津市康凯特软件科技有限公司 Mobile phone application testing method based on mobile phone interface control elements
CN107783898A (en) * 2017-07-24 2018-03-09 平安科技(深圳)有限公司 The method of testing and test equipment of Mobile solution
CN110297758A (en) * 2019-05-20 2019-10-01 深圳壹账通智能科技有限公司 User interface automated testing method, device and computer readable storage medium
CN110688317A (en) * 2019-09-27 2020-01-14 支付宝(杭州)信息技术有限公司 Application interface test method and device
CN110941546A (en) * 2019-10-12 2020-03-31 平安健康保险股份有限公司 Automatic test method, device, equipment and storage medium for WEB page case

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615538A (en) * 2015-02-05 2015-05-13 天津市康凯特软件科技有限公司 Mobile phone application testing method based on mobile phone interface control elements
CN107783898A (en) * 2017-07-24 2018-03-09 平安科技(深圳)有限公司 The method of testing and test equipment of Mobile solution
CN110297758A (en) * 2019-05-20 2019-10-01 深圳壹账通智能科技有限公司 User interface automated testing method, device and computer readable storage medium
CN110688317A (en) * 2019-09-27 2020-01-14 支付宝(杭州)信息技术有限公司 Application interface test method and device
CN110941546A (en) * 2019-10-12 2020-03-31 平安健康保险股份有限公司 Automatic test method, device, equipment and storage medium for WEB page case

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220596A (en) * 2021-06-17 2021-08-06 中国农业银行股份有限公司 Application testing method, device, equipment, storage medium and program product
CN113220596B (en) * 2021-06-17 2024-04-30 中国农业银行股份有限公司 Application testing method, device, equipment, storage medium and program product
CN115587352A (en) * 2022-10-10 2023-01-10 奇安信科技集团股份有限公司 Privacy security monitoring method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112905451B (en) 2023-08-25

Similar Documents

Publication Publication Date Title
CN109871326B (en) Script recording method and device
CN109033772B (en) Verification information input method and device
CN106326120B (en) Regression testing method and device for application software and electronic equipment
CN114546738B (en) Universal test method, system, terminal and storage medium for server
CN106776338B (en) Test method, test device and server
CN112749081B (en) User interface testing method and related device
CN110554962A (en) Regression testing process covering method, server and computer readable storage medium
CN107807841B (en) Server simulation method, device, equipment and readable storage medium
CN111181805B (en) Micro-service test baffle generation method and system based on test case
CN112905451A (en) Automatic testing method and device for application program
CN108959067A (en) Test method, device and the computer readable storage medium of search engine
CN112069068A (en) Automatic test data processing method, device, equipment and readable storage medium
CN110990274A (en) Data processing method, device and system for generating test case
CN112527676A (en) Model automation test method, device and storage medium
TW202121206A (en) Method and system for automatically identifying valid data acquisition module
CN112506757A (en) Automatic test method, system, computer device and medium thereof
CN114756466A (en) Test case obtaining method and device and storage medium
CN114443690A (en) Method and system for interaction between VR application and platform data
CN112633341A (en) Interface testing method and device, computer equipment and storage medium
CN116719736A (en) Test case generation method and device for testing software interface
CN109542775B (en) Test script generation and execution method and device
CN114510305B (en) Model training method and device, storage medium and electronic equipment
CN110716778A (en) Application compatibility testing method, device and system
CN116932360A (en) Page testing method and device, computer equipment and storage medium
CN113836032A (en) Android interface concurrent testing method, device, equipment and storage medium

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