Nothing Special   »   [go: up one dir, main page]

CN112256563B - 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 PDF

Info

Publication number
CN112256563B
CN112256563B CN202011011091.0A CN202011011091A CN112256563B CN 112256563 B CN112256563 B CN 112256563B CN 202011011091 A CN202011011091 A CN 202011011091A CN 112256563 B CN112256563 B CN 112256563B
Authority
CN
China
Prior art keywords
page
type
event
application program
module
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
CN202011011091.0A
Other languages
Chinese (zh)
Other versions
CN112256563A (en
Inventor
刘宏伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202011011091.0A priority Critical patent/CN112256563B/en
Publication of CN112256563A publication Critical patent/CN112256563A/en
Application granted granted Critical
Publication of CN112256563B publication Critical patent/CN112256563B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging 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 disclosure provides a method, a device, an electronic device and a storage medium for testing stability of android applications, 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 characteristic data of different pages, and the method comprises the following steps: the method comprises the steps of counting the number of events to be operated, and enabling 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 a preset event 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 stability of the test.

Description

Android application stability testing method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of terminal application testing, in particular to a method and a device for testing stability of android applications, electronic equipment and a storage medium.
Background
In the related art, a conventional stability test triggers a random event through a monkey, which is a command line tool provided by an Android (Android) software development kit (SDK, software Development Kit) and can be run on an Android simulator and an entity device. The monkey will send a pseudo-random stream of user events (e.g., key inputs, touch inputs, or gesture inputs, etc.) to enable stress testing of the Application (App) being developed. However, the stability test triggers the same event for any page scene, and the pages cannot be distinguished, and corresponding operations cannot be allocated to different pages, so that a large number 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 to shield useless operations to improve the test efficiency is a technical problem to be solved at present.
Disclosure of Invention
The disclosure provides a method, a device, an electronic device and a storage medium for testing stability of android application, which at least solve the technical problem that different events cannot be triggered aiming at different pages when the stability test is carried out by using monkey in the related technology, so that a large number of useless area operations exist in random events during the test. The technical scheme of the present disclosure is as follows:
According to a first aspect of an embodiment of the present disclosure, there is provided a method for testing stability of an android application, 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 characteristic data of different pages, and the method comprises the following steps: the method comprises the steps of counting the number of events to be operated, and enabling 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 a preset event 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: total execution time of the run event and detailed information of the error event.
Optionally, the method further comprises:
If the application program component of the current page is not the page of the application program to be tested, automatically calling the page of the current application program to be tested, and executing the step of carrying out random event operation on the corresponding events of different areas of the current page according to the probability of the preset event.
Optionally, on the basis of the foregoing embodiment, the method further includes:
And if the total number of the events is not executed, judging whether the application program component where the current page is positioned 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 a button key, determining that the page type to which the current page belongs 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 to which the current page belongs is a third type page.
Optionally, on the basis of the foregoing embodiment, before performing the random event operation, the method further includes:
Different operation probabilities are preset for corresponding events in different types of pages, 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: a first type of operational event, a second type of operational event, and/or a third type of operational event;
The presetting different probabilities for corresponding events in different types of pages at least comprises one of the following steps:
Setting the operation probability of a first type operation event as A, setting the operation probability of a second type operation event and/or a third type operation event as B for the first type page, wherein A% > B%, A% + B% = 1;
setting the operation probability of the second type operation event as A% and the operation probability of the first type operation event as B% for the second type page, wherein A% > B% and A% + B% = 1;
and setting the operation probability of a third type operation event as A% and the operation probability of the first type operation event as B%, wherein A% is more than B%, and A% plus B% is less than 1.
According to a second aspect of the embodiments of the present disclosure, there is provided an android application stability test apparatus, including:
The acquisition module is configured to acquire page script parameters of the application program to be tested when the test instruction is detected, wherein the page script parameters are preset according to the characteristic data of different pages, and the acquisition module comprises the following steps: the method comprises the steps of counting the number of events to be operated, and enabling application program components corresponding to different pages and corresponding events of different areas of the different pages;
The testing module is configured to execute testing on 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 a preset event in the page type to which the current page belongs;
A generation 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: total execution time of the run event and detailed information of the error event.
Optionally, on the basis of the foregoing embodiment, the apparatus further includes:
the first judging module is configured to judge whether the application program component where the current page is located is a page of the application program to be tested according to the set time in the test process;
the calling module is configured to execute automatic calling of 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 further configured to execute random event operation on corresponding events of different areas of the current page according to the probability of preset events after the page of the current application program to be tested is automatically called by the call-up module;
the determining module is further configured to determine a page type to which the current page belongs when the first judging module determines that the application component in which the current page is located is a page of the application to be tested.
Optionally, on the basis of the foregoing embodiment, the apparatus further includes:
a second judging module configured to perform judging whether the total number of events is performed;
The generating module is further configured to generate an event operation report when the second module determines that the total number of events is executed;
And the first judging module is further configured to continuously judge whether the application program component where the current page is positioned 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 events is not executed.
Optionally, on the basis of the foregoing embodiment, the determining module includes:
the first determining module is configured to determine that the page type to which the current page belongs is a first type page when the current page comprises a button key;
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 comprises an 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:
The setting module is configured to execute that different operation probabilities are preset for corresponding events in different types of pages before the event operation module performs random event operation, 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 acquired by the acquiring module includes: a first type of operational event, a second type of operational event, and/or a third type of operational event;
the setting module at least comprises one of the following:
The first probability setting module is configured to execute the first type page, set the operation probability of the first type operation event as A%, set the operation probability of the second type operation event and/or the third type operation event as B%, and set A% > B%, and set A% +B% = 1;
A second probability setting module configured to execute setting, for the second type page, an operation probability of an upper second type operation event to a%, and an operation probability of the first type operation event to B%, where a% > B%, a% +b% = 1;
And a third probability setting module configured to execute setting an operation probability of a third type operation event to a% and setting an operation probability of the first type operation event to B% for the third type page, wherein a% > B%, and a% + B% = 1.
According to a third aspect of embodiments of the present disclosure, there is provided 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 test method as described above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the android application stability test 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, which when executed by a processor of the electronic device, causes the electronic device to perform any of the above-described android application stability test methods.
The technical scheme provided by the embodiment of the disclosure at least can comprise 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, page script parameters of an application program to be tested are 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 a preset event 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. That is, according to the characteristics of different pages, different operation probabilities are allocated to corresponding events of different areas of different pages, and when the page script parameters of an application program to be tested are subjected to more effective random operation by using a testing tool, more effective stability testing of different service scenes is realized, meanwhile, the pages are partitioned, invalid operation caused by status bars, virtual keys and the like is shielded, so that the testing stability is improved, the testing time is saved, and the testing 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 disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
FIG. 1 is a flow chart illustrating a method of android application stability testing in accordance with an exemplary embodiment.
FIG. 2 is another flow chart illustrating a method of android application stability testing in accordance with an exemplary embodiment.
Fig. 3 is a block diagram illustrating an android application stability testing apparatus, according to an example embodiment.
Fig. 4 is another block diagram illustrating an android application stability testing apparatus, according to an example embodiment.
Fig. 5 is yet another block diagram illustrating an android application stability testing apparatus, according to an example embodiment.
FIG. 6 is a block diagram of an electronic device, according to an example embodiment;
fig. 7 is a block diagram illustrating an apparatus for android application stability testing in accordance with an exemplary embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of 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 foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Fig. 1 is a flowchart of an android application stability testing method according to an exemplary embodiment, and 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, obtaining page script parameters of an application program to be tested, where the page script parameters are preset according to feature data of different pages, and the method includes: the method comprises the steps of counting the number of events to be operated, and enabling application program components corresponding to different pages to be active and events corresponding to 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 includes: total execution time of the run event and detailed information of the error event.
The android application stability test disclosed by the disclosure can be applied to terminals, servers and the like, is not limited herein, and terminal implementation equipment can be electronic equipment such as smart phones, notebook computers, tablet computers and the like, and is not limited herein.
The following describes in detail the specific implementation steps of a method for testing stability of android application according to an embodiment of the present disclosure with reference to fig. 1.
Firstly, executing step 101, when a test instruction is detected, obtaining 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 steps of enabling the total number of events to be operated, application program components (activities) corresponding to different pages and corresponding events of different areas of the different pages;
The total number of events to be run included in the parameters of the page script is preset, for example, the total number of events to be run is 10 ten thousand times, and the total running time of the events can be represented by the total number of events, which is specifically: run time = total number of events/execution time of single event, it should be noted that, since the execution time of each event is not very accurate, the time used for each type of event is also different, so the total run time of all events here is not very accurate;
The parameters of the page script comprise application program components corresponding to different pages; the application program component corresponding to each page can be grabbed by the same tool, and the specific process is well known 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, up-down slide event, left-right slide event, drag event, long time, etc., but in practical application, the present invention is not limited to the above events.
In this embodiment, page script parameters of the application to be tested need to be predetermined, and one determination method is as follows: firstly, capturing activity and page elements of different pages by a tool, then determining unique identification IDs of corresponding pages according to the activity and the page elements, and finally setting allocation probabilities of corresponding events of different areas on 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 of the operation to be executed and the operation probability of the event occurrence in the corresponding area of the page are configured. For example, for a status bar on a page, a home key and the like can perform shielding operation, so that the operation of disconnecting the network or switching to a desktop in the operation process is avoided.
Step 102 is executed, and the page script parameters are tested;
In this step, automated random test operations may be performed on page script parameters using a test tool (e.g., monkeyrunner). Wherein monkeyrunner runs on a PC, it is necessary to send instructions to an android (android) application on the device or simulator through the mode of the server/client to perform the test. monkeyrunner may accept a specific test script (written in python language) having specific conditional statements, etc., to facilitate use in the performance test. The monkeyrunner tool includes operations of keys such as a home key, a volume key, an on/off key, a power supply key and the like on a system operation interface, and operations such as clicking (touch) and sliding (drag) on a mobile phone application based on a coordinate point can be realized through the monkeyrunner tool. The specific testing procedure is well known to those skilled in the art and will not be described in detail herein.
Step 103 is executed again, 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 where the current page belongs;
In this step, it is detected whether the activity of the application component where the current page is located is the page of the application to be tested or not at every predetermined time (for example, 1min, etc.), if so, the page type to which the current page belongs is determined.
The specific detection modes can comprise: firstly, utilizing adb shell dumpsys sentences to acquire the activity of the application program component where the current page is located, namely checking the related information of the system service; then, determining whether the activity of the application program component where the current page is located is the page of the application program to be tested. The Activity is one of four most basic and common components (Activity, service, content Provider, broadcastReceiver broadcast receiver) among Android components. Activity is an application component that provides a screen that a user can use to interact with to accomplish a task.
In this embodiment, the adb shell dumpsys activity |grep 'mResumedActivity' command may be used to obtain activity for mobile terminals (such as cell phones) below the android8.0 system;
for mobile terminals of the android8.0 and above system, the adb shell dumpsys activity |grep 'mFocusedActivity' command may be used to obtain activity.
In this implementation, when the activity of the current page is the page of the application program to be tested, determining the page type to which the current page belongs includes:
if the current page comprises a button key, determining that the page type to which the current page belongs 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 to which the current page belongs is a third type page.
Of course, in practical application, the above three types of pages are not limited thereto, and the types of the pages may be divided according to actual needs.
In the step, the types of the pages are determined according to the characteristics of different pages, so that different event distribution can be conveniently carried out on different page types later, and the random operation of the pages is more effectively improved.
Step 104 is executed again, and random event operation is carried out on the corresponding events in different areas of the current page according to the probability of the preset event 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 operational event, a second type of operational event, and a third type of operational 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: an up-down sliding event, a dragging event and a long-press event; the third type of operational event includes, but is not limited to: a left-right sliding event, a dragging event, etc.
The presetting different probabilities for corresponding events in different types of pages comprises one of the following:
Setting the operation probability of a first type operation event as A% and the operation probability of a second type operation event and/or a third type operation event as B% for the first type page (such as page A), wherein A% > B% and A% + B% = 1; for example, a% is set to 80% and B% is set to 20%; for example, a% is set to 85%, B% is set to 15%, and so on.
That is, the operational duty cycle (probability) for a click event in a first type of page may be configured to be greater, such as 80% for a click event; other operation ratios may be configured with smaller operation ratios, for example, the operation probability of the configuration of the up-down sliding event and/or the dragging event and/or the long press event is 20%, or the like, and of course, the operation probability of the configuration of the clicking event may be 70%, the operation probability of the configuration of the up-down sliding event and/or the dragging event and/or the long press event is 30%, or the like.
For the second type page (e.g., page B), setting the operation probability of the second type operation event as a%, setting the operation probability of the first type operation event as B%, and a% > B%, a% + B% = 1;
That is, the operation ratio (probability) of the up-and-down sliding event and/or the dragging event in this second type page needs to be configured to be larger, for example, the operation probability configured for the up-and-down sliding event and/or the dragging event is 80%; other operation ratios may be configured with smaller ratios, for example, an operation probability of 20% for a click event, etc., and of course, an operation probability of 70% for a slide up and down event and/or a drag event, an operation probability of 30% for a click event, etc.
For the third type of page (e.g., page C), the operation probability of the third type of operation event is set to a%, the operation probability of the first type of operation event is set to B%, and a% > B%, a% +b% =1.
That is, the operation ratio (probability) of the up-and-down sliding event and/or the dragging event in this second type page needs to be configured to be larger, for example, the operation probability configured for the up-and-down sliding event and/or the dragging event is 80%; other operation ratios may be configured with smaller ratios, for example, an operation probability of 20% for a click event, etc., and of course, an operation probability of 70% for a slide up and down event and/or a drag event, an operation probability of 30% for a click event, etc.
It should be noted that, the probability of event allocation in other specified areas of the page may be 0, for example, the probability of event allocation in an area such as a virtual button in a notification bar may be 0, that is, the probability corresponds to an operation of masking the area.
In other words, in the step, the page is partitioned, so that invalid operation caused by status bars, virtual keys and the like is shielded, the stability of testing is improved, the testing time is saved, and the testing efficiency is improved.
Finally, step 105 is executed, and when the total number of events is completed, an event operation report is generated, where the event operation report at least includes: total execution time of the run event and detailed information of the error event.
Wherein, in this step, after 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 include, for example, the number of discovery crashes (crash)/application unresponsions (anr), and detailed information of discovery crash/anr.
According to the android application stability testing method shown in the exemplary embodiment, when a testing instruction input by a user is detected, page script parameters of an application program to be tested are 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 a preset event in the page type to which the current page belongs; and generating an event operation report when the total number of the events is completed. That is, the method and the device allocate different operation probabilities for corresponding events of different areas of different pages according to the characteristic data of different pages in the page script parameters by acquiring the page script parameters of the application program to be tested, realize more effective stability test of different service scenes when the page script parameters of the application program to be tested are subjected to more effective random operation by using a test tool, partition the page, shield invalid operation caused by status bars, virtual keys and the like, improve test stability, save test time and improve test efficiency.
Optionally, in another embodiment, based on the foregoing embodiment, the method may further include: transmitting the generated event operation report to the user, wherein the event operation report at least comprises: total execution time of the run event and detailed information of the error event.
In this embodiment, the generated time operation report may be sent directly to the development maintenance personnel and/or the test personnel, etc. in the form of mail.
That is, in this step, after all events are detected to generate an event operation report, the detection is ended, and the generated event operation report including the total execution time of the operation event and detailed information of the error event is sent to a maintainer or a tester in a mail manner. Of course, the detailed information of the error event may be sent to a maintenance person, a tester, or the like. So that the maintenance personnel or the test 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 detailed information of the error event, that is, relatively perfect report information, so that the error event of the event operation report is timely synchronized to the maintainer, so that the maintainer can timely maintain according to the detailed error event.
Referring also to fig. 2, another flowchart of a method for testing stability of an android application according to an embodiment of the disclosure is provided, 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 characteristic data of different pages, and the method comprises the following steps: the method comprises the steps of counting the number of events to be operated, and enabling 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 detailed descriptions thereof are omitted herein.
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, and if not, executing the step 204; if so, go to step 205;
In the step, adb shell dumpsys sentences can be utilized to acquire the activity of the application program component where the current page is located, namely, the related information of the system service is checked; then, determining whether the activity of the application program component where the current page is located is the page of the application program to be tested. The specific implementation process is detailed in the above description, and will not be repeated here.
Step 204: automatically calling up the page of the current application program to be tested, and then executing step 205;
In this step, one way may call up the page of the application app to be tested by an adb command adb SHELL AM START-a android. Of course, in practical application, the method is not limited thereto, and other commands may be used, and the embodiment is not limited thereto.
Step 205: determining the page type of the current page;
Step 206: carrying out 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;
Step 205 and step 206 in this embodiment are the same as step 103 and step 104 in the above embodiment, and are specifically described above, and are not repeated here.
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 based on a determination as to whether the total number of events to be run is completely detected.
Step 208: generating an event operation report, wherein the event operation report at least comprises: total execution time of the running event and detailed information of the error event;
Further, the method can also comprise the following steps:
step 209: and sending the generated event operation report.
The event operation report may be sent to a maintenance person, a tester, or the like.
According to the method and the device, different operation probabilities are allocated for corresponding events of different areas of different pages according to different page characteristics, when a testing tool is utilized to perform more effective random operation on page script parameters of an application program to be tested, and when an application program component where a current page is not the page of the application program to be tested is detected, the page of the current application program to be tested is automatically adjusted, so that more effective stability testing of different service scenes is achieved, meanwhile, the page is partitioned, invalid operation caused by status bars, virtual keys and the like is shielded, testing stability is improved, testing time is saved, and testing efficiency is improved.
It should be noted that, for the sake of simplicity of description, the method embodiments are all described as a series of combinations of actions, but it should be understood by those skilled in the art that the present disclosure is not limited by the order of actions described, as some steps may take place in other order or simultaneously in accordance with the present disclosure. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments and that the acts referred to are not necessarily required by the present disclosure.
Fig. 3 is a block diagram illustrating an android application stability testing apparatus, 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 manipulation module 304 and a generation module 305. Wherein,
The obtaining module 301 is configured to obtain, when detecting a test instruction, page script parameters of an application program to be tested, where the page script parameters are preset according to feature data of different pages, and includes: the method comprises the steps of counting the number of events to be operated, and enabling application program components corresponding to different pages to be active and events corresponding to 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 where the current page is located is the page of the application to be tested;
the event operation module 304 is configured to perform 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 generate an event operation report when the total number of events is completed, where the event operation report includes at least: total execution time of the run event and detailed information of the error event.
Optionally, in another embodiment, based on the foregoing embodiment, the apparatus may further include: a transmitting module, wherein,
The sending module is configured to send the event operation report generated by the generating module to a maintainer or a tester, so that the maintainer or the tester can analyze and process the event operation report according to the detailed information of the error event in the event operation report.
Optionally, in another embodiment, based on the foregoing embodiment, the apparatus may further include: a first judging module 401 and a tuning module 402 are shown in fig. 4, wherein,
The first judging module 401 is configured to execute judging whether the activity of the current page is the page of the application program to be tested according to the set time in the testing process;
The call-up module 402 is configured to perform automatic call-up of the page of the current application to be tested when the first judging module 401 judges that the activity of the current page is not the page of the application to be tested;
the determining module 303 is further configured to determine, when the first determining module 401 determines that the activity where the current page is located is a page of the application to be tested, a page type to which the current page belongs;
The event operation module 304 is further configured to perform random event operation on corresponding events in different areas of the current page according to the probability of the preset event after the page of the current application to be tested is automatically called by the call-up module 402;
Optionally, in another embodiment, based on the foregoing embodiment, the apparatus may further include: a second judging module, wherein,
The second judging module is configured to judge whether the total number of the events is completed or not;
The generation module is further configured to generate an event operation report when the second module judges that the total number of events is executed;
The first judging module is further configured to execute the step of continuously judging whether the activity of the current page 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 events is not executed.
Optionally, in another embodiment, based on 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 to which the current page belongs is a first type page when the current page comprises a button key;
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 comprises an 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, based on the foregoing embodiment, the apparatus may further include: a schematic of the configuration of the setup module 501 is shown in fig. 5, in which,
A setting module 501 configured to set different operation probabilities for corresponding events in different types of pages in advance before the event operation module 304 performs random event operation, 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, based on the above embodiment,
When the corresponding event acquired by the acquisition module includes: a first type of operational event, a second type of operational event, and/or a third type of operational event;
the setting module at least comprises one of the following: 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 the first type page, set the operation probability of the first type operation event as A%, set the operation probability of the second type operation event and/or the third type operation event as B%, and set A% > B%, and set A% +B% = 1;
A second probability setting module configured to execute setting, for the second type page, an operation probability of an upper second type operation event to a%, and an operation probability of the first type operation event to B%, where a% > B%, a% +b% = 1;
And a third probability setting module configured to execute setting an operation probability of a third type operation event to a% and setting an operation probability of the first type operation event to B% for the third type page, wherein a% > B%, and a% + B% = 1.
The specific manner in which the operations of the respective modules are performed in the apparatus of the above embodiments has been described in detail in the embodiments related to the method, and the relevant points are only required to be referred to in the description of the embodiments related to the method, which will not be described in detail herein.
In an exemplary embodiment, the disclosed embodiment 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 test method as described above.
In an exemplary embodiment, the disclosed embodiments provide a storage medium that, when executed by a processor of an electronic device, enables the electronic device to perform the android application stability test method as described above.
In an exemplary embodiment, a storage medium is also provided, e.g., a memory, comprising instructions executable by a processor of the apparatus to perform the above-described method. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
Fig. 6 is a block diagram of 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 an example of the mobile terminal. 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, an 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 input/output (I/O) interface 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 part 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 may 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 operations 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 nonvolatile 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 disk.
The power supply component 606 provides power to the various components of the electronic device 600. The power supply components 606 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 600.
The multimedia component 608 includes a screen between the electronic device 600 and the user that provides an output interface. 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 input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and/or a rear camera. The front-facing camera and/or the rear-facing camera may receive external multimedia data when the device 600 is in an operational 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 focal length and optical zoom capabilities.
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 signals may be further 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 a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 614 includes one or more sensors for providing status assessment of various aspects of the electronic device 600. For example, the sensor assembly 614 may detect an on/off state of the device 600, a relative positioning of the components, such as a display and keypad of the electronic device 600, the sensor assembly 614 may also detect a change in position of the electronic device 600 or a component of the electronic device 600, the presence or absence of a user's contact with the electronic device 600, an orientation or acceleration/deceleration of the electronic device 600, and a change in temperature of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects in the absence of 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 gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communication between the electronic device 600 and other devices, either wired or wireless. The electronic device 600 may access a wireless network based on a communication standard, such as WiFi, an operator network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In one exemplary embodiment, the communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one 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, microcontrollers, microprocessors, or other electronic elements for performing the android application stability test method shown above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 604, including instructions executable by processor 620 of electronic device 600 to perform the android application stability testing method shown above. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
In an exemplary embodiment, a computer program product is also provided, which, when executed by a processor of an electronic device, causes the electronic device to perform the android application stability test method shown above.
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, 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 methods described above.
The apparatus 700 may further comprise a power supply component 726 configured to perform power management of the apparatus 700, a wired or wireless network interface 750 configured to connect the apparatus 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 application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the invention is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (15)

1. The android application stability testing method is characterized by comprising the following steps of:
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 characteristic data of different pages, and the method comprises the following steps: the method comprises the steps of counting the number of events to be operated, and enabling 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 a preset event 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: total execution time of the run event and detailed information of the error event.
2. The android application stability testing method of claim 1, further comprising:
if the application program component of the current page is not the page of the application program to be tested, automatically calling the page of the current application program to be tested, and executing the step of carrying out random event operation on the corresponding events of different areas of the current page according to the probability of the preset event.
3. The android application stability testing method of claim 2, further comprising:
And if the total number of the events is not executed, judging whether the application program component where the current page is positioned is the page of the application program to be tested according to the set time.
4. A method for testing stability of an android application according to any one of claims 1 to 3, wherein determining a page type to which a current page belongs comprises:
if the current page comprises a button key, determining that the page type to which the current page belongs 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 to which the current page belongs is a third type page.
5. A method of testing the stability of an android application according to any one of claims 1 to 3, wherein prior to performing the random event operation, the method further comprises:
Different operation probabilities are preset for corresponding events in different types of pages, wherein the different types of pages at least comprise: a first type page, a second type page, and a third type page.
6. The method for testing the stability of the android application according to claim 5,
When the corresponding event includes: a first type of operational event, and a second type of operational event or a third type of operational event; or, a first type of operation event, a second type of operation event and a third type of operation event;
The presetting different probabilities for corresponding events in different types of pages at least comprises one of the following steps:
Setting the operation probability of a first type operation event as A, setting the operation probability of a second type operation event and/or a third type operation event as B for the first type page, wherein A% > B%, A% + B% = 1;
setting the operation probability of the second type operation event as A% and the operation probability of the first type operation event as B% for the second type page, wherein A% > B% and A% + B% = 1;
and setting the operation probability of a third type operation event as A% and the operation probability of the first type operation event as B%, wherein A% is more than B%, and A% plus B% is less than 1.
7. An android application stability testing device, comprising:
The acquisition module is configured to acquire page script parameters of an application program to be tested when the test instruction is detected, wherein the page script parameters are preset according to characteristic data of different pages, and the acquisition module comprises the following steps: the method comprises the steps of counting the number of events to be operated, and enabling application program components corresponding to different pages and corresponding events of different areas of the different pages;
The testing module is configured to execute testing on 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 a preset event in the page type to which the current page belongs;
A generation 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: total execution time of the run event and detailed information of the error event.
8. The android application stability testing apparatus of claim 7, wherein the apparatus further comprises:
the first judging module is configured to judge whether the application program component where the current page is located is a page of the application program to be tested according to the set time in the test process;
the calling module is configured to execute automatic calling of 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 further configured to execute random event operation on corresponding events of different areas of the current page according to the probability of preset events after the page of the current application program to be tested is automatically called by the call-up module;
the determining module is further configured to determine a page type to which the current page belongs when the first judging module determines that the application component in which the current page is located is a page of the application to be tested.
9. The android application stability testing apparatus of claim 8, wherein the apparatus further comprises:
a second judging module configured to perform judging whether the total number of events is performed;
The generation module is further configured to generate an event operation report when the second judgment module judges that the total number of events is executed;
And the first judging module is further configured to continuously judge whether the application program component where the current page is positioned 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 events is not executed.
10. The android application stability testing apparatus of any one of claims 7 to 9, wherein the determining module comprises:
the first determining module is configured to determine that the page type to which the current page belongs is a first type page when the current page comprises a button key;
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 comprises an 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.
11. The android application stability testing apparatus according to any of claims 7 to 9, wherein the apparatus further comprises:
The setting module is configured to execute that different operation probabilities are preset for corresponding events in different types of pages before the event operation module performs random event operation, wherein the different types of pages at least comprise: a first type page, a second type page, and a third type page.
12. The android application stability testing apparatus of claim 11,
When the corresponding event acquired by the acquisition module includes: a first type of operational event, and a second type of operational event or a third type of operational event; or, a first type of operation event, a second type of operation event and a third type of operation event;
the setting module at least comprises one of the following:
The first probability setting module is configured to execute the first type page, set the operation probability of the first type operation event as A%, set the operation probability of the second type operation event and/or the third type operation event as B%, and set A% > B%, and set A% +B% = 1;
A second probability setting module configured to execute setting, for the second type page, an operation probability of an upper second type operation event to a%, and an operation probability of the first type operation event to B%, where a% > B%, a% +b% = 1;
And a third probability setting module configured to execute setting an operation probability of a third type operation event to a% and setting an operation probability of the first type operation event to B% for the third type page, wherein a% > B%, and a% + B% = 1.
13. 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 test method of any one of claims 1 to 6.
14. A storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the android application stability test method of any one of claims 1 to 6.
15. A computer program product, characterized in that instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the android application stability test method of any one of claims 1 to 6.
CN202011011091.0A 2020-09-23 2020-09-23 Android application stability testing method and device, electronic equipment and storage medium Active CN112256563B (en)

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 CN112256563A (en) 2021-01-22
CN112256563B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204483B (en) * 2021-04-21 2024-10-11 北京达佳互联信息技术有限公司 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
CN115048309B (en) * 2022-06-27 2023-03-07 广州掌动智能科技有限公司 Non-intrusive APP software performance test method and system

Citations (2)

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

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8745539B2 (en) * 2011-09-29 2014-06-03 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
CN110888799B (en) * 2019-10-14 2021-05-25 京东数字科技控股有限公司 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

Patent Citations (2)

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

Also Published As

Publication number Publication date
CN112256563A (en) 2021-01-22

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
CN108427618B (en) Method and device for determining stuck state and computer readable storage medium
CN111274131A (en) Interface testing method and device, electronic equipment and storage medium
CN105446854B (en) Consumption detection method, system and terminal
CN105183631A (en) Equipment test methods and devices
CN107562500B (en) Debugging device, method and equipment
CN109684112B (en) Program file operation method, device, terminal and storage medium
CN112685269A (en) Data acquisition method and device, electronic equipment and storage medium
CN106020694A (en) Electronic device, selected area dynamic adjusting method and device
CN112333233B (en) Event information reporting method and device, electronic equipment and storage medium
CN115951944A (en) Shortcut key setting method and device, electronic equipment and storage medium
CN109947640B (en) Regression test-based core function coverage statistical method and device
CN114780334A (en) Power consumption monitoring method, power consumption monitoring device and storage medium
CN114896165A (en) Testing method and device of conversation robot system, electronic equipment and storage medium
CN114428737A (en) Communication method, device, equipment and storage medium based on micro service system
CN113869295A (en) Object detection method and device, electronic equipment and storage medium
CN113568543A (en) Information processing method, information processing device, electronic equipment and storage medium
CN106502719A (en) The method and device of the component of management application program
CN108037875B (en) Method, device and storage medium for switching input modes
CN112363917B (en) Application program debugging exception processing method and device, electronic equipment and medium
CN114385373A (en) Data sharing method, data sharing device and computer readable storage medium
CN111597106A (en) Point burying management method and device
CN116016284B (en) Data analysis method, device, electronic equipment and storage medium
CN111611156B (en) Function test method, function test device, and computer-readable 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