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

Automatic testing method and device for application program Download PDF

Info

Publication number
CN112905451B
CN112905451B CN202110142228.4A CN202110142228A CN112905451B CN 112905451 B CN112905451 B CN 112905451B CN 202110142228 A CN202110142228 A CN 202110142228A CN 112905451 B CN112905451 B CN 112905451B
Authority
CN
China
Prior art keywords
target interface
visual element
target
input
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.)
Active
Application number
CN202110142228.4A
Other languages
Chinese (zh)
Other versions
CN112905451A (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

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 test method and device for an application program, and relates to the technical field of automatic test. The method of the application comprises the following steps: step S1: analyzing a 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 an application program to be tested, and the element related information corresponding to the interactive visual element comprises: unique identification and position information corresponding to the interactive visual element; step S2: unique identifiers corresponding to the interaction visual elements are placed into a first element array according to a random sequence; step S3: and clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element. The method and the device are suitable for 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
Application program testing is an indispensable part of the development process of application programs, and aims to discover defects in the application programs, so that development cost and maintenance cost of the application programs are reduced, and quality improvement of the application programs is promoted. Among the various types of application testing, the application testing closest to the user's needs is testing the functionality of multiple interactive visual elements in the application user interface.
Currently, in order to simulate different operation logics of different users, testing of functions of a plurality of interactive visual elements in an application user interface is generally achieved by clicking randomly 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 are not clicked, so that the test 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 test method and device for an application program, and mainly aims to improve test efficiency for testing functions of a plurality of interactive visual elements in a user interface of the application program.
In order to solve the technical problems, the embodiment of the application provides the following technical scheme:
in a first aspect, the present application provides a method for automated testing of an application program, the method comprising:
step S1: analyzing a 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 an application program to be tested, and the element related information corresponding to the interactive visual element comprises: unique identification and position information corresponding to the interactive visual element;
step S2: the unique identifiers corresponding to the interactive visual elements are placed into a first element array according to a random sequence;
step S3: and clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element.
Optionally, the 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 element related information comprises:
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 comprises: the visual element comprises attribute information, unique identification 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: input rules corresponding to the input text box elements; the step S3: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element, wherein the method 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 the input rule corresponding to the input text box element from a preset text array;
selecting target preset text data from a plurality of 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: input rules corresponding to the input text box elements; the step S3: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element, wherein the method 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;
Performing 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 the data sets comprise one preset text data corresponding to each input text box element;
selecting a target data set from a plurality of data sets;
and 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 clicking each interactive visual element in the first target interface in turn, the method further comprises:
step S4: receiving verification information fed back by a server;
step S5: determining whether the target preset text data input to each input text box element is legal or not according to the verification information; if the interaction visual elements are legal, jumping to a second target interface, and carrying out automatic testing on the interaction visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface; if not, entering step S6;
Step S6: acquiring the trial-and-error times corresponding to the first target interface, and judging whether the trial-and-error times corresponding to the first target interface is smaller than a preset trial-and-error times threshold corresponding to the first target interface; if the number of trial-and-error times corresponding to the first target interface is smaller than the preset number of trial-and-error times threshold corresponding to the first target interface, updating the number of trial-and-error times corresponding to the first target interface, clearing the first element array, and returning to the step S2.
Optionally, the method further comprises:
step S7: if the trial-and-error times corresponding to the first target interface are larger than or equal to a preset trial-and-error times threshold corresponding to the first target interface, acquiring the priority corresponding to each interactive visual element, and putting 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;
step S8: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the second element array and the position information corresponding to each interaction visual element;
Step S9: receiving verification information fed back by a server;
step S10: determining whether the target preset text data input to each input text box element is legal or not according to the verification information; if the interaction visual elements are legal, jumping to the second target interface, and automatically testing the interaction visual elements in the second target interface; if not, the process returns to step S8.
Optionally, the method further comprises:
and generating a test log, and storing the test log into a local storage space.
In a second aspect, the present application also provides an automated testing apparatus for an application, the apparatus comprising:
the analyzing 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 program 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 element;
the first placing unit is used for placing 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 clicking each interaction visual element in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element.
Optionally, the parsing unit includes:
the analyzing module is configured to analyze the first target interface through a target interface, so as 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: the visual element comprises attribute information, unique identification 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: input rules corresponding to the input text box elements; the first clicking unit includes:
The first acquisition module is used for acquiring a plurality of preset text data meeting the input rule corresponding to the input text box element from a preset text array when the currently clicked interactive visual element is the input text box element;
the first selecting module is used for selecting target preset text data from a plurality of 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: input rules corresponding to the input text box elements; the first clicking unit includes:
a second determining module, configured 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 the 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 so as to generate a plurality of data sets, wherein the data sets comprise one preset text data corresponding to each input text box element;
The second selecting module is used for selecting a target data set from a 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 when the currently clicked interactive visual element is the input text box element, and inputting the target preset text data into the input text box element.
Optionally, the apparatus further includes:
the first receiving unit is used for receiving verification information fed back by the server after the first clicking unit clicks each interaction visual element in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element;
the first determining unit is used for determining whether the target preset text data input to each input text box element is legal or not according to the verification information; when determining that the target preset text data input to each input text box element are 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 trial-and-error times corresponding to the first target interface when determining that the target preset text data input to any one of the input text box elements is illegal, and judging whether the trial-and-error times corresponding to the first target interface is smaller than a preset trial-and-error times threshold corresponding to the first target interface; when the number of trial-and-error times corresponding to the first target interface is smaller than a preset number of trial-and-error times threshold corresponding to the first target interface, updating the number of trial-and-error times corresponding to the first target interface, clearing the first element array, and controlling the first putting unit and the first clicking unit to automatically test a plurality of interactive visual elements in the first target interface again.
Optionally, the apparatus further includes:
the second placing unit is used for obtaining the priority corresponding to each interaction visual element when the judging unit judges that the trial-and-error times corresponding to the first target interface is greater than or equal to the preset trial-and-error times threshold corresponding to the first target interface, and placing unique identifiers corresponding to the interaction visual elements into a second element array according to the priority corresponding to each interaction visual element;
The second clicking unit is used for clicking each interaction visual element in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the second element array and the position information corresponding to each interaction visual element;
the second receiving unit is used for receiving verification information fed back by the server;
the second determining unit is used for determining whether the target preset text data input to each input text box element is legal or not according to the verification information; when the fact that the target preset text data input to each input text box element are legal is determined, jumping to a second target interface, and automatically testing 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 click unit to automatically test a plurality of interactive visual elements in the first target interface again.
Optionally, the apparatus further includes:
and the storage unit is used for generating a test log and storing the test log into the 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, where the program, when executed, controls a device in which the storage medium is located to execute the automatic test method of the application program described in the first aspect.
In a fourth aspect, embodiments of the present application provide an automated test equipment for an application, the equipment comprising a storage medium; and one or more processors coupled to the storage medium, the processors configured to execute the program instructions stored in the storage medium; the program instructions execute the automated test method for applications according to the first aspect when run.
By means of the technical scheme, the technical scheme provided by the application has at least the following advantages:
the application provides an automatic test method and device for an application program, which can be used for sequentially clicking each interactive visual element in a first target interface after target terminal equipment analyzes and obtains unique identifiers and position information corresponding to each interactive visual element contained in a user interface to be tested (namely the first target interface) of the application program to be tested, the unique identifiers corresponding to a plurality of interactive visual elements are placed in a first element array according to random sequences, the position of each interactive visual element in the first target interface is determined according to the position information corresponding to each interactive visual element, and then the sequence of the unique identifiers corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface are adopted, so that a plurality of interactive visual elements contained in the first target interface are clicked according to the random sequences. Because the unique identifiers corresponding to the interaction visual elements are repeatedly put into the first element array according to the random sequence, and each interaction visual element is clicked in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position of each interaction visual element in the first target interface, different operation logics of different users can be simulated, namely, the simulation of clicking on the interaction visual elements contained in the first target interface according to different sequences is realized; moreover, each clicking operation of the target terminal equipment can click one interactive visual element in the first target interface, so that the testing efficiency of testing the functions of a plurality of interactive visual elements in the user interface of the application program to be tested can be effectively improved.
The foregoing description is only an overview of the present application, and is intended to be implemented in accordance with the teachings of the present application in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present application more readily apparent.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present application will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. In the drawings, wherein like or corresponding reference numerals indicate like or corresponding parts, there are shown by way of illustration, and not limitation, several embodiments of the application, in which:
FIG. 1 is a flowchart of an automated test method for an application program according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for automated testing of an application program according to an embodiment of the present application;
FIG. 3 shows a block diagram of an automated test equipment for an application program according to an embodiment of the present application;
FIG. 4 shows a block diagram of another automated test equipment for an application program according to an 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 application to those skilled in the art.
It is noted that unless otherwise indicated, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this application belongs.
An embodiment of the present application provides an automatic test 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 element comprises: the unique identifier and the position information corresponding to the interactive visual element are used for indicating the position of the interactive visual element in the first target interface.
In the embodiment of the present application, the execution body in each step is a target terminal device running an application program to be tested, and the target terminal device may be, but is not limited to,: smartphones, tablets, etc., 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 are required to be tested, the application program to be tested is firstly operated in 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 equipment can analyze the first target interface, so that element related information corresponding to each interactive visual element contained in the first target interface is obtained, namely unique identification and position information corresponding to each interactive visual element are obtained.
102. And putting unique identifiers corresponding to the interaction visual elements into the first element array according to a random sequence.
In the embodiment of the application, after resolving and obtaining the unique identifier and the position information corresponding to each interactive visual element contained in the first target interface, the target terminal equipment needs to put the unique identifiers corresponding to the interactive visual elements into the first element array according to a random sequence, so that the subsequent target terminal equipment can click each interactive visual element 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 click the interactive visual elements contained in the first target interface according to the random sequence.
103. And clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element.
In the embodiment of the application, after unique identifiers corresponding to a plurality of interactive visual elements contained in a first target interface are placed in a first element array according to a random sequence, the target terminal equipment can click each interactive visual element 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, namely, firstly, the position of each interactive visual element in the first target interface is determined according to the position information corresponding to each interactive visual element, and then, click each interactive visual element 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 of each interactive visual element in the first target interface, so that the plurality of interactive visual elements contained in the first target interface are clicked according to the random sequence.
It should be noted that, by repeating the test methods described in steps 102-103, different operation logics of different users can be simulated, that is, the simulation of clicking a plurality of interactive visual elements included in the first target interface according to different orders is realized.
The embodiment of the application provides an automatic test method for an application program, which can be used for sequentially clicking each interactive visual element in a first target interface after target terminal equipment analyzes and obtains unique identifiers and position information corresponding to each interactive visual element contained in a user interface (namely the first target interface) of the application program to be tested, the unique identifiers corresponding to a plurality of interactive visual elements are placed in a first element array according to a random sequence by the target terminal equipment, the position of each interactive visual element in the first target interface is determined according to the position information corresponding to each interactive visual element, and then the interactive visual elements are clicked in the first target interface according to the sequence of the unique identifiers corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface, so that a plurality of interactive visual elements contained in the first target interface are realized according to the random sequence. Because the unique identifiers corresponding to the interaction visual elements are repeatedly put into the first element array according to the random sequence, and each interaction visual element is clicked in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position of each interaction visual element in the first target interface, different operation logics of different users can be simulated, namely, the simulation of clicking on the interaction visual elements contained in the first target interface according to different sequences is realized; moreover, each clicking operation of the target terminal equipment can click one interactive visual element in the first target interface, so that the testing efficiency of testing the functions of a plurality of interactive visual elements in the user interface of the application program to be tested can be effectively improved.
For a more detailed description below, an embodiment of the present application provides another automated test of an application, 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 are required to be tested, the application program to be tested is firstly operated in 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 equipment can analyze the first target interface, so that element related information corresponding to each interactive visual element contained in the first target interface is obtained, namely unique identification and position information corresponding to each interactive visual element are obtained. The following will describe in detail 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.
(1) 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.
The target interface is an automatic test framework interface; the element related information corresponding to the visual element comprises: the visual element comprises attribute information, unique identification 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;
in the embodiment of the application, the target terminal equipment firstly needs to analyze the first target interface through the target interface (namely the automatic test framework interface), so that the element related information corresponding to each visual element contained in the first target interface is obtained, namely the attribute information, the unique identifier and the position information corresponding to each visual element are obtained.
(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 the embodiment of the application, after obtaining the attribute information, the unique identifier and the position information corresponding to each visual element contained in the first target interface, the target terminal equipment can determine which visual element or visual elements are interactive visual elements according to the attribute information corresponding to each visual element, so as to determine a plurality of interactive visual elements contained in the first target interface, and further obtain the unique identifier and the position information corresponding to each interactive visual element contained 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 the method is not limited thereto.
202. And putting unique identifiers corresponding to the interaction visual elements into the first element array according to a random sequence.
In step 202, unique identifiers corresponding to the plurality of interactive visual elements are put into the first element array according to a random order, and reference may be made to the description of the corresponding portion of fig. 1, which will not be repeated here in the embodiment of the present application.
203. And clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element.
In the embodiment of the application, after unique identifiers corresponding to a plurality of interactive visual elements contained in a first target interface are placed in a first element array according to a random sequence, the target terminal device can click each interactive visual element 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, namely, firstly, the position of each interactive visual element in the first target interface is determined according to the position information corresponding to each interactive visual element, and then, each interactive visual element is 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 of each interactive visual element in the first target interface.
Further, in the embodiment of the present application, the interactive visual element may be specifically 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 execute an additional operation after clicking the interactive visual element; when a certain interactive visual element is an input text box element, the target terminal equipment also needs to input text data into the input text box element after clicking 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 contains a plurality of preset text data, and the preset text data can be specifically: mobile phone number, identification card number, verification 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 not limited to,: the text data length is a preset length threshold, the text data is composed of full numbers, the text data is composed of full letters, the text data is composed of a mixture of alphanumeric letters, and so on.
(1) When the interactive visual element clicked currently is determined to be an input text box element, firstly acquiring a plurality of preset text data meeting the input rule corresponding to the input text box element from a preset text array; secondly, selecting target preset text data from a plurality of preset text data; finally, the target preset text data is input into the input text box element. Text data can be input into each input text box element in the first target interface in turn according to the method.
In the actual application process, the specific process of selecting the target preset text data from the plurality of preset text data by the target terminal device 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 a first round of automatic test is performed; when a second round of automated testing is performed, a second preset text data of the ordered plurality of 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 input rules 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 interactive visual element clicked currently 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. 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 satisfying the input rule of the input text box element a are obtained in a preset text array, preset text data C satisfying the input rule of the input text box element B, preset text data d and e satisfying the input rule of the input text box element C, 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: data combination 1-preset text data a, preset text data c, preset text data d, data combination 2 preset text data a, preset text data c, preset text data e, data combination 3-preset text data b, preset text data c, preset text data d, data combination 4-preset text data b, preset text data c, preset text data e.
In the actual application process, the specific process of selecting the target data set from the plurality of data sets by the target terminal device is as follows: sorting the plurality of data sets, and selecting a first data set in the sorted plurality of data sets as a target data set when a first round of automated test is performed; when a second round of automated testing is performed, 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, because, in the related technical scheme, it is: after clicking the input text box element, inputting text data into the input text box element by randomly clicking a soft keyboard, so that the text data input into the input text box element in the related technical scheme has high probability of not meeting the input rule corresponding to the input text box element, thereby causing that inputting text data into the input text box element consumes a great deal of time and further causing lower testing efficiency of automatic testing; and in the embodiment of the application is as follows: after clicking the input text box element, acquiring preset text data meeting the input rule corresponding to the input text box element from the preset text array, and inputting the acquired preset text data into the input text box element, so that inputting text data into the input text box element does not consume a great deal of time, and further, the testing efficiency of automatic testing can be effectively improved.
204. Receiving verification information fed back by a server side, and determining whether target preset text data input to each input text box element are legal or not according to the verification information; if the interaction visual elements are legal, jumping to a second target interface, and automatically testing the interaction visual elements in the second target interface; if not, step 205 is entered.
The second target interface is the next user interface of the first target interface.
In the embodiment of the application, after clicking each interactive visual element in turn and inputting target preset text data to each input text box element, the target terminal equipment sends request information containing a plurality of target preset text data to the server, and the server feeds verification information back to the target terminal equipment after verifying the validity of the plurality of target preset text data; 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 determining that the target preset text data input to each input text box element are legal, the target terminal equipment can control to jump to a second target interface, and automatically test a plurality of interactive visual elements in the second target interface according to the test method for automatically testing the plurality of interactive visual elements in the first target interface recorded in the embodiment of the application; when it is determined that the target preset text data input to any one of the input text box elements is illegal, step 205 is entered.
205. Acquiring the trial-and-error times corresponding to the first target interface, and judging whether the trial-and-error times corresponding to the first target interface is smaller than a preset trial-and-error times threshold corresponding to the first target interface; if yes, updating the number of trial and error times corresponding to the first target interface, and clearing the first element array, and returning to step 202; if not, go to step 206.
The preset error test frequency threshold may be, but not limited to: 30 times, 50 times, 70 times, 100 times, etc.
In the embodiment of the application, when determining that the target preset text data input to any one input text box element is illegal, the target terminal equipment needs to acquire the trial-and-error times corresponding to the first target interface, and judges whether the trial-and-error times corresponding to the first target interface is smaller than a preset trial-and-error times threshold corresponding to the first target interface; when the number of trial-and-error times corresponding to the first target interface is smaller than a preset number of trial-and-error times threshold corresponding to the first target interface, updating the number of trial-and-error times corresponding to the first target interface, clearing the first element array, and automatically testing a plurality of interactive visual elements in the first target interface by adopting the testing methods recorded in the steps 202 and 203; 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 number of trial-and-error times threshold corresponding to the first target interface, step 206 is entered.
In the actual application process, when it is determined that the target preset text data input to the partial input text box elements 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 elements is not legal, for the input text box elements that input legal text data in the present round of automated test, the target terminal device may input the target preset text data input last time to the input text box elements again when the next round of automated test is performed, but the method is not limited thereto.
206. And acquiring the priority corresponding to each interaction visual element, and placing the unique identifiers corresponding to the interaction visual elements into the second element array according to the priority corresponding to each interaction visual element.
In the embodiment of the application, when the trial-and-error times corresponding to the first target interface are determined to be greater than or equal to the preset trial-and-error times threshold corresponding to the first target interface, the target terminal equipment acquires the priority corresponding to each interactive visual element contained in the first target interface, and places the unique identifier corresponding to the interactive visual elements into the second element array according to the priority corresponding to each interactive visual element, so that the subsequent target terminal equipment can 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 second element array, thereby realizing clicking the interactive visual elements according to the priority of the interactive visual elements.
Further, in the embodiment of the present 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 staff, 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 clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the second element array and the position information corresponding to each interaction visual element.
In the embodiment of the application, after the target terminal equipment places the unique identifiers corresponding to the interaction visual elements into the second element array according to the priority corresponding to each interaction visual element contained in the first target interface, each interaction visual element can be clicked in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the second element array and the position information corresponding to each interaction visual element, namely, the position of each interaction visual element in the first target interface is determined according to the position information corresponding to each interaction visual element, and then each interaction visual element is clicked in the first target interface according to the sequence of the unique identifier corresponding to each interaction visual element in the second element array and the position of each interaction visual element in the first target interface, so that the plurality of interaction visual elements are clicked according to the priority of the interaction 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 execute an additional operation 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 needs to input text data into the input text box element, wherein, regarding a specific manner of inputting text data into the input text box element by the target terminal device, reference may be made to a description of a corresponding portion in step 203, and the embodiment of the present application will not be repeated here.
208. Receiving verification information fed back by a server side, and determining whether target preset text data input to each input text box element are legal or not according to the verification information; if the interaction visual elements are legal, jumping to a second target interface, and automatically testing the interaction visual elements in the second target interface; if not, go back to step 207.
In the embodiment of the application, after clicking each interactive visual element in turn and inputting target preset text data to each input text box element, the target terminal equipment sends request information containing a plurality of target preset text data to the server, and the server feeds verification information back to the target terminal equipment after verifying the validity of the plurality of target preset text data; 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 determining that the target preset text data input to each input text box element are legal, the target terminal equipment can control to jump to a second target interface, and automatically test a plurality of interactive visual elements in the second target interface according to the test method for automatically testing the plurality of interactive visual elements in the first target interface recorded in the embodiment of the application; when it is determined that the target preset text data input to any one of the input text box elements is illegal, the testing method described in step 207 is used again to automatically test the plurality of interactive visual elements in the first target interface.
Further, in the embodiment of the present application, after completing the automatic test of the interactive visual elements of each user interface in the application to be tested, the target terminal device generates a test log recorded with the entire automatic test process, and stores the generated test log into the local storage space, so that the test staff can learn the entire automatic test process according to the test log, thereby performing adjustment optimization on 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 device for an application program. The embodiment of the device corresponds to the embodiment of the method, and for convenience of reading, details of the embodiment of the method are not repeated one by one, but it should be clear that the device in the embodiment can correspondingly realize all the details of the embodiment of the method. The device is applied to improving the testing efficiency of testing the functions of a plurality of interactive visual elements in an application user interface, and particularly as shown in fig. 3, the device comprises:
The parsing unit 301 is configured to parse 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 element;
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;
and a first clicking unit 303, configured to click each interactive visual element in the first target interface in turn 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, as shown in fig. 4, the parsing unit 301 includes:
the analyzing module 3011 is configured to analyze the first target interface through a target interface, so as 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: the visual element comprises attribute information, unique identification 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 a plurality of interactive visual elements included in the first target interface according to attribute information corresponding to each visual 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 an input text box element, the element related information corresponding to the interactive visual element further includes: input rules corresponding to the input text box elements; the first clicking unit 303 includes:
a first obtaining module 3031, configured to obtain, when the currently clicked interactive visual element is an input text box element, a plurality of preset text data that satisfy an input rule corresponding to the input text box element in a preset text array;
a first selecting module 3032, configured to select target preset text data from a plurality of 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 an input text box element, the element related information corresponding to the interactive visual element further includes: input rules corresponding to the input text box elements; the first clicking 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 satisfy 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, so as to generate a plurality of data sets, where the data sets include one preset text data corresponding to each input text box element;
a second selecting module 3037, configured to select a target data set from a plurality of data sets;
and the second input module 3038 is configured to extract, when the currently clicked interactive visual element is an input text box element, target preset text data corresponding to the input text box element from 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, in a first clicking unit 303, verification information fed back by a server after clicking each interactive visual element in the first target interface in sequence according to a sequence of a unique identifier corresponding to each interactive visual element in the first element array and position information corresponding to each interactive visual element;
A first determining unit 305 for determining whether the target preset text data input to each of the input text box elements is legal or not according to the verification information; when determining that the target preset text data input to each input text box element are 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 306 is configured to obtain the number of trial-and-error times corresponding to the first target interface when it is determined that the target preset text data input to any one of the input text box elements is illegal, and judge whether the number of trial-and-error times corresponding to the first target interface is less than a preset number of trial-and-error times threshold corresponding to the first target interface; when the number of trial-and-error times corresponding to the first target interface is smaller than the preset number of trial-and-error times threshold corresponding to the first target interface, updating the number of trial-and-error times corresponding to the first target interface, clearing the first element array, and controlling the first putting unit 302 and the first clicking unit 303 to automatically test 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 obtain a priority corresponding to each interactive visual element when the judging unit 306 judges that the number of trial and error times corresponding to the first target interface is greater than or equal to a preset number of trial and error times threshold corresponding to the first target interface, 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 each interactive visual element 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;
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 input text box element is legal according to the verification information; when the fact that the target preset text data input to each input text box element are legal is determined, jumping to a second target interface, and automatically testing 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 the local storage space.
The embodiment of the application provides an automatic test method and device for an application program, which can be used for sequentially clicking each interactive visual element in a first target interface after target terminal equipment analyzes and obtains unique identifiers and position information corresponding to each interactive visual element contained in a to-be-tested user interface (namely the first target interface) of the application program to be tested, the target terminal equipment places the unique identifiers corresponding to a plurality of interactive visual elements in a first element array according to a random sequence, determines the position of each interactive visual element in the first target interface according to the position information corresponding to each interactive visual element, and then clicks each interactive visual element in the first target interface according to the sequence of the unique identifiers corresponding to each interactive visual element in the first element array and the position of each interactive visual element in the first target interface, so that a plurality of interactive visual elements contained in the first target interface are clicked according to the random sequence. Because the unique identifiers corresponding to the interaction visual elements are repeatedly put into the first element array according to the random sequence, and each interaction visual element is clicked in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position of each interaction visual element in the first target interface, different operation logics of different users can be simulated, namely, the simulation of clicking on the interaction visual elements contained in the first target interface according to different sequences is realized; moreover, each clicking operation of the target terminal equipment can click one interactive visual element in the first target interface, so that the testing efficiency of testing the functions of a plurality of interactive visual elements in the user interface of the application program to be tested can be effectively improved.
The automatic testing device for the application program comprises a processor and a memory, wherein the analyzing unit, the first putting unit, the first clicking unit and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more kernel parameters to improve the efficiency of testing the functionality of the plurality of interactive visual elements in the application user interface by adjusting the kernel parameters.
The embodiment of the application provides a storage medium which comprises a stored program, wherein when the program runs, equipment in which the storage medium is controlled to execute the automatic test method of the application program.
The storage medium may include volatile memory, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the application also provides an automatic testing device for the application program, which comprises a storage medium; and one or more processors coupled to the storage medium, the processors configured to execute the program instructions stored in the storage medium; and executing the automatic test method of the application program when the program instruction runs.
The embodiment of the application provides equipment, which comprises a processor, a memory and a program stored in the memory and capable of running on the processor, wherein the processor realizes the following steps when executing the program:
step S1: analyzing a 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 an application program to be tested, and the element related information corresponding to the interactive visual element comprises: unique identification and position information corresponding to the interactive visual element;
step S2: the unique identifiers corresponding to the interactive visual elements are placed into a first element array according to a random sequence;
step S3: and clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element.
Further, the 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 element related information comprises:
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 comprises: the visual element comprises attribute information, unique identification 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: input rules corresponding to the input text box elements; the step S3: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element, wherein the method 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 the input rule corresponding to the input text box element from a preset text array;
selecting target preset text data from a plurality of 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: input rules corresponding to the input text box elements; the step S3: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element, wherein the method 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;
Performing 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 the data sets comprise one preset text data corresponding to each input text box element;
selecting a target data set from a plurality of data sets;
and 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 clicking each interactive visual element in the first target interface in turn, the method further comprises:
step S4: receiving verification information fed back by a server;
step S5: determining whether the target preset text data input to each input text box element is legal or not according to the verification information; if the interaction visual elements are legal, jumping to a second target interface, and carrying out automatic testing on the interaction visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface; if not, entering step S6;
Step S6: acquiring the trial-and-error times corresponding to the first target interface, and judging whether the trial-and-error times corresponding to the first target interface is smaller than a preset trial-and-error times threshold corresponding to the first target interface; if the number of trial-and-error times corresponding to the first target interface is smaller than the preset number of trial-and-error times threshold corresponding to the first target interface, updating the number of trial-and-error times corresponding to the first target interface, clearing 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 larger than or equal to a preset trial-and-error times threshold corresponding to the first target interface, acquiring the priority corresponding to each interactive visual element, and putting 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;
step S8: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the second element array and the position information corresponding to each interaction visual element;
Step S9: receiving verification information fed back by a server;
step S10: determining whether the target preset text data input to each input text box element is legal or not according to the verification information; if the interaction visual elements are legal, jumping to the second target interface, and automatically testing the interaction 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 application also provides a computer program product adapted to perform, when executed on a data processing device, a program code initialized with the method steps of: step S1: analyzing a 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 an application program to be tested, and the element related information corresponding to the interactive visual element comprises: unique identification and position information corresponding to the interactive visual element; step S2: the unique identifiers corresponding to the interactive visual elements are placed into a first element array according to a random sequence; step S3: and clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element.
It will be appreciated by those skilled in the art that 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. 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 storage media for a computer 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, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
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 one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that 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 foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (12)

1. A method for automated testing of an application program, comprising:
step S1: analyzing a 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 an application program to be tested, and the element related information corresponding to the interactive visual element comprises: unique identification and position information corresponding to the interactive visual element;
Step S2: the unique identifiers corresponding to the interactive visual elements are placed into a first element array according to a random sequence;
step S3: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element;
the interactive visual element is an input text box element; the step S3: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element, wherein the method comprises the following steps: inputting target preset text data into the input text box element;
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 clicking each interactive visual element in the first target interface in turn, the method further comprises:
step S4: receiving verification information fed back by a server;
Step S5: determining whether the target preset text data input to each input text box element is legal or not according to the verification information; if the interaction visual elements are legal, jumping to a second target interface, and carrying out automatic testing on the interaction visual elements in the second target interface, wherein the second target interface is the next user interface of the first target interface; if not, entering step S6;
step S6: acquiring the trial-and-error times corresponding to the first target interface, and judging whether the trial-and-error times corresponding to the first target interface is smaller than a preset trial-and-error times threshold corresponding to the first target interface; if the number of trial-and-error times corresponding to the first target interface is smaller than the preset number of trial-and-error times threshold corresponding to the first target interface, updating the number of trial-and-error times corresponding to the first target interface, clearing the first element array, and returning to the step S2;
step S7: if the trial-and-error times corresponding to the first target interface are larger than or equal to a preset trial-and-error times threshold corresponding to the first target interface, acquiring the priority corresponding to each interactive visual element, and putting 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;
Step S8: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the second element array and the position information corresponding to each interaction visual element;
step S9: receiving verification information fed back by a server;
step S10: determining whether the target preset text data input to each input text box element is legal or not according to the verification information; if the interaction visual elements are legal, jumping to the second target interface, and automatically testing the interaction visual elements in the second target interface; if not, the process returns to step S8.
2. The method according to claim 1, wherein said 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 element related information comprises:
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 comprises: the visual element comprises attribute information, unique identification 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 input text box element, and the element related information corresponding to the interactive visual element further comprises: input rules corresponding to the input text box elements; the step S3: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element, wherein the method 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 the input rule corresponding to the input text box element from a preset text array;
selecting target preset text data from a plurality of 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 input text box element, and the element related information corresponding to the interactive visual element further comprises: input rules corresponding to the input text box elements; the step S3: clicking each interaction visual element in the first target interface in turn according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element, wherein the method 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;
performing 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 the data sets comprise one preset text data corresponding to each input text box element;
selecting a target data set from a plurality of data sets;
and 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 1, wherein the method further comprises:
and generating a test log, and storing the test log into a local storage space.
6. An automated test equipment for an application program, comprising:
the analyzing 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 program 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 element;
The first placing unit is used for placing the unique identifiers corresponding to the interactive visual elements into a first element array according to a random sequence;
the first clicking unit is used for clicking each interaction visual element in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element;
the interactive visual element is an input text box element; the first clicking unit is specifically configured to input target preset text data into the input text box element;
the first receiving unit is used for receiving verification information fed back by the server after the first clicking unit clicks each interaction visual element in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the first element array and the position information corresponding to each interaction visual element;
the first determining unit is used for determining whether the target preset text data input to each input text box element is legal or not according to the verification information; when determining that the target preset text data input to each input text box element are 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 trial-and-error times corresponding to the first target interface when determining that the target preset text data input to any one of the input text box elements is illegal, and judging whether the trial-and-error times corresponding to the first target interface is smaller than a preset trial-and-error times threshold corresponding to the first target interface; when the number of trial-and-error times corresponding to the first target interface is smaller than a preset number of trial-and-error times threshold corresponding to the first target interface, updating the number of trial-and-error times corresponding to the first target interface, clearing the first element array, and controlling the first putting unit and the first clicking unit to automatically test a plurality of interactive visual elements in the first target interface again;
the second placing unit is used for obtaining the priority corresponding to each interaction visual element when the judging unit judges that the trial-and-error times corresponding to the first target interface is greater than or equal to the preset trial-and-error times threshold corresponding to the first target interface, and placing unique identifiers corresponding to the interaction visual elements into a second element array according to the priority corresponding to each interaction visual element;
The second clicking unit is used for clicking each interaction visual element in the first target interface in sequence according to the sequence of the unique identifier corresponding to each interaction visual element in the second element array and the position information corresponding to each interaction visual element;
the second receiving unit is used for receiving verification information fed back by the server;
the second determining unit is used for determining whether the target preset text data input to each input text box element is legal or not according to the verification information; when the fact that the target preset text data input to each input text box element are legal is determined, jumping to a second target interface, and automatically testing 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 click unit to automatically test a plurality of interactive visual elements in the first target interface again.
7. The apparatus of claim 6, wherein the parsing unit comprises:
the analyzing module is configured to analyze the first target interface through a target interface, so as 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: the visual element comprises attribute information, unique identification 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.
8. The apparatus of claim 7, wherein the interactive visual element is an input text box element, and the element related information corresponding to the interactive visual element further comprises: input rules corresponding to the input text box elements; the first clicking unit includes:
the first acquisition module is used for acquiring a plurality of preset text data meeting the input rule corresponding to the input text box element from a preset text array when the currently clicked interactive visual element is the input text box element;
the first selecting module is used for selecting target preset text data from a plurality of preset text data;
and the first input module is used for inputting the target preset text data into the input text box element.
9. The apparatus of claim 7, wherein the interactive visual element is an input text box element, and the element related information corresponding to the interactive visual element further comprises: input rules corresponding to the input text box elements; the first clicking unit includes:
A second determining module, configured 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 the 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 so as to generate a plurality of data sets, wherein the data sets comprise one preset text data corresponding to each input text box element;
the second selecting module is used for selecting a target data set from a 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 when the currently clicked interactive visual element is the input text box element, and inputting the target preset text data into the input text box element.
10. The apparatus of claim 6, wherein the apparatus further comprises:
and the storage unit is used for generating a test log and storing the test log into the local storage space.
11. A storage medium comprising a stored program, wherein the program, when run, controls a device in which the storage medium is located to perform the automated test method of an application of any one of claims 1 to 5.
12. An automated test equipment for an application program, wherein the equipment comprises a storage medium; and one or more processors coupled to the storage medium, the processors configured to execute the program instructions stored in the storage medium; the program instructions, when executed, perform the method of automated testing of an application program of any one of claims 1 to 5.
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 CN112905451A (en) 2021-06-04
CN112905451B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

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

Also Published As

Publication number Publication date
CN112905451A (en) 2021-06-04

Similar Documents

Publication Publication Date Title
CN109871326B (en) Script recording method and device
CN106649316B (en) Video pushing method and device
CN105446874B (en) A kind of detection method and device of resource distribution file
CN112905451B (en) Automatic testing method and device for application program
CN107832216A (en) One kind buries a method of testing and device
CN109634837A (en) Automated testing method, device, equipment and storage medium
CN110046278B (en) Video classification method and device, terminal equipment and storage medium
CN113836885A (en) Text matching model training method, text matching device and electronic equipment
CN111181805A (en) Micro-service test baffle generation method and system based on test case
CN112527676A (en) Model automation test method, device and storage medium
US9501390B1 (en) Enhancing automated mobile application testing
CN107430590B (en) System and method for data comparison
CN112597066B (en) Page testing method and device
CN108255891B (en) Method and device for judging webpage type
CN112784273A (en) SQL risk identification method, device and equipment
CN117235527A (en) End-to-end containerized big data model construction method, device, equipment and medium
CN111950852A (en) User behavior analysis and guidance method and device, electronic equipment and readable storage device
CN112633341A (en) Interface testing method and device, computer equipment and storage medium
CN109376285B (en) Data sorting verification method based on json format, electronic device and medium
CN113298185A (en) Model training method, abnormal file detection method, device, equipment and medium
CN111008140A (en) Cross-platform UI (user interface) automatic testing method and device
CN116361193B (en) Method and device for testing layout document text selection
CN116340554B (en) English question method, device and application based on component splitting and combining
CN111309623B (en) Coordinate class data classification test method and device
CN111538822B (en) Method and system for generating training data of intelligent customer service robot

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