CN111045913B - Method and terminal for automatically logging in application to be tested - Google Patents

Method and terminal for automatically logging in application to be tested Download PDF

Info

Publication number
CN111045913B
CN111045913B CN201811182408.XA CN201811182408A CN111045913B CN 111045913 B CN111045913 B CN 111045913B CN 201811182408 A CN201811182408 A CN 201811182408A CN 111045913 B CN111045913 B CN 111045913B
Authority
CN
China
Prior art keywords
tested
application
preset
interface
login
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
CN201811182408.XA
Other languages
Chinese (zh)
Other versions
CN111045913A (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.)
Fujian Tianquan Educational Technology Ltd
Original Assignee
Fujian Tianquan Educational Technology 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 Fujian Tianquan Educational Technology Ltd filed Critical Fujian Tianquan Educational Technology Ltd
Priority to CN201811182408.XA priority Critical patent/CN111045913B/en
Publication of CN111045913A publication Critical patent/CN111045913A/en
Application granted granted Critical
Publication of CN111045913B publication Critical patent/CN111045913B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • 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)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a terminal for automatically logging in an application to be tested, which are characterized in that whether automatic logging in setting is started or not is judged by receiving the application to be tested, if yes, whether preset logging in information corresponding to the application to be tested exists or not is judged, if yes, information of an interface after the application to be tested is started is obtained, whether the interface after the application to be tested is a logging in interface is judged, if yes, the preset logging in information is automatically input into a text box of the logging in interface, the application to be tested can be automatically logged in, the labor burden is reduced, the working efficiency is improved, the method and the terminal can be used in various automatic tests such as random test and script test, and the reusability is high.

Description

Method and terminal for automatically logging in application to be tested
Technical Field
The invention relates to the technical field of software testing, in particular to a method and a terminal for automatically logging in an application to be tested.
Background
The automatic random test is to perform random combined simulation of operations such as clicking, double clicking, long pressing, up-and-down sliding, left-and-right sliding, shaking, volume adjustment, screen locking, screen unlocking, horizontal/vertical rotation, simultaneous clicking by two hands, button clicking, zooming-in and zooming-out and the like on the tested application. If an application to be logged in is to be tested randomly, the application will be on the login interface after being opened, and if the application is to be tested randomly, the login interface is tested randomly at this time, but the automatic random test is performed for a specific service interface after the application is logged in, so that the application is required to be logged in manually, the automatic random test is started again, and when the number of applications to be tested is large, the user needs to input large manpower to log in continuously, and time is wasted and boring is required.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: a method and a terminal for automatically logging in an application to be tested can automatically log in the application to be tested, and the manual burden is reduced.
In order to solve the technical problems, the invention adopts the following technical scheme:
a method for automatically logging in an application to be tested comprises the following steps:
s1, receiving an application to be tested, judging whether to start automatic login setting, and if yes, executing a step S2;
s2, judging whether preset login information corresponding to the application to be tested exists or not, if yes, acquiring the preset login information corresponding to the application to be tested, executing the step S3, and if no, receiving the preset login information and executing the step S3;
s3, acquiring information of the interface after the application to be tested is started, judging whether the interface after the application to be tested is started is a login interface, and if yes, executing the step S4;
s4, automatically inputting the preset login information into a text box of the login interface.
In order to solve the technical problems, the invention adopts the following technical scheme:
a terminal for automatic logging of an application to be tested, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
s1, receiving an application to be tested, judging whether to start automatic login setting, and if yes, executing a step S2;
s2, judging whether preset login information corresponding to the application to be tested exists or not, if yes, acquiring the preset login information corresponding to the application to be tested, executing the step S3, and if no, receiving the preset login information and executing the step S3;
s3, acquiring information of the interface after the application to be tested is started, judging whether the interface after the application to be tested is started is a login interface, and if yes, executing the step S4;
s4, automatically inputting the preset login information into a text box of the login interface.
The invention has the beneficial effects that: whether the automatic login setting is started or not is judged by receiving the application to be tested, if yes, whether preset login information corresponding to the application to be tested exists or not is judged, if yes, information of an interface after the application to be tested is started is obtained, whether the interface after the application to be tested is started is a login interface or not is judged, if yes, the preset login information is automatically input into a text box of the login interface, the application to be tested can be automatically logged in, the labor burden is reduced, the working efficiency is improved, the automatic login method can be used for various automatic tests such as random test and script test, and the reusability is high.
Drawings
FIG. 1 is a flow chart of a method for automatically logging in an application to be tested according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a terminal structure for automatically logging in an application to be tested according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for automatically logging in an application to be tested according to an embodiment of the present invention;
description of the reference numerals:
1. a terminal for automatically logging in an application to be tested; 2. A memory; 3. A processor.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
The key concept of the invention is that after automatic login setting is started, if preset login information corresponding to the application to be tested exists, information of an interface after the application to be tested is started is obtained, whether the interface is a login interface is judged, and if yes, the preset login information is automatically input into a text box of the login interface.
Referring to fig. 1, a method for automatically logging in an application to be tested includes the steps of:
s1, receiving an application to be tested, judging whether to start automatic login setting, and if yes, executing a step S2;
s2, judging whether preset login information corresponding to the application to be tested exists or not, if yes, acquiring the preset login information corresponding to the application to be tested, executing the step S3, and if no, receiving the preset login information and executing the step S3;
s3, acquiring information of the interface after the application to be tested is started, judging whether the interface after the application to be tested is started is a login interface, and if yes, executing the step S4;
s4, automatically inputting the preset login information into a text box of the login interface.
From the above description, the beneficial effects of the invention are as follows: whether the automatic login setting is started or not is judged by receiving the application to be tested, if yes, whether preset login information corresponding to the application to be tested exists or not is judged, if yes, information of an interface after the application to be tested is started is obtained, whether the interface after the application to be tested is started is a login interface or not is judged, if yes, the preset login information is automatically input into a text box of the login interface, the application to be tested can be automatically logged in, the labor burden is reduced, the working efficiency is improved, the automatic login method can be used for various automatic tests such as random test and script test, and the reusability is high.
Further, in the step S2, determining whether there is preset login information corresponding to the application to be tested specifically includes:
acquiring the name of the package of the application to be tested;
inquiring whether preset login information corresponding to the application to be tested exists or not according to the name of the package of the application to be tested.
As can be seen from the above description, the corresponding preset login information is queried according to the name of the package of the application to be tested, and a one-to-one correspondence between the application to be tested and the preset login information is established, so that the corresponding preset login information is convenient to obtain.
Further, the step S3 of obtaining the information of the interface after the start of the application to be tested, and determining whether the interface after the start of the application to be tested is a login interface includes:
s31, exporting the information of the interface after the application to be tested is started into a first file according to a first format;
s32, traversing the first file, searching for the package attribute of the first file, judging whether the package attribute in the first file is equal to the package attribute of the application to be tested, if so, starting the application to be tested, acquiring information of an interface after the application to be tested is started, and judging whether the interface after the application to be tested is started is a login interface; if not, restarting the application to be tested, and returning to execute the step S31.
As can be seen from the above description, the package attribute in the information of the interface after the application to be tested is started is compared with the package attribute of the application to be tested, so as to determine whether the application to be tested is started, thereby improving the accuracy in the automatic login process and ensuring that the preset login information is used for the corresponding application to be tested.
Further, the step S32 of obtaining the information of the interface after the start of the application to be tested, and determining whether the interface after the start of the application to be tested is a login interface includes:
parsing the first file while traversing the first file:
s321, judging whether a preset first field appears, if so, adding one to the value of a preset statistical parameter, wherein the preset statistical parameter is used for counting the number of times of appearance of the preset first field;
s322, judging whether a preset second field appears for the first time after the preset first field, if so, acquiring a first character sequence after the preset second field, and executing step S323; if not, traversing downwards and returning to the step S321;
s323, judging whether the first character sequence contains a preset second character sequence, if so, giving the value of the preset statistical parameter recorded currently to a custom parameter corresponding to the preset first field;
s324, judging whether the value of the preset statistical parameter is equal to a first preset value and the value of the custom parameter corresponding to the preset first field is not completely empty, if so, executing step S325; if not, the interface is not a login interface after the application to be tested is started, and the automatic login is ended;
s325, judging whether a preset third field is contained, if yes, executing the step S4, and if not, ending the automatic login.
According to the description, in the process of analyzing the first file, whether the interface is the login interface or not after the application to be tested is started is judged, so that the next operation is ensured under the login interface, the accuracy is improved, the text box position corresponding to the preset login information is confirmed, and the subsequent automatic login operation is facilitated.
Further, the step S4 includes:
the preset login information comprises first information and second information;
automatically inputting second information of preset login information into a text box corresponding to the preset first field corresponding to the user-defined parameter with a non-null value by using a UI (user interface) technology;
and automatically inputting the first information of the preset login information into the text boxes corresponding to the remaining preset first fields by using a UI technology.
According to the description, the preset login information is automatically input into the text boxes corresponding to the preset login information, so that the manual burden is reduced, and the working efficiency is improved.
Referring to fig. 2, a terminal for automatically logging in an application to be tested includes a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the following steps when executing the computer program:
s1, receiving an application to be tested, judging whether to start automatic login setting, and if yes, executing a step S2;
s2, judging whether preset login information corresponding to the application to be tested exists or not, if yes, acquiring the preset login information corresponding to the application to be tested, executing the step S3, and if no, receiving the preset login information and executing the step S3;
s3, acquiring information of the interface after the application to be tested is started, judging whether the interface after the application to be tested is started is a login interface, and if yes, executing the step S4;
s4, automatically inputting the preset login information into a text box of the login interface.
From the above description, the beneficial effects of the invention are as follows: whether the automatic login setting is started or not is judged by receiving the application to be tested, if yes, whether preset login information corresponding to the application to be tested exists or not is judged, if yes, information of an interface after the application to be tested is started is obtained, whether the interface after the application to be tested is started is a login interface or not is judged, if yes, the preset login information is automatically input into a text box of the login interface, the application to be tested can be automatically logged in, the labor burden is reduced, the working efficiency is improved, the automatic login method can be used for various automatic tests such as random test and script test, and the reusability is high.
Further, in the step S2, determining whether there is preset login information corresponding to the application to be tested specifically includes:
acquiring the name of the package of the application to be tested;
inquiring whether preset login information corresponding to the application to be tested exists or not according to the name of the package of the application to be tested.
As can be seen from the above description, the corresponding preset login information is queried according to the name of the package of the application to be tested, and a one-to-one correspondence between the application to be tested and the preset login information is established, so that the corresponding preset login information is convenient to obtain.
Further, the step S3 of obtaining the information of the interface after the start of the application to be tested, and determining whether the interface after the start of the application to be tested is a login interface includes:
s31, exporting the information of the interface after the application to be tested is started into a first file according to a first format;
s32, traversing the first file, searching for the package attribute of the first file, judging whether the package attribute in the first file is equal to the package attribute of the application to be tested, if so, starting the application to be tested, acquiring information of an interface after the application to be tested is started, and judging whether the interface after the application to be tested is started is a login interface; if not, restarting the application to be tested, and returning to execute the step S31.
As can be seen from the above description, the package attribute in the information of the interface after the application to be tested is started is compared with the package attribute of the application to be tested, so as to determine whether the application to be tested is started, thereby improving the accuracy in the automatic login process and ensuring that the preset login information is used for the corresponding application to be tested.
Further, the step S32 of obtaining the information of the interface after the start of the application to be tested, and determining whether the interface after the start of the application to be tested is a login interface includes:
parsing the first file while traversing the first file:
s321, judging whether a preset first field appears, if so, adding one to the value of a preset statistical parameter, wherein the preset statistical parameter is used for counting the number of times of appearance of the preset first field;
s322, judging whether a preset second field appears for the first time after the preset first field, if so, acquiring a first character sequence after the preset second field, and executing step S323; if not, traversing downwards and returning to the step S321;
s323, judging whether the first character sequence contains a preset second character sequence, if so, giving the value of the preset statistical parameter recorded currently to a custom parameter corresponding to the preset first field;
s324, judging whether the value of the preset statistical parameter is equal to a first preset value and the value of the custom parameter corresponding to the preset first field is not completely empty, if so, executing step S325; if not, the interface is not a login interface after the application to be tested is started, and the automatic login is ended;
s325, judging whether a preset third field is contained, if yes, executing the step S4, and if not, ending the automatic login.
According to the description, in the process of analyzing the first file, whether the interface is the login interface or not after the application to be tested is started is judged, so that the next operation is ensured under the login interface, the accuracy is improved, the text box position corresponding to the preset login information is confirmed, and the subsequent automatic login operation is facilitated.
Further, the step S4 includes:
the preset login information comprises first information and second information;
automatically inputting second information of preset login information into a text box corresponding to the preset first field corresponding to the user-defined parameter with a non-null value by using a UI (user interface) technology;
and automatically inputting the first information of the preset login information into the text boxes corresponding to the remaining preset first fields by using a UI technology.
According to the description, the preset login information is automatically input into the text boxes corresponding to the preset login information, so that the manual burden is reduced, and the working efficiency is improved.
Example 1
Referring to fig. 1 and 3, a method for automatically logging in an application to be tested includes the steps of:
s1, receiving an application to be tested, judging whether to start automatic login setting, and if yes, executing a step S2;
s2, judging whether preset login information corresponding to the application to be tested exists or not, if yes, acquiring the preset login information corresponding to the application to be tested, executing the step S3, and if no, receiving the preset login information and executing the step S3;
the judging whether the preset login information corresponding to the application to be tested exists specifically includes:
acquiring the name of the package of the application to be tested;
inquiring whether preset login information corresponding to the application to be tested exists or not according to the name of the package of the application to be tested.
Specifically, the name of the package of the application to be tested is transmitted into a database to inquire whether preset login information corresponding to the application to be tested exists, the preset login information comprises an account number and a password, and if yes, the account number and the password corresponding to the application to be tested are obtained; if not, receiving the name of the package of the application to be tested, the account number and the password for logging in, and storing the package of the application to be tested, the account number and the password into a database.
Installing the tested application and starting the tested application;
s3, acquiring information of the interface after the application to be tested is started, judging whether the interface after the application to be tested is started is a login interface, and if yes, executing the step S4;
the obtaining the information of the interface after the application to be tested is started, and judging whether the interface after the application to be tested is started is a login interface comprises the following steps:
s31, exporting the information of the interface after the application to be tested is started into a first file according to a first format;
the first format is a hierarchy and XML format, and specifically, the interface after the application to be tested is started is exported as a first file to a specified target position according to the hierarchy and the XML format.
S32, traversing the first file, searching for the package attribute of the first file, judging whether the package attribute in the first file is equal to the package attribute of the application to be tested, if so, starting the application to be tested, acquiring information of an interface after the application to be tested is started, and judging whether the interface after the application to be tested is started is a login interface; if not, restarting the application to be tested, and returning to execute the step S31.
The obtaining the information of the interface after the application to be tested is started, and judging whether the interface after the application to be tested is started is a login interface comprises the following steps:
parsing the first file while traversing the first file:
s321, judging whether a preset first field appears, if so, adding one to the value of a preset statistical parameter, wherein the preset statistical parameter is used for counting the number of times of appearance of the preset first field;
traversing and analyzing the first file according to the sequence from top to bottom; the preset first field is a text box control; because the login interface is usually an account frame and a password frame, the value of the preset statistical parameter is usually two;
s322, judging whether a preset second field appears for the first time after the preset first field, if so, acquiring a first character sequence after the preset second field, and executing step S323; if not, traversing downwards and returning to the step S321;
the second field is a password=, the second field is an attribute of the textbox control, and the first character sequence is a character sequence of 6 characters;
specifically, after finding the preset first field representing the text box each time, searching a second field with a password=appearing for the first time at a position behind the preset first field, and obtaining 6 characters with the password=as the first character sequence;
s323, judging whether the first character sequence contains a preset second character sequence, if so, giving the value of the preset statistical parameter recorded currently to a custom parameter corresponding to the preset first field;
wherein the second character sequence is true, and the name of the custom parameter is pwdEdit;
specifically, whether the first character sequence contains the second character sequence true is judged, namely whether the 6 last characters of the second field password=true are judged, if yes, the attribute password=true of the textbox control is judged, and the value of the preset statistical parameter recorded at present is given to the custom parameter pwdEdit corresponding to the preset first field;
the value of the customized parameter pwdEdit represents the position of the password frame on the interface, namely the text frame from top to bottom on the interface;
s324, judging whether the value of the preset statistical parameter is equal to a first preset value and the value of the custom parameter corresponding to the preset first field is not completely empty, if so, executing step S325; if not, the interface is not a login interface after the application to be tested is started, and the automatic login is ended;
wherein the first preset value is 2, which represents that 2 text boxes are needed; the value of the custom parameter is not completely null, and the text box comprises a password input box;
s325, judging whether a preset third field is contained, if yes, executing the step S4, and if not, ending the automatic login.
Wherein, the preset third field is "login";
specifically, whether a pattern field of ".+ -. Log" is contained is judged according to the regular expression, if yes, the login button is contained, and step S4 is executed; if not, the interface is not a login interface after the application to be tested is started, and the automatic login is ended;
s4, automatically inputting the preset login information into a text box of the login interface.
The preset login information comprises first information and second information, wherein the first information is an account number, and the second information is a password;
specifically, the second information of the preset login information, namely, the text box corresponding to the preset first field, corresponding to the user-defined parameter with the password automatic input value not being empty is input by using a UI technology;
automatically inputting first information of preset login information, namely the account number, into a text box corresponding to the remaining preset first field by using a UI (user interface) technology;
and clicking the login button judged according to the regular expression by using a UI technology to finish simulating manual automatic login and enter the next automatic test.
Example two
The method of the first embodiment is applied to a specific scenario, and the method is implemented in the case that the application to be tested is an Android application:
the developer selects the tested equipment, which can be an Android mobile phone or an Android Pad;
s1, receiving an Android application to be tested, judging whether to start automatic login setting, and if yes, executing a step S2;
the Android application to be tested is an application APP with APK suffix end;
s2, judging whether preset login information corresponding to the Android application to be tested exists or not, if yes, acquiring the preset login information corresponding to the Android application to be tested, executing the step S3, and if no, receiving the preset login information and executing the step S3;
the judging whether the preset login information corresponding to the Android application to be tested exists specifically includes:
acquiring the name of the package of the Android application to be tested;
inquiring whether preset login information corresponding to the Android application to be tested exists or not according to the name of the package of the Android application to be tested.
Specifically, the name of the package of the Android application to be tested is transmitted into a database to inquire whether preset login information corresponding to the Android application to be tested exists, the preset login information comprises an account number and a password, and if yes, the account number and the password corresponding to the Android application to be tested are obtained; if not, receiving the name of the package of the Android application to be tested, the account number and the password for logging in, and storing the package of the Android application to be tested, the account number and the password into a database.
Installing the Android application to be tested and starting the Android application to be tested;
s3, acquiring information of the interface after the Android application to be tested is started, judging whether the interface after the Android application to be tested is a login interface, and if yes, executing a step S4;
the obtaining the information of the interface after the Android application to be tested is started, and judging whether the interface after the Android application to be tested is a login interface comprises the following steps:
s31, exporting information of the interface after the Android application to be tested is started into a first file according to a first format;
wherein the first format is a hierarchy and an XML format;
specifically, executing a uiautomatic dump file command, exporting the interface after the Android application to be tested to a first file to a specified target position according to a hierarchy and an XML format, for example, a uiautomatic dump/sdcard/log in. XML command, wherein the exported target position is indicated as a root directory under the sd card of the Android device, and the file name of the exported first file is log in. XML;
s32, traversing the first file log.xml, searching for the package attribute of the first file, judging whether the package attribute in the first file is equal to the package attribute of the Android application to be tested, if so, enabling the Android application to be tested to be started, acquiring information of an interface after the Android application to be tested is started, and judging whether the interface after the Android application to be tested is a login interface; if not, restarting the Android application to be tested, and returning to execute the step S31.
The obtaining the information of the interface after the Android application to be tested is started, and judging whether the interface after the Android application to be tested is a login interface comprises the following steps:
parsing the first file while traversing the first file:
s321, judging whether a preset first field appears, if so, adding one to the value of a preset statistical parameter, wherein the preset statistical parameter is used for counting the number of times of appearance of the preset first field;
traversing and analyzing the first file according to the sequence from top to bottom; the preset first field is a text box control android.widget.edit text; because the login interface is usually an account frame and a password frame, the value of the preset statistical parameter is usually two;
s322, judging whether a preset second field appears for the first time after the preset first field, if so, acquiring a first character sequence after the preset second field, and executing step S323; if not, traversing downwards and returning to the step S321;
the second field is a password=, the second field is an attribute of the textbox control, and the first character sequence is a character sequence of 6 characters;
specifically, after finding the preset first field representing the text box each time, searching a second field with a password=appearing for the first time at a position behind the preset first field, and obtaining 6 characters with the password=as the first character sequence;
s323, judging whether the first character sequence contains a preset second character sequence, if so, giving the value of the preset statistical parameter recorded currently to a custom parameter corresponding to the preset first field;
wherein the second character sequence is true, and the name of the custom parameter is pwdEdit;
specifically, whether the first character sequence contains the second character sequence true is judged, namely whether the 6 last characters of the second field password=true are judged, if yes, the attribute password=true of the textbox control is judged, and the value of the preset statistical parameter recorded at present is given to the custom parameter pwdEdit corresponding to the preset first field;
the value of the customized parameter pwdEdit represents the position of the password frame on the interface, namely the text frame from top to bottom on the interface;
for example, after the android, widget, edit text appears for the second time, looking for the word of the password=after the android, widget, edit text, after finding, judging that the first character sequence "true" behind the password=contains the second character sequence true, and giving the value of the preset statistical parameter recorded currently to the customized parameter pwdEdit corresponding to the preset first field, namely pwdEdit=2, wherein the second android, widget, edit text box is a password box from top to bottom;
s324, judging whether the value of the preset statistical parameter is equal to a first preset value and the value of the custom parameter corresponding to the preset first field is not completely empty, if so, executing step S325; if not, the interface is not a login interface after the Android application to be tested is started, and the automatic login is ended;
wherein the first preset value is 2, which represents that 2 text boxes are needed; the value of the custom parameter is not completely null, and the text box comprises a password input box;
s325, judging whether a preset third field is contained, if yes, executing the step S4, and if not, ending the automatic login.
Wherein, the preset third field is "login";
specifically, whether a pattern field of ".+ -. Log" is contained is judged according to the regular expression, if yes, the login button is contained, and step S4 is executed; if not, the interface is not a login interface after the application to be tested is started, and the automatic login is ended;
s4, automatically inputting the preset login information into a text box of the login interface.
The preset login information comprises first information and second information, wherein the first information is an account number, and the second information is a password;
specifically, the second information of the preset login information, namely, the text box corresponding to the preset first field, corresponding to the user-defined parameter with the password automatic input value not being empty is input by using a UI technology;
automatically inputting first information of preset login information, namely the account number, into a text box corresponding to the remaining preset first field by using a UI (user interface) technology;
for example, the custom parameter pwdEdit=2, which indicates that the second android. Widget. Edit text box is a password box, so the password should be entered into the second text box, and there are only two text boxes altogether, so the first text box enters the account;
and clicking the login button judged according to the regular expression by using a UI technology to finish simulating manual automatic login and enter the next automatic test.
Example III
Referring to fig. 2, a terminal 1 for automatically logging in an application to be tested includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3, wherein the processor 3 implements the steps in the first embodiment when executing the computer program.
In summary, according to the method and the terminal for automatically logging in an application to be tested, whether the automatic login setting is started or not is judged by receiving the application to be tested, if yes, whether preset login information corresponding to the application to be tested exists or not is judged, if yes, information of an interface after the application to be tested is started is obtained, whether the interface after the application to be tested is a login interface is judged, if yes, the preset login information is automatically input into a text box of the login interface, the application to be tested can be automatically logged in, labor burden is reduced, and work efficiency is improved; the one-to-one correspondence between the application to be tested and the preset login information is established, the corresponding preset login information is conveniently obtained, the interface after the application to be tested is started is traversed and analyzed, the judgment is carried out for multiple times, the accuracy in the automatic login process is improved, the method can be used in various automatic tests such as random test and script test, and the reusability is high.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.

Claims (6)

1. A method for automatically logging in an application to be tested, comprising the steps of:
s1, receiving an application to be tested, judging whether to start automatic login setting, and if yes, executing a step S2;
s2, judging whether preset login information corresponding to the application to be tested exists or not, if yes, acquiring the preset login information corresponding to the application to be tested, executing the step S3, and if no, receiving the preset login information and executing the step S3;
s3, acquiring information of the interface after the application to be tested is started, judging whether the interface after the application to be tested is started is a login interface, and if yes, executing the step S4;
s4, automatically inputting the preset login information into a text box of the login interface;
the step S3 of obtaining the information of the interface after the start of the application to be tested, and determining whether the interface after the start of the application to be tested is a login interface includes:
s31, exporting the information of the interface after the application to be tested is started into a first file according to a first format;
s32, traversing the first file, searching for the package attribute of the first file, judging whether the package attribute in the first file is equal to the package attribute of the application to be tested, if so, starting the application to be tested, acquiring information of an interface after the application to be tested is started, and judging whether the interface after the application to be tested is started is a login interface; if not, restarting the application to be tested, and returning to execute the step S31;
the step S32 of obtaining the information of the interface after the start of the application to be tested, and determining whether the interface after the start of the application to be tested is a login interface includes:
parsing the first file while traversing the first file:
s321, judging whether a preset first field appears, if so, adding one to the value of a preset statistical parameter, wherein the preset statistical parameter is used for counting the number of times of appearance of the preset first field;
s322, judging whether a preset second field appears for the first time after the preset first field, if so, acquiring a first character sequence after the preset second field, and executing step S323; if not, traversing downwards and returning to the step S321;
s323, judging whether the first character sequence contains a preset second character sequence, if so, giving the value of the preset statistical parameter recorded currently to a custom parameter corresponding to the preset first field;
s324, judging whether the value of the preset statistical parameter is equal to a first preset value and the value of the custom parameter corresponding to the preset first field is not completely empty, if so, executing step S325; if not, the interface is not a login interface after the application to be tested is started, and the automatic login is ended;
s325, judging whether a preset third field is contained, if yes, executing the step S4, and if not, ending the automatic login.
2. The method for automatically logging in an application to be tested according to claim 1, wherein the step S2 of determining whether the preset login information corresponding to the application to be tested exists specifically includes:
acquiring the name of the package of the application to be tested;
inquiring whether preset login information corresponding to the application to be tested exists or not according to the name of the package of the application to be tested.
3. The method for automatically logging in an application to be tested according to claim 1, wherein the step S4 comprises:
the preset login information comprises first information and second information;
automatically inputting second information of preset login information into a text box corresponding to the preset first field corresponding to the user-defined parameter with a non-null value by using a UI (user interface) technology;
and automatically inputting the first information of the preset login information into the text boxes corresponding to the remaining preset first fields by using a UI technology.
4. A terminal for automatic logging of an application to be tested, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the following steps when executing the computer program:
s1, receiving an application to be tested, judging whether to start automatic login setting, and if yes, executing a step S2;
s2, judging whether preset login information corresponding to the application to be tested exists or not, if yes, acquiring the preset login information corresponding to the application to be tested, executing the step S3, and if no, receiving the preset login information and executing the step S3;
s3, acquiring information of the interface after the application to be tested is started, judging whether the interface after the application to be tested is started is a login interface, and if yes, executing the step S4;
s4, automatically inputting the preset login information into a text box of the login interface;
the step S3 of obtaining the information of the interface after the start of the application to be tested, and determining whether the interface after the start of the application to be tested is a login interface includes:
s31, exporting the information of the interface after the application to be tested is started into a first file according to a first format;
s32, traversing the first file, searching for the package attribute of the first file, judging whether the package attribute in the first file is equal to the package attribute of the application to be tested, if so, starting the application to be tested, acquiring information of an interface after the application to be tested is started, and judging whether the interface after the application to be tested is started is a login interface; if not, restarting the application to be tested, and returning to execute the step S31;
the step S32 of obtaining the information of the interface after the start of the application to be tested, and determining whether the interface after the start of the application to be tested is a login interface includes:
parsing the first file while traversing the first file:
s321, judging whether a preset first field appears, if so, adding one to the value of a preset statistical parameter, wherein the preset statistical parameter is used for counting the number of times of appearance of the preset first field;
s322, judging whether a preset second field appears for the first time after the preset first field, if so, acquiring a first character sequence after the preset second field, and executing step S323; if not, traversing downwards and returning to the step S321;
s323, judging whether the first character sequence contains a preset second character sequence, if so, giving the value of the preset statistical parameter recorded currently to a custom parameter corresponding to the preset first field;
s324, judging whether the value of the preset statistical parameter is equal to a first preset value and the value of the custom parameter corresponding to the preset first field is not completely empty, if so, executing step S325; if not, the interface is not a login interface after the application to be tested is started, and the automatic login is ended;
s325, judging whether a preset third field is contained, if yes, executing the step S4, and if not, ending the automatic login.
5. The terminal for automatically logging in an application to be tested according to claim 4, wherein the step S2 of determining whether the preset login information corresponding to the application to be tested exists specifically includes:
setting login information.
6. The terminal for automatically logging in an application to be tested according to claim 4, wherein said step S4 comprises:
the preset login information comprises first information and second information;
automatically inputting second information of preset login information into a text box corresponding to the preset first field corresponding to the user-defined parameter with a non-null value by using a UI (user interface) technology;
and automatically inputting the first information of the preset login information into the text boxes corresponding to the remaining preset first fields by using a UI technology.
CN201811182408.XA 2018-10-11 2018-10-11 Method and terminal for automatically logging in application to be tested Active CN111045913B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811182408.XA CN111045913B (en) 2018-10-11 2018-10-11 Method and terminal for automatically logging in application to be tested

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811182408.XA CN111045913B (en) 2018-10-11 2018-10-11 Method and terminal for automatically logging in application to be tested

Publications (2)

Publication Number Publication Date
CN111045913A CN111045913A (en) 2020-04-21
CN111045913B true CN111045913B (en) 2023-07-07

Family

ID=70229029

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811182408.XA Active CN111045913B (en) 2018-10-11 2018-10-11 Method and terminal for automatically logging in application to be tested

Country Status (1)

Country Link
CN (1) CN111045913B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104683327A (en) * 2015-01-29 2015-06-03 中国科学院信息工程研究所 Method for detecting safety of user login interface of Android software
CN106790686A (en) * 2017-02-16 2017-05-31 上海斐讯数据通信技术有限公司 A kind of user name password fill method and system
CN106982226A (en) * 2017-04-27 2017-07-25 成都奇鲁科技有限公司 Automatic logging method and device
CN107402877A (en) * 2016-05-19 2017-11-28 福建天晴数码有限公司 APP method of testings and system based on Android ends

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9635556B2 (en) * 2015-05-13 2017-04-25 Spotify Ab Automatic login on a website by means of an app

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104683327A (en) * 2015-01-29 2015-06-03 中国科学院信息工程研究所 Method for detecting safety of user login interface of Android software
CN107402877A (en) * 2016-05-19 2017-11-28 福建天晴数码有限公司 APP method of testings and system based on Android ends
CN106790686A (en) * 2017-02-16 2017-05-31 上海斐讯数据通信技术有限公司 A kind of user name password fill method and system
CN106982226A (en) * 2017-04-27 2017-07-25 成都奇鲁科技有限公司 Automatic logging method and device

Also Published As

Publication number Publication date
CN111045913A (en) 2020-04-21

Similar Documents

Publication Publication Date Title
CN107704395B (en) Cloud platform automation test implementation method and system based on Openstack
CN109840206B (en) Data testing method, device, terminal and storage medium
US8635593B2 (en) Dynamic autocompletion tool
CN111596965A (en) Project engineering initialization method, device, computer equipment and storage medium
US7661053B2 (en) Methods and apparatus for patternizing device responses
CN106649107B (en) Automatic testing method and device for stability of android system
CN110399299A (en) The execution method of automated test frame and test case
CN113467868B (en) Method and device for creating equipment resources
CN105740144A (en) Automated testing method and system for Android mobile Terminal
CN107741846A (en) FPGA engineering process management optimizations design method, system and storage medium
CN105354138A (en) Method for determining specific control attribute of mobile phone page
KR101986476B1 (en) Program writing device
CN112231206A (en) Script editing method for application program test, computer readable storage medium and test platform
CN109840201B (en) UI test method, device, electronic equipment and computer readable storage medium
US20160124780A1 (en) Automatic Profiling Report Generation
CN111045913B (en) Method and terminal for automatically logging in application to be tested
CN110413974A (en) Form template configuration and device, table deriving method and device
CN112346946B (en) User software operation behavior monitoring method and system based on control positioning
CN113420189A (en) Intelligent terminal android App control method and system based on RPA
US11106571B2 (en) Identification of input object in a graphical user interface
CN112463272A (en) Interface layout loading display method and system, electronic equipment and storage medium
CN112825033A (en) Interface code generation method, device, equipment and storage medium
CN116400846A (en) Realization method, equipment and medium for simulating touch operation 3D application
CN110825649A (en) Application testing method, device, equipment and storage medium
CN111124386B (en) Animation event processing method, device, equipment and storage medium based on Unity

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