CN112256563A - Android application stability testing method and device, electronic equipment and storage medium - Google Patents
Android application stability testing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112256563A CN112256563A CN202011011091.0A CN202011011091A CN112256563A CN 112256563 A CN112256563 A CN 112256563A CN 202011011091 A CN202011011091 A CN 202011011091A CN 112256563 A CN112256563 A CN 112256563A
- Authority
- CN
- China
- Prior art keywords
- page
- event
- type
- application program
- events
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/362—Debugging of software
- G06F11/3644—Debugging of software by instrumenting at runtime
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/362—Debugging of software
- G06F11/366—Debugging of software using diagnostics
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present disclosure provides an android application stability testing method, device, electronic device and storage medium, wherein the method comprises the following steps: when a test instruction is detected, acquiring page script parameters of an application program to be tested, wherein the page script parameters are preset according to feature data of different pages, and the method comprises the following steps: the method comprises the following steps of counting the total number of events to be operated, application program components corresponding to different pages and corresponding events of different areas of the different pages; testing the page script parameters; if the application program component where the current page is located is the page of the application program to be tested, determining the page type of the current page; carrying out random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type to which the current page belongs; and when the total number of the events is completed, sending the generated event operation report to the user. The present disclosure improves the stability of the test.
Description
Technical Field
The present disclosure relates to the field of terminal application testing technologies, and in particular, to a method and an apparatus for testing stability of an android application, an electronic device, and a storage medium.
Background
In the related art, a conventional stability test triggers a random event through monkey, which is a command line tool provided by an Android Software Development Kit (SDK) and can run on an Android simulator and a physical device. monkey may send a pseudo-random stream of user events (e.g., key input, touch input, gesture input, etc.) to enable stress testing of the Application under development (App). However, the stability test triggers the same event for any page scene, cannot distinguish the pages, and cannot allocate corresponding operations to different pages, so that a large amount of useless operations exist in random events during the stability test, the test time is wasted, and the test efficiency is reduced.
Therefore, how to trigger different events for different pages in the stability test and shield useless operations to improve the test efficiency is a technical problem to be solved at present.
Disclosure of Invention
The disclosure provides an android application stability testing method, an android application stability testing device, an electronic device and a storage medium, and aims to at least solve the technical problem that in the related art, since different events cannot be triggered aiming at different pages when a monkey is used for stability testing, a large number of useless area operations exist in random events during testing. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided an android application stability testing method, including:
when a test instruction is detected, acquiring page script parameters of an application program to be tested, wherein the page script parameters are preset according to feature data of different pages, and the method comprises the following steps: the method comprises the following steps of counting the total number of events to be operated, application program components corresponding to different pages and corresponding events of different areas of the different pages;
testing the page script parameters;
if the application program component where the current page is located is the page of the application program to be tested, determining the page type of the current page;
carrying out random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type to which the current page belongs;
generating an event operation report when the total number of events is completed, wherein the event operation report at least comprises: the total execution time of the running event and the detailed information of the error event.
Optionally, the method further includes:
if the application program component where the current page is located is not the page of the application program to be tested, the page of the current application program to be tested is automatically called, and the step of performing random event operation on corresponding events in different areas of the current page according to the probability of the preset event is executed.
Optionally, on the basis of the foregoing embodiment, the method further includes:
and if the total number of the events is not finished, judging whether the application program assembly where the current page is located is the page of the application program to be tested according to the set time.
Optionally, on the basis of the foregoing embodiment, the determining a page type to which the current page belongs includes:
if the current page comprises button keys, determining that the page type of the current page is a first type page;
if the current page comprises the up-down sliding list, determining that the page type of the current page is a second type page;
and if the current page comprises the left-right sliding list, determining that the page type of the current page is a third type page.
Optionally, on the basis of the foregoing embodiment, before performing the random event operation, the method further includes:
setting different operation probabilities aiming at corresponding events in different types of pages in advance, wherein the different types of pages at least comprise: a first type page, a second type page, and a third type page.
Optionally, on the basis of the foregoing embodiment, when the corresponding event includes: the method comprises the following steps of (1) carrying out a first type of operation event, a second type of operation event and/or a third type of operation event;
the setting different probabilities for corresponding events in different types of pages in advance at least comprises one of the following steps:
setting the operation probability of a first type of operation event as A% and setting the operation probability of a second type of operation event and/or a third type of operation event as B% for the first type of page, wherein A% is greater than B%, and A% + B% is 1;
setting the operation probability of a second type of operation event as A% and setting the operation probability of a first type of operation event as B% for the second type page, wherein A% is more than B%, and A% + B% is 1;
and for the third type page, setting the operation probability of a third type operation event as A%, setting the operation probability of the first type operation event as B%, wherein A% is more than B%, and A% + B% is 1.
According to a second aspect of the embodiments of the present disclosure, there is provided an android application stability testing apparatus, including:
the obtaining module is configured to execute, when a test instruction is detected, obtaining a page script parameter of an application program to be tested, where the page script parameter is preset according to feature data of different pages, and the obtaining module includes: the method comprises the following steps of counting the total number of events to be operated, application program components corresponding to different pages and corresponding events of different areas of the different pages;
a test module configured to perform testing of the page script parameters;
the determining module is configured to determine the page type of the current page when the application program component where the current page is located is the page of the application program to be tested;
the event operation module is configured to execute random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type to which the current page belongs;
a generating module configured to perform generating an event operation report when the total number of events is completed, wherein the event operation report at least includes: the total execution time of the running event and the detailed information of the error event.
Optionally, on the basis of the foregoing embodiment, the apparatus further includes:
the first judgment module is configured to judge whether the application program component where the current page is located is the page of the application program to be tested according to set time in the test process;
the calling module is configured to automatically call the page of the current application program to be tested when the first judging module judges that the application program component where the current page is located is not the page of the application program to be tested;
the event operation module is also configured to perform random event operation on corresponding events in different areas of the current page according to the probability of a preset event after the page of the current application program to be tested is automatically called by the calling-up module;
the determining module is further configured to determine the page type of the current page when the first judging module judges that the application program component where the current page is located is the page of the application program to be tested.
Optionally, on the basis of the foregoing embodiment, the apparatus further includes:
a second judging module configured to execute a judgment on whether the execution of the total number of events is completed;
the generation module is further configured to execute the generation of an event operation report when the second module determines that the execution of the total number of events is completed;
the first judging module is further configured to continuously judge whether the application program component where the current page is located is the page of the application program to be tested according to the set time when the second judging module judges that the total number of the events is not completed.
Optionally, on the basis of the foregoing embodiment, the determining module includes:
the first determining module is configured to determine that the page type of the current page is a first type page when the current page comprises button keys;
the second determining module is configured to determine that the page type of the current page is a second type page when the current page comprises the up-down sliding list;
and the third determining module is configured to determine that the page type to which the current page belongs is a third type page when the left-right sliding list is included in the current page.
Optionally, on the basis of the foregoing embodiment, the apparatus further includes:
a setting module configured to execute, before the event operation module performs a random event operation, setting different operation probabilities in advance for corresponding events in different types of pages, where the different types of pages at least include: a first type page, a second type page, and a third type page.
Optionally, on the basis of the above embodiment, when the corresponding event acquired by the acquisition module includes: the method comprises the following steps of (1) carrying out a first type of operation event, a second type of operation event and/or a third type of operation event;
the setting module at least comprises one of the following components:
the first probability setting module is configured to execute setting of an operation probability of a first type of operation event to be A% and setting of an operation probability of the second type of operation event and/or a third type of operation event to be B% for the first type of page, wherein A% is greater than B%, and A% + B% is 1;
the second probability setting module is configured to execute setting the operation probability of the second type of operation event to be A% and setting the operation probability of the first type of operation event to be B% for the second type of page, wherein A% is greater than B%, and A% + B% is 1;
and the third probability setting module is configured to execute setting of the third type page, the operation probability of the third type operation event is set to be A%, the operation probability of the first type operation event is set to be B%, and A% > B%, and A% + B% ═ 1.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the android application stability testing method as described above.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a storage medium, wherein instructions of the storage medium, when executed by a processor of an electronic device, enable the electronic device to execute the android application stability testing method as described in any one of the above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, wherein instructions of the computer program product, when executed by a processor of the electronic device, cause the electronic device to execute any one of the above-mentioned android application stability test methods.
The technical scheme provided by the embodiment of the disclosure at least has the following beneficial effects:
according to the android application stability testing method shown in the exemplary embodiment, when a testing instruction input by a user is detected, a page script parameter of an application program to be tested is obtained; testing the page script parameters; when the application program component where the current page is located is the page of the application program to be tested, determining the page type of the current page; carrying out random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type of the current page; and when the total number of the events is completed, sending the generated event operation report to the user. That is to say, according to different page characteristics, the method and the device allocate different operation probabilities to corresponding events in different areas of different pages, realize more effective stability tests in different service scenes when a test tool is used for more effective random operation on page script parameters of an application program to be tested, and partition the pages, shield invalid operations caused by positions of a status bar, a virtual key and the like, so that the stability of the tests is improved, the test time is saved, and the test efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow diagram illustrating a method for android application stability testing, according to an example embodiment.
FIG. 2 is another flow diagram illustrating a method for android application stability testing, according to an example embodiment.
Fig. 3 is a block diagram illustrating an apparatus for android application stability testing, according to an example embodiment.
Fig. 4 is another block diagram illustrating an apparatus for android application stability testing, according to an example embodiment.
Fig. 5 is yet another block diagram illustrating an apparatus for android application stability testing, according to an example embodiment.
FIG. 6 is a block diagram illustrating the structure of an electronic device in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating an apparatus for android application stability testing, according to an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a flowchart illustrating an android application stability testing method according to an exemplary embodiment, where as shown in fig. 1, the android application stability testing method is used in a terminal, and includes the following steps:
in step 101, when a test instruction is detected, acquiring a page script parameter of an application program to be tested, where the page script parameter is preset according to feature data of different pages, and the page script parameter includes: the total number of events to be run, the activity of the application program components corresponding to different pages and the corresponding events of different areas of the different pages;
in step 102, testing the page script parameters;
in step 103, if the activity of the current page is the page of the application program to be tested, determining the page type of the current page;
in step 104, performing random event operation on corresponding events in different areas of the current page according to the probability of a preset event in the page type to which the current page belongs;
in step 105, generating an event operation report when the total number of events is completed, wherein the event operation report at least comprises: the total execution time of the running event and the detailed information of the error event.
The android application stability test can be applied to terminals, servers and the like, and is not limited here, and the terminal implementation equipment can be electronic equipment such as a smart phone, a notebook computer and a tablet personal computer, and is not limited here.
The following describes in detail specific implementation steps of the android application stability testing method provided by the embodiment of the present disclosure with reference to fig. 1.
Firstly, step 101 is executed, and when a test instruction is detected, a page script parameter of an application program to be tested is obtained, wherein the page script parameter is preset according to feature data of different pages, and the method includes: the method comprises the following steps of (1) counting the total number of events to be run, application program components (activity) corresponding to different pages and corresponding events of different areas of the different pages;
the total number of events to be executed included in the parameters of the page script is preset, for example, the total number of events to be executed is 10 ten thousand, and the general running time of the events can be embodied through the total number of events, specifically: the total running time of all events is not very accurate, because the running time of each event is not very accurate, and the time used by each type of event is also different;
the parameters of the page script comprise application program components corresponding to different pages; the application components corresponding to each page can be captured by a tool, and the specific process is well known in the art and will not be described herein.
The parameters of the page script include corresponding events of different areas of different pages, wherein the corresponding events may include: click time, slide up and down event, slide left and right event, drag event, long time, etc., but in practical applications, it is not limited to such events.
In this embodiment, the page script parameters of the application to be tested need to be determined in advance, and one determination method is as follows: the method comprises the steps of firstly capturing activity and page elements of different pages through a tool, then determining unique identification IDs of the corresponding pages according to the activity and the page elements, and finally setting distribution probabilities of corresponding events in different areas on the different pages according to the characteristics of page types of the different pages, thereby realizing more effective stability test according to different service scenes. Meanwhile, the page can be configured according to the requirement, and the event type and the event occurrence operation probability of the operation to be executed in the corresponding area of the page can be configured. For example, the status bar and the home key on the page can be shielded, so as to avoid the operation of network breaking or switching to the desktop in the operation process.
Secondly, executing step 102, and testing the page script parameters;
in this step, a test tool (such as monkeyunner) may be utilized to perform automated random test operations on the page script parameters. Where the monkey launcher runs on a PC, it is necessary to send instructions to an android (android) application on the device or simulator through a server/client mode to perform the test. The monkeyunner can accept a definite test script (the test script is written in python language), and the test script has definite statements such as conditional judgment and the like so as to be used for the performance test. The monkey launcher tool comprises a package for a system operation interface, such as operations of a home key, a volume key, a power supply and other keys, and can realize operations of clicking (touch), sliding (drag) and the like on a mobile phone application based on a coordinate point. The specific testing process is well known to those skilled in the art and will not be described herein.
Thirdly, executing step 103, if the application program component where the current page is located is the page of the application program to be tested, determining the page type of the current page;
in this step, it is required to detect whether the activity of the application component of the current page is the page of the application to be tested every preset time (for example, 1 min), and if so, determine the page type to which the current page belongs.
The specific detection mode can comprise: acquiring the activity of an application program component where a current page is located by utilizing an adb shell dump sys statement, namely viewing system service related information; then, whether the activity of the application program component where the current page is located is the page of the application program to be tested is determined. Among them, Activity is one of the four most basic and most commonly used components (Activity, Service, Content Provider, broadcastrecherver broadcast receiver) in Android components. Activity is an application component that provides a screen that a user can interact with to complete a task.
In this embodiment, for a mobile terminal (such as a mobile phone) below the android8.0 system, an adb shell dump activity | grep 'mresusedactivity' command may be used to obtain activity;
for mobile terminals of systems of android8.0 and above, activity may be obtained using an adb shell duty activity | grid 'mFocusedActivity' command.
In this implementation, when the activity of the current page is a page of the application to be tested, determining a page type to which the current page belongs includes:
if the current page comprises button keys, determining that the page type of the current page is a first type page;
if the current page comprises the up-down sliding list, determining that the page type of the current page is a second type page;
and if the current page comprises the left-right sliding list, determining that the page type of the current page is a third type page.
Of course, in practical application, the page types are not limited to the above three types of pages, and the page types may be divided according to actual needs.
In the step, the type of the page is determined according to different page characteristics, so that different event distribution is performed on different page types in the follow-up process, and random operation of the page is more effectively improved.
Thirdly, executing step 104, and performing random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type to which the current page belongs;
before this step, different operation probabilities are set in advance for corresponding events in different types of pages, where the different types of pages at least include: a first type page, a second type page, and a third type page.
Specifically, when the corresponding event includes: a first type of operation event, a second type of operation event and a third type of operation event; in this embodiment, the first type of operation event may include, but is not limited to: click events, etc.; the second type of operational event may include, but is not limited to: up-down sliding event, dragging event and long pressing event; the third category of operational events includes, but is not limited to: slide left and right events, drag events, and the like.
The setting different probabilities for corresponding events in different types of pages in advance comprises one of the following:
for the first type page (such as page A), setting the operation probability of a first type operation event as A%, setting the operation probability of the second type operation event and/or the third type operation event as B%, wherein A% is greater than B%, and A% + B% is 1; for example, setting A% to 80% and B% to 20%; in this case, for example, a% is set to 85%, B% is set to 15%, and so on.
That is, the operation proportion (probability) of the click event in the first type page is configurable to be larger, such as 80% of the operation probability configured for the click event; the other operation percentage is smaller than the configurable percentage, for example, the operation probability configured for the up-down sliding event and/or the drag event and/or the long-term event is 20%, etc., of course, the operation probability configured for the click event may also be 70%, and the operation probability configured for the up-down sliding event and/or the drag event and/or the long-term event is 30%, etc.
Setting the operation probability of the second type of operation event as A% and the operation probability of the first type of operation event as B% for the second type of page (such as page B), wherein A% is greater than B%, and A% + B% is 1;
that is, the operation ratio (probability) of the up-down sliding event and/or the drag event in the second type page is greater than that required to be configured, for example, the operation probability configured for the up-down sliding event and/or the drag event is 80%; other operation percentage may be smaller than the configurable percentage, for example, the operation probability configured for the click event is 20%, and the like, and of course, the operation probability configured for the up-down sliding event and/or the drag event may also be 70%, and the operation probability configured for the click event is 30%, and the like.
For the third type page (such as page C), the operation probability of the third type operation event is set to be a%, the operation probability of the first type operation event is set to be B%, and a% > B%, and a% + B% ═ 1.
That is, the operation ratio (probability) of the up-down sliding event and/or the drag event in the second type page is greater than that required to be configured, for example, the operation probability configured for the up-down sliding event and/or the drag event is 80%; other operation percentage may be smaller than the configurable percentage, for example, the operation probability configured for the click event is 20%, and the like, and of course, the operation probability configured for the up-down sliding event and/or the drag event may also be 70%, and the operation probability configured for the click event is 30%, and the like.
The probability of assigning an event to another designated area of the page may be 0, for example, the probability of assigning an event to an area such as a virtual button of the notification bar is 0, which corresponds to an operation of masking the area.
In other words, in the step, invalid operations caused by positions of the status bar, the virtual keys and the like are shielded by partitioning the page, so that the test stability is improved, the test time is saved, and the test efficiency is improved.
Finally, step 105 is executed to generate an event operation report when the total number of events is completed, where the event operation report at least includes: the total execution time of the running event and the detailed information of the error event.
Wherein, in this step, after the execution is completed, an event operation report is generated, which may include the total execution time of the running event, and details of the error event, such as the number of discovery crash (crash)/application no response (anr), and the detailed information of discovery crash/anr, etc.
According to the android application stability testing method shown in the exemplary embodiment, when a testing instruction input by a user is detected, a page script parameter of an application program to be tested is obtained; testing the page script parameters; when the activity of the current page is the page of the application program to be tested, determining the page type of the current page; carrying out random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type of the current page; generating an event operation report when the total number of events is completed. That is to say, according to the present disclosure, by obtaining the page script parameters of the application program to be tested, and according to the feature data of different pages in the page script parameters, different operation probabilities are assigned to corresponding events in different areas of different pages, and when a test tool is used to perform more effective random operation on the page script parameters of the application program to be tested, more effective stability tests in different service scenarios are implemented, and meanwhile, the pages are partitioned, so that invalid operations caused by positions of a status bar, a virtual key and the like are shielded, which not only improves the stability of the tests, but also saves the test time and improves the test efficiency.
Optionally, in another embodiment, on the basis of the above embodiment, the method may further include: sending the generated event operation report to the user, wherein the event operation report at least comprises: the total execution time of the running event and the detailed information of the error event.
In this embodiment, the generated time operation report may be sent directly to the development and maintenance personnel and/or the testing personnel in the form of an email.
That is, in this step, after all events are detected to generate event operation reports, the detection is finished, and the generated event operation reports including the total execution time of the operation events and the detailed information of the error events are sent to maintenance personnel or testing personnel by mail. Of course, the detailed information of the error event may also be sent to maintenance personnel, test personnel, or the like. So that the maintenance personnel or the testing personnel can analyze and process the detailed information of the error event.
In this embodiment, the generated event operation report includes the total execution time of the operation event and the detailed information of the error event, that is, the report information is relatively perfect, and the error event of the event operation report is timely synchronized to the maintenance personnel, so that the maintenance personnel can perform timely maintenance according to the details of the error event.
Referring to fig. 2, another flowchart of an android application stability testing method provided in an embodiment of the present disclosure is shown, where the method includes:
step 201: when a test instruction is detected, acquiring page script parameters of an application program to be tested, wherein the page script parameters are preset according to feature data of different pages, and the method comprises the following steps: the method comprises the following steps of counting the total number of events to be operated, application program components corresponding to different pages and corresponding events of different areas of the different pages;
step 202: testing the page script parameters;
step 201 and step 202 in this embodiment are the same as step 101 and step 102, and are described in detail above, and are not described herein again.
Step 203: in the testing process, judging whether the activity of the current page is the page of the application program to be tested according to the set time, if not, executing the step 204; if yes, go to step 205;
in this step, an adb shell dump sys statement can be used to obtain the activity of the application program component where the current page is located, that is, to view the system service related information; then, whether the activity of the application program component where the current page is located is the page of the application program to be tested is determined. The specific implementation process is described in detail above, and is not described herein again.
Step 204: automatically calling up the page of the current application program to be tested, and then executing the step 205;
in the step, one mode can call up the page of the app of the application program to be tested through an adb command adb shell am start-a android. Of course, in practical application, the method is not limited to this, and other commands may also be passed through, and this embodiment is not limited to this.
Step 205: determining a page type of a current page;
step 206: carrying out random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type to which the current page belongs;
step 205 and step 206 in this embodiment are the same as step 103 and step 104 in the above embodiment, and are described in detail above, and are not described herein again.
Step 207: judging whether the total number of the events is executed, if so, executing step 208; otherwise, returning to step 203;
in this step, it is determined whether the total number of events to be executed is completely detected.
Step 208: generating an event operation report, wherein the event operation report at least comprises: the total execution time of the running event and the detailed information of the error event;
the method further comprises the following steps:
step 209: and sending the generated event operation report.
The event operation report may be sent to maintenance personnel or testing personnel, etc.
According to different page characteristics, different operation probabilities are distributed for corresponding events in different areas of different pages, and when a test tool is used for carrying out more effective random operation on page script parameters of an application program to be tested and detecting that an application program component where the current page is located is not the page of the application program to be tested, the page of the current application program to be tested is automatically called up, so that more effective stability test of different service scenes is realized, meanwhile, the page is partitioned, invalid operation caused by positions of a status bar, a virtual key and the like is shielded, the test stability is improved, the test time is saved, and the test efficiency is improved.
It is noted that, for simplicity of explanation, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will appreciate that the present disclosure is not limited by the order of acts described, as some steps may, in accordance with the present disclosure, occur in other orders and/or concurrently. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required in order to implement the disclosure.
FIG. 3 is a block diagram illustrating an apparatus for android application stability testing, according to an example embodiment. Referring to fig. 3, the apparatus includes: an acquisition module 301, a test module 302, a determination module 303, an event operation module 304, and a generation module 305. Wherein,
the obtaining module 301 is configured to, when a test instruction is detected, obtain a page script parameter of an application program to be tested, where the page script parameter is preset according to feature data of different pages, and includes: the total number of events to be run, the activity of the application program components corresponding to different pages and the corresponding events of different areas of the different pages;
the test module 302 is configured to perform a test on the page script parameters;
the determining module 303 is configured to determine a page type to which the current page belongs when the activity of the current page is the page of the application to be tested;
the event operation module 304 is configured to perform a random event operation on corresponding events in different areas of the current page according to the probability of a preset event in the page type to which the current page belongs;
the generating module 305 is configured to execute generating an event operation report when the total number of events is completed, wherein the event operation report at least includes: the total execution time of the running event and the detailed information of the error event.
Optionally, in another embodiment, on the basis of the above embodiment, the apparatus may further include: a sending module for sending, wherein,
the sending module is configured to send the event operation report generated by the generating module to a maintenance person or a testing person, so that the maintenance person or the testing person can analyze and process the event operation report according to detailed information of an error event in the event operation report.
Optionally, in another embodiment, on the basis of the above embodiment, the apparatus may further include: a first determining module 401 and a tuning-up module 402, which are schematically shown in fig. 4, wherein,
the first determining module 401 is configured to determine, according to a set time, whether the activity of the current page is a page of the application to be tested in the testing process;
the invoking module 402 is configured to execute automatically invoking the page of the current application program to be tested when the first determining module 401 determines that the activity where the current page is located is not the page of the application program to be tested;
the determining module 303 is further configured to determine a page type to which the current page belongs when the first determining module 401 determines that the activity where the current page is located is the page of the application to be tested;
the event operation module 304 is further configured to perform a random event operation on corresponding events in different areas of the current page according to the probability of a preset event after the page of the current application to be tested is automatically called up by the call-up module 402;
optionally, in another embodiment, on the basis of the above embodiment, the apparatus may further include: a second determination module, wherein,
the second judging module is configured to execute and judge whether the execution of the total number of the events is completed;
the generation module is further configured to execute the generation of an event operation report when the second module judges that the execution of the total number of events is completed;
the first judging module is further configured to execute, when the second judging module judges that the execution of the total number of events is not completed, continuously judging whether the activity where the current page is located is the page of the application to be tested according to the set time.
Optionally, in another embodiment, on the basis of the foregoing embodiment, the determining module includes: a first determination module, a second determination module, and a third determination module, wherein,
the first determining module is configured to determine that the page type of the current page is a first type page when the current page comprises button keys;
the second determining module is configured to determine that the page type to which the current page belongs is a second type page when the current page includes the up-down sliding list;
the third determining module is configured to determine that the page type to which the current page belongs is a third type page when the left-right sliding list is included in the current page.
Optionally, in another embodiment, on the basis of the above embodiment, the apparatus may further include: a configuration module 501 is schematically shown in fig. 5, wherein,
a setting module 501, configured to perform, before the event operation module 304 performs a random event operation, setting different operation probabilities in advance for corresponding events in different types of pages, where the different types of pages at least include: a first type page, a second type page, and a third type page.
Alternatively, in another embodiment, which is based on the above-described embodiment,
when the corresponding event acquired by the acquisition module includes: the method comprises the following steps of (1) carrying out a first type of operation event, a second type of operation event and/or a third type of operation event;
the setting module at least comprises one of the following components: a first probability setting module, a second probability setting module and a third probability setting module,
the first probability setting module is configured to execute setting of an operation probability of a first type of operation event to be A% and setting of an operation probability of the second type of operation event and/or a third type of operation event to be B% for the first type of page, wherein A% is greater than B%, and A% + B% is 1;
the second probability setting module is configured to execute setting the operation probability of the second type of operation event to be A% and setting the operation probability of the first type of operation event to be B% for the second type of page, wherein A% is greater than B%, and A% + B% is 1;
and the third probability setting module is configured to execute setting of the third type page, the operation probability of the third type operation event is set to be A%, the operation probability of the first type operation event is set to be B%, and A% > B%, and A% + B% ═ 1.
With regard to the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment related to the method, and reference may be made to part of the description of the embodiment of the method for the relevant points, and the detailed description will not be made here.
In an exemplary embodiment, an embodiment of the present disclosure further provides an electronic device, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the android application stability testing method as described above.
In an exemplary embodiment, the present disclosure provides a storage medium, and when executed by a processor of an electronic device, the instructions in the storage medium enable the electronic device to execute the android application stability test method as described above.
In an exemplary embodiment, there is also provided a storage medium comprising instructions, such as a memory comprising instructions, executable by a processor of an apparatus to perform the above method. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Fig. 6 is a block diagram illustrating an electronic device 600 according to an example embodiment. For example, the electronic device 600 may be a mobile terminal or a server, and in the embodiment of the present disclosure, the electronic device is taken as a mobile terminal for example. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 6, electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an interface to input/output (I/O) 612, a sensor component 614, and a communication component 616.
The processing component 602 generally controls overall operation of the electronic device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operation at the device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 600 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, the audio component 610 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects of the electronic device 600. For example, the sensor component 614 may detect an open/closed state of the device 600, the relative positioning of components, such as a display and keypad of the electronic device 600, the sensor component 614 may also detect a change in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, orientation or acceleration/deceleration of the electronic device 600, and a change in the temperature of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communications between the electronic device 600 and other devices in a wired or wireless manner. The electronic device 600 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the android application stability testing methods shown above.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 620 of the electronic device 600 to perform the android application stability testing method shown above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program product, wherein instructions of the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the above-described android application stability testing method.
Fig. 7 is a block diagram illustrating an apparatus 700 for android application stability testing, according to an example embodiment. For example, the apparatus 700 may be provided as a server. Referring to fig. 7, apparatus 700 includes a processing component 722 that further includes one or more processors and memory resources, represented by memory 732, for storing instructions, such as applications, that are executable by processing component 722. The application programs stored in memory 732 may include one or more modules that each correspond to a set of instructions. Further, the processing component 722 is configured to execute instructions to perform the above-described methods.
The device 700 may also include a power component 726 configured to perform power management of the device 700, a wired or wireless network interface 750 configured to connect the device 700 to a network, and an input output (I/O) interface 1958. The apparatus 700 may operate based on an operating system stored in memory 732, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
Claims (10)
1. An android application stability testing method is characterized by comprising the following steps:
when a test instruction is detected, acquiring page script parameters of an application program to be tested, wherein the page script parameters are preset according to feature data of different pages, and the method comprises the following steps: the method comprises the following steps of counting the total number of events to be operated, application program components corresponding to different pages and corresponding events of different areas of the different pages;
testing the page script parameters;
if the application program component where the current page is located is the page of the application program to be tested, determining the page type of the current page;
carrying out random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type to which the current page belongs;
generating an event operation report when the total number of events is completed, wherein the event operation report at least comprises: the total execution time of the running event and the detailed information of the error event.
2. The android application stability testing method of claim 1, the method further comprising:
if the application program component where the current page is located is not the page of the application program to be tested, the page of the current application program to be tested is automatically called, and the step of performing random event operation on corresponding events in different areas of the current page according to the probability of the preset event is executed.
3. The android application stability testing method of claim 2, the method further comprising:
and if the total number of the events is not finished, judging whether the application program assembly where the current page is located is the page of the application program to be tested according to the set time.
4. The android application stability testing method of any of claims 1 to 3, wherein the determining the page type to which the current page belongs includes:
if the current page comprises button keys, determining that the page type of the current page is a first type page;
if the current page comprises the up-down sliding list, determining that the page type of the current page is a second type page;
and if the current page comprises the left-right sliding list, determining that the page type of the current page is a third type page.
5. The android application stability testing method of any of claims 1 to 3, further comprising, prior to performing a random event operation:
setting different operation probabilities aiming at corresponding events in different types of pages in advance, wherein the different types of pages at least comprise: a first type page, a second type page, and a third type page.
6. The android application stability testing method of claim 5,
when the corresponding event includes: the method comprises the following steps of (1) carrying out a first type of operation event, a second type of operation event and/or a third type of operation event;
the setting different probabilities for corresponding events in different types of pages in advance at least comprises one of the following steps:
setting the operation probability of a first type of operation event as A% and setting the operation probability of a second type of operation event and/or a third type of operation event as B% for the first type of page, wherein A% is greater than B%, and A% + B% is 1;
setting the operation probability of a second type of operation event as A% and setting the operation probability of a first type of operation event as B% for the second type page, wherein A% is more than B%, and A% + B% is 1;
and for the third type page, setting the operation probability of a third type operation event as A%, setting the operation probability of the first type operation event as B%, wherein A% is more than B%, and A% + B% is 1.
7. An android application stability testing device, comprising:
the obtaining module is configured to execute, when a test instruction is detected, obtaining a page script parameter of an application program to be tested, where the page script parameter is preset according to feature data of different pages, and the obtaining module includes: the method comprises the following steps of counting the total number of events to be operated, application program components corresponding to different pages and corresponding events of different areas of the different pages;
a test module configured to perform testing of the page script parameters;
the determining module is configured to determine the page type of the current page when the application program component where the current page is located is the page of the application program to be tested;
the event operation module is configured to execute random event operation on corresponding events in different areas of the current page according to the probability of preset events in the page type to which the current page belongs;
a generating module configured to perform generating an event operation report when the total number of events is completed, wherein the event operation report at least includes: the total execution time of the running event and the detailed information of the error event.
8. The android application stability testing apparatus of claim 7, the apparatus further comprising:
the first judgment module is configured to judge whether the application program component where the current page is located is the page of the application program to be tested according to set time in the test process;
the calling module is configured to automatically call the page of the current application program to be tested when the first judging module judges that the application program component where the current page is located is not the page of the application program to be tested;
the event operation module is also configured to perform random event operation on corresponding events in different areas of the current page according to the probability of a preset event after the page of the current application program to be tested is automatically called by the calling-up module;
the determining module is further configured to determine the page type of the current page when the first judging module judges that the application program component where the current page is located is the page of the application program to be tested.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the android application stability testing method of any of claims 1 to 6.
10. A storage medium having instructions thereon that, when executed by a processor of an electronic device, enable the electronic device to perform the android application stability testing method of any of claims 1 to 6.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011011091.0A CN112256563B (en) | 2020-09-23 | 2020-09-23 | Android application stability testing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011011091.0A CN112256563B (en) | 2020-09-23 | 2020-09-23 | Android application stability testing method and device, electronic equipment and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN112256563A true CN112256563A (en) | 2021-01-22 |
| CN112256563B CN112256563B (en) | 2024-08-13 |
Family
ID=74232920
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202011011091.0A Active CN112256563B (en) | 2020-09-23 | 2020-09-23 | Android application stability testing method and device, electronic equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112256563B (en) |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113204483A (en) * | 2021-04-21 | 2021-08-03 | 北京达佳互联信息技术有限公司 | Application detection method, device, server, detection program component and storage medium |
| CN114185788A (en) * | 2021-12-11 | 2022-03-15 | 麒麟软件有限公司 | Linux platform based graphical desktop and application stability test method |
| CN114328245A (en) * | 2021-12-30 | 2022-04-12 | 展讯通信(天津)有限公司 | Key operation test method and device, storage medium and terminal equipment |
| CN114780412A (en) * | 2022-04-26 | 2022-07-22 | 平安资产管理有限责任公司 | Page testing method, system, device and medium |
| CN115048309A (en) * | 2022-06-27 | 2022-09-13 | 广州掌动智能科技有限公司 | Non-intrusive APP software performance test method and system |
| CN115687060A (en) * | 2021-07-27 | 2023-02-03 | 北京字节跳动网络技术有限公司 | Application program stability test method, device, equipment, medium and product |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130086529A1 (en) * | 2011-09-29 | 2013-04-04 | Microsoft Corporation | Automatic lifecycle management for pages on a mobile application |
| CN105868105A (en) * | 2016-03-24 | 2016-08-17 | 厦门美图移动科技有限公司 | Application traversal testing method and device, and mobile terminal |
| US9501390B1 (en) * | 2013-01-02 | 2016-11-22 | Amazon Technologies, Inc. | Enhancing automated mobile application testing |
| CN107193733A (en) * | 2017-05-12 | 2017-09-22 | 微梦创科网络科技(中国)有限公司 | Simulate the methods, devices and systems of Monkey tests |
| CN110888799A (en) * | 2019-10-14 | 2020-03-17 | 京东数字科技控股有限公司 | Software testing method and device |
| CN110990258A (en) * | 2019-10-29 | 2020-04-10 | 贝壳技术有限公司 | Android system-based APP testing method and device, readable storage medium and processor |
-
2020
- 2020-09-23 CN CN202011011091.0A patent/CN112256563B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130086529A1 (en) * | 2011-09-29 | 2013-04-04 | Microsoft Corporation | Automatic lifecycle management for pages on a mobile application |
| US9501390B1 (en) * | 2013-01-02 | 2016-11-22 | Amazon Technologies, Inc. | Enhancing automated mobile application testing |
| CN105868105A (en) * | 2016-03-24 | 2016-08-17 | 厦门美图移动科技有限公司 | Application traversal testing method and device, and mobile terminal |
| CN107193733A (en) * | 2017-05-12 | 2017-09-22 | 微梦创科网络科技(中国)有限公司 | Simulate the methods, devices and systems of Monkey tests |
| CN110888799A (en) * | 2019-10-14 | 2020-03-17 | 京东数字科技控股有限公司 | Software testing method and device |
| CN110990258A (en) * | 2019-10-29 | 2020-04-10 | 贝壳技术有限公司 | Android system-based APP testing method and device, readable storage medium and processor |
Cited By (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113204483A (en) * | 2021-04-21 | 2021-08-03 | 北京达佳互联信息技术有限公司 | Application detection method, device, server, detection program component and storage medium |
| CN115687060A (en) * | 2021-07-27 | 2023-02-03 | 北京字节跳动网络技术有限公司 | Application program stability test method, device, equipment, medium and product |
| CN114185788A (en) * | 2021-12-11 | 2022-03-15 | 麒麟软件有限公司 | Linux platform based graphical desktop and application stability test method |
| CN114328245A (en) * | 2021-12-30 | 2022-04-12 | 展讯通信(天津)有限公司 | Key operation test method and device, storage medium and terminal equipment |
| CN114780412A (en) * | 2022-04-26 | 2022-07-22 | 平安资产管理有限责任公司 | Page testing method, system, device and medium |
| CN115048309A (en) * | 2022-06-27 | 2022-09-13 | 广州掌动智能科技有限公司 | Non-intrusive APP software performance test method and system |
| CN115048309B (en) * | 2022-06-27 | 2023-03-07 | 广州掌动智能科技有限公司 | Non-intrusive APP software performance test method and system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112256563B (en) | 2024-08-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112256563B (en) | Android application stability testing method and device, electronic equipment and storage medium | |
| CN111221733B (en) | Information processing method, device, mobile terminal and storage medium | |
| CN105183631A (en) | Equipment test methods and devices | |
| CN111597106A (en) | Point burying management method and device | |
| CN105446854B (en) | Consumption detection method, system and terminal | |
| CN104932970A (en) | Monitoring method and device of memory leakage | |
| CN111913850B (en) | Data anomaly detection method, device, equipment and storage medium | |
| CN112333233B (en) | Event information reporting method and device, electronic equipment and storage medium | |
| CN112333518B (en) | Function configuration method and device for video and electronic equipment | |
| CN108984417B (en) | Software testing method, device, terminal and storage medium | |
| CN111580824A (en) | Program optimization method, device and storage medium | |
| CN113869295B (en) | Object detection method and device, electronic equipment and storage medium | |
| CN115390911A (en) | Node information determination method, device and equipment | |
| CN114780334A (en) | Power consumption monitoring method, power consumption monitoring device and storage medium | |
| CN116069612A (en) | Abnormality positioning method and device and electronic equipment | |
| CN112363917B (en) | Application program debugging exception processing method and device, electronic equipment and medium | |
| CN112035246A (en) | Method, device and system for acquiring virtual resources, electronic equipment and storage medium | |
| CN112416574B (en) | A method, device and storage medium for determining memory usage of an application | |
| CN109947640B (en) | Regression test-based core function coverage statistical method and device | |
| CN105553772B (en) | Flow monitoring method and device | |
| CN112199250B (en) | Picture monitoring method and device, electronic equipment and storage medium | |
| CN115951944A (en) | Shortcut key setting method and device, electronic equipment and storage medium | |
| CN110162302B (en) | Data processing method, device, electronic equipment and storage medium | |
| CN113849075A (en) | Touch screen reporting event processing method, device and storage medium | |
| CN112506628B (en) | Agent program management method, device, computer equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |