CN116048963A - Packaging method, testing method, electronic device and storage medium for application program - Google Patents

Packaging method, testing method, electronic device and storage medium for application program Download PDF

Info

Publication number
CN116048963A
CN116048963A CN202211650184.7A CN202211650184A CN116048963A CN 116048963 A CN116048963 A CN 116048963A CN 202211650184 A CN202211650184 A CN 202211650184A CN 116048963 A CN116048963 A CN 116048963A
Authority
CN
China
Prior art keywords
application
code
application program
visual control
testing
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.)
Pending
Application number
CN202211650184.7A
Other languages
Chinese (zh)
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.)
Tencent Music Entertainment Technology Shenzhen Co Ltd
Original Assignee
Tencent Music Entertainment Technology Shenzhen 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 Tencent Music Entertainment Technology Shenzhen Co Ltd filed Critical Tencent Music Entertainment Technology Shenzhen Co Ltd
Priority to CN202211650184.7A priority Critical patent/CN116048963A/en
Publication of CN116048963A publication Critical patent/CN116048963A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing

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)
  • Stored Programmes (AREA)

Abstract

The application discloses a packaging method, a testing method, electronic equipment and a storage medium for an application program. The encapsulation method for the application program comprises the following steps: acquiring an original first application program code of the application program; inserting abnormal excitation codes into a plurality of sections of the original first program code through AOP to obtain second application program codes; compiling the second application code into which the exception provoking code has been inserted to obtain an application installation package for testing. Such application packages and test solutions thereof can inject exception-exciting code in a manner that minimizes interference with the application's original code, increasing the probability of occurrence of exception problems, thereby contributing to earlier exposure of exception problems so as not to impact the user's use experience. The solution has strong configurability and high mobility, obviously reduces the difficulty of configuration and migration, saves the cost of configuration and migration, and also avoids other potential problems caused by the injection of abnormal excitation codes.

Description

Packaging method, testing method, electronic device and storage medium for application program
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a packaging method, a testing method, an electronic device, and a storage medium for an application program.
Background
With the development of computer technology, in particular mobile terminal technology, a large number of applications have emerged. Such applications may create various problems after delivery. Therefore, before the application program is delivered for formal use, the application program provider can conduct a large amount of tests, so that the problems of abnormality or error and the like of the application program when the application program is used by a user are avoided as much as possible.
Currently, it is proposed to perform manual or automated testing of installed applications. However, for manual testing, on one hand, it is limited by external factors such as terminal model and network environment, and on the other hand, a lot of tester cost and test time are required to be input, and these abnormal problems cannot be triggered stably and traceably, so that the possibility of repairing the application program before the application program is released by a developer is reduced. For automated testing, it is often necessary to lay down an automated test case with a targeting that is highly targeted to a relatively fixed user interface layout, but it is difficult to accurately identify, capture, etc. these anomalies in the case of non-standard user interface designs and layouts, such as insertion of a particular view. Particularly for anomalies that occur in edge scenes, whether manual or automated testing is difficult to accurately identify, capture or reproduce stably.
It is therefore desirable to provide a solution to application testing that effectively increases the likelihood of identifying an application anomaly during testing, thereby enabling the exposure of the anomaly to be preceded by a testing phase, and reducing the probability of the user experiencing the anomaly for normal use.
The description of the background art is only for the purpose of facilitating an understanding of the relevant art and is not to be taken as an admission of prior art.
Disclosure of Invention
Based on the foregoing, it is necessary to provide a packaging method, a testing method, an electronic device and a storage medium for an application program, which can inject an abnormal excitation code in a manner of minimizing the interference of original codes of the application program, so as to increase the probability of occurrence of the abnormal problem in the testing process, thereby facilitating earlier exposure of the abnormal problem, so as not to affect the use experience of a user.
In a first aspect, there is provided an encapsulation method for an application program, comprising:
acquiring an original first application program code of the application program;
inserting exception-excited code into a plurality of cut planes of the original first program code by face-to-face programming (AOP) to obtain second application program code;
compiling the second application code into which the exception provoking code has been inserted to obtain an application installation package for testing.
In some embodiments, the inserting exception-excited code into a plurality of slices of the original first program code by slice-oriented programming (AOP) to obtain second application code includes:
the abnormal excitation code is inserted in the plurality of slices using an ASM framework.
In some embodiments, the anomaly excitation code is used to increase the probability of anomalies occurring for a given visual control.
In some embodiments, the inserting exception-excited code into a plurality of slices of the original first program code by slice-oriented programming to obtain second application code includes:
determining a visual control for performing an anomaly test;
determining a target class associated with an anomaly test of the visual control based on the determined visual control;
determining, based on the determined visual control, an objective function of an objective class associated with an anomaly test of the visual control;
based on the anomaly, a relative insertion location of the anomaly excitation code relative to the objective function is determined.
In some embodiments, the relative insertion locations include the abnormal excitation code before the objective function, after the objective function, and before and after the objective function, respectively.
In some embodiments, the determining a relative insertion position of the anomaly excitation code relative to the objective function based on the anomaly comprises:
an exception-triggering code for randomly generated delays is inserted before an objective function, which is a function associated with the visual control passing size information to a parent control.
In some embodiments, the target class is a parent control class of the visual control, and the target function of the target class is a creation function of the parent control class.
In some embodiments, the exception-triggering code is used to generate a random delay when executed based on a random seed.
In a second aspect, there is provided a test method for an application program, comprising:
encapsulating the application program installation package for testing by using the encapsulation method for the application program according to any embodiment of the application program;
installing the application program installation package in the terminal to obtain an installed application program;
and testing the installed application program to obtain a test result of the application program.
In some embodiments, the testing of the installed application includes:
One or more given manual test actions are performed at the terminal where the application is installed.
In some embodiments, the testing of the installed application includes:
and loading and executing an automatic test script by the terminal for installing the application program to automatically execute one or more automatic test actions, wherein the automatic test script records the one or more automatic execution actions, the execution time and the execution sequence.
In some embodiments, the testing of the installed application includes:
the testing of the installed application program comprises the following steps:
triggering the creation of the visual control;
responding to the trigger of creating the visual control, and screening the target class from all classes of the application program through class name inquiry;
responding to the trigger of creating the visual control, and screening out the objective function from the objective class through function name inquiry;
and executing the abnormal excitation code and the objective function of the objective class according to the relative insertion position.
In a further embodiment, the testing of the installed application program includes:
Triggering creation of the visual control for multiple times;
responsive to each trigger to create the visual control, the visual control communicates size information of the visual control to its parent control;
randomly generating a delay through the abnormal excitation code, thereby randomly delaying or not delaying the transfer of the size information;
the parent control allocates a drawing space for the visual control;
rendering the visual control based on the rendering space;
wherein, in at least a portion of the triggering of creating the visual control, the randomly generated delay of the abnormal excitation code causes the transfer of the size information to be completed after the allocation of the drawing space or the drawing of the visual control.
In a third aspect, there is provided an encapsulation device for an application program, comprising:
an acquisition unit configured to acquire an original first application code of the application;
an inserting unit configured to insert an abnormal excitation code at a plurality of cut planes of the original first program code by the cut plane-oriented programming to obtain a second application code;
and a compiling unit configured to compile the second application code into which the abnormal excitation code has been inserted to obtain an application installation package for testing.
In a fourth aspect, there is provided a test apparatus for an application program, comprising:
an encapsulation unit configured to encapsulate the application installation package for testing by using the encapsulation method for application according to any embodiment of the present application;
an installation unit configured to install the application installation package in a terminal to obtain an installed application;
and the testing unit is configured to test the installed application program to obtain a testing result of the application program.
In a fifth aspect, there is provided an electronic device, comprising: a processor and a memory storing a computer program, the processor being configured to implement the method described in any of the embodiments of the present application when the computer program is run.
In a sixth aspect, a storage medium is provided, wherein the storage medium stores a computer program configured to, when executed, implement a method as described in any of the embodiments of the present application.
In the packaging scheme for the application program, the original first application program code of the application program is obtained; inserting abnormal excitation codes into a plurality of sections of the original first program code through an AOP technology to obtain second application program codes; compiling the second application code into which the exception provoking code has been inserted to obtain an application installation package for testing. The application program package and the corresponding test solution can inject the abnormal excitation code in a mode of minimizing the interference of the original code of the application program, so that the probability of occurrence of abnormal problems in the test process is increased, and the abnormal problems are exposed earlier, so that the use experience of a user is not influenced. The solution has strong configurability and high mobility, obviously reduces the difficulty of configuration and migration, saves the cost of configuration and migration, and also avoids other potential problems caused by the injection of abnormal excitation codes. Therefore, the scheme of the embodiment of the application program remarkably improves the maintainability and the safety of the application program.
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the description that are not intended to identify essential features of the claimed subject matter. Furthermore, the claimed solution is not limited to embodiments that solve all disadvantages noted in any part of this document.
Additional optional features and technical effects of embodiments of the invention are described in part below and in part will be apparent from reading the disclosure herein.
Drawings
Embodiments of the present invention will hereinafter be described in conjunction with the appended drawings, wherein like or similar reference numerals denote like or similar elements, and wherein:
FIG. 1A illustrates an exemplary flow chart of an encapsulation method for an application of an embodiment of the invention;
FIG. 1B illustrates an exemplary flow chart of an encapsulation method for an application of an embodiment of the invention;
FIG. 2 illustrates an exemplary process diagram of a packaging and test pipeline for an application program for implementing embodiments of the present invention;
FIG. 3A illustrates an exemplary architecture diagram of a tangential plane programming (AOP) oriented technique applicable to methods of embodiments of the present invention;
FIG. 3B illustrates a cut-plane oriented programming (AOP) that may be used in the method of an embodiment of the invention
An exemplary architectural diagram of a technique;
FIG. 3C illustrates a cut-plane oriented programming (AOP) that may be used in the method of an embodiment of the invention
An exemplary architectural diagram of a technique;
FIG. 4 illustrates an exemplary process diagram of view rendering when implementing the method of an embodiment of the invention;
FIG. 5A illustrates an exemplary flow chart of a test method for an application in accordance with an embodiment of the invention;
FIG. 5B illustrates an exemplary flow chart of a test method for an application in accordance with an embodiment of the invention;
FIG. 5C illustrates an exemplary flow chart of a test method for an application in accordance with an embodiment of the invention;
FIG. 6 shows a schematic diagram of a packaging apparatus for an application program according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a test apparatus for an application program according to an embodiment of the present invention;
FIG. 8 illustrates an exemplary hardware architecture diagram of a mobile terminal capable of implementing a test method for an application according to an embodiment of the present invention;
FIG. 9 illustrates an exemplary operating system architecture diagram of a mobile terminal capable of implementing a test method for an application program in accordance with an embodiment of the present invention; and
Fig. 10 shows a schematic structural diagram of an electronic device capable of implementing the method of an embodiment of the invention.
Detailed Description
The present invention will be described in further detail with reference to the following detailed description and the accompanying drawings, in order to make the objects, technical solutions and advantages of the present invention more apparent. The exemplary embodiments of the present invention and the descriptions thereof are used herein to explain the present invention, but are not intended to limit the invention.
The term "comprising" and variations thereof as used herein means open ended, i.e., "including but not limited to. The term "or" means "and/or" unless specifically stated otherwise. The term "based on" means "based at least in part on". The terms "one example embodiment" and "one embodiment" mean "at least one example embodiment. The term "another embodiment" means "at least one additional embodiment". The terms "first," "second," and the like, may refer to different or the same object. Other explicit and implicit definitions are also possible below.
The application programs described in the embodiments of the present application may have normal meanings as understood by those skilled in the art, and may sometimes be referred to as software. The application programs described in the embodiments of the present application may be various types of application programs including, but not limited to, social applications, music applications, video/short video applications, file management applications, mail applications, shopping applications, or gaming applications, or composite applications of multiple functional combinations, etc. Social applications include instant messaging applications, SNS (Social Network Service, social networking site) applications, or live applications, among others.
The application program described in the embodiments of the present application may be installed in a terminal or a client, and the solution described in the embodiments of the present application may be partially or fully implemented or implemented in one or more devices remote from the terminal or the client, such as a server or a test device independent of the server. For example, the method and apparatus for packaging an application program according to the embodiments of the present application may be implemented in a test device.
The application program described in the embodiments of the present application may be applicable to an Android (Android) operating system or an Android-based operating system, but is not limited thereto. The application program described in the embodiments of the present application may be written in various different languages, and in a specific example, is written in Java, kotlen, or the like, but is not limited thereto. Some illustrative examples will be presented herein with ava as an example, but one skilled in the art will be able to implement embodiments of the present invention in other languages under the teachings of the present invention, which fall within the scope of the present invention.
Currently, before the application is delivered for formal use, the application provider may perform a lot of tests, so as to avoid as much as possible the problem that the application is used by the user, such as abnormality or error.
In some cases, such as insertion of a specific view, it is difficult to stably and traceably excite or accurately identify and capture such abnormal problems, especially in edge scenes.
Thus, the present inventors have unexpectedly injected exception-triggering code in a manner that minimizes application raw code (source code) intervention to increase the probability of an exception problem occurring during testing, thereby contributing to earlier exposure of the exception problem. Moreover, the present inventors have intentionally made it possible for the injected exception code to have excellent configurability and portability, thereby improving the removability of the injected exception code to avoid other potential problems caused by the injection of the exception code, and also reducing the convenience of testing the same or similar types of exception problems in other applications.
In this regard, the embodiments of the present application provide a packaging method and apparatus for an application, a corresponding testing method and apparatus, an electronic device, and a computer readable medium, which increase the probability of occurrence of an anomaly problem by injecting an anomaly excitation code using a tangent plane oriented programming (AOP) technique, thereby increasing the probability of occurrence of the anomaly problem and thus facilitating earlier exposure of the anomaly problem so as not to affect the user experience. In addition, the solution of the embodiment of the application has strong configurability and high mobility, obviously reduces the difficulty of configuration and migration, saves the cost of configuration and migration, and also avoids other potential problems caused by the injection of abnormal excitation codes.
Specific embodiments of the present application will be described in detail below with reference to the accompanying drawings.
For example, as shown in fig. 1A, a packaging method for an application program according to an embodiment of the present invention is shown. The encapsulation method for the application program may include steps S110 to S130:
s110: the original first application code of the application is obtained.
In this context, the original application code is engineering source code, which may also be simply referred to as source code.
As shown in connection with fig. 1A and 2, in embodiments of the present application, configuring the test pipeline may be included in step S110 or in a separate step. As shown in connection with fig. 1A and 2, in some embodiments, the engineering source code of an application may be pulled after the test pipeline is configured.
In some embodiments, configuring the test pipeline may include configuring a CI (continuous integration) test pipeline or a CD test pipeline. Software development through the CI/CD pipeline may be accomplished from code signing, testing, building and deployment to the production phase advancing through the pipeline, which is not described in detail herein.
In some embodiments, environmental parameters, frames, plug-ins, etc. configured for testing the package may be included in step S110 or in a separate step. In one particular embodiment, for example, a frame and/or environment configuration parameters based on tangent plane oriented programming (AOP) may be configured, as described below. In one specific example, an ASM framework may be introduced and its environmental parameters configured to be pluggable, as described below, which may be implemented when configuring a test pipeline.
S120: inserting exception-excited code into a plurality of slices of the original first program code by slice-oriented programming (AOP) to obtain second application program code.
The anomalies described in the embodiments of the present application have normal meanings in the art, and in some places herein, the anomalies may include errors (errors) or be used interchangeably therewith, covering various defects and faults of the application program, including abnormal functions or abnormal interrupts, data loss, flashing back, jamming, frame dropping, etc. that occur during the running process of the application program.
In the embodiment of the application, the anomaly excitation code is used for exciting or promoting the occurrence of anomalies, namely increasing the occurrence probability of anomalies, but not directly (100%) causing anomalies or errors. In the embodiment of the present application, the anomaly excitation code may be a code that increases the occurrence probability of a given anomaly or error, or may be a code that increases the occurrence probability of various anomalies or errors that are not specific.
In some embodiments, the anomaly excitation code is used to increase the probability of anomalies occurring for a given visual control. This will be further described below in connection with specific examples.
With reference to fig. 1A and 2 in combination, an example architecture for a tangential plane programming (AOP) technique and application of the AOP technique to methods of embodiments of the present invention is schematically described.
AOP is Aspect Oriented Programming, i.e., tangent plane oriented programming. More specifically, AOP dynamically unifies the addition of certain specific functions to a program at multiple independent locations, also called slices, without modifying the source code through precompiled approaches and dynamic proxy implementations.
Currently, there is proposed a function of inserting a non-service core function into a service model based on AOP, and injecting logs, facts, etc. reproduced in the service model may cross each service model, thereby omitting to repeatedly write codes in each service model. However, the inventors herein do not use AOP for general-purpose functions that implement non-business functions, but rather use AOP in embodiments of the present application to insert exception-excited code in multiple slices, thereby avoiding the minimization of the interference of the inserted exception-excited code with the original code (source code). Specifically, the embodiment of the application inserts the abnormal excitation code in the section in the pile-inserting mode, and the original code (source code) does not need to be modified, so that other interference on the source code caused by the original code (source code) does not need to be worried. Moreover, the thus inserted exception-motivated code can thus enjoy better configurability and migration.
In embodiments of the present application, there may be a variety of specific implementations of inserting (instrumentation) exception-triggering code at multiple facets based on facet-oriented programming (AOP).
In one implementation, such as shown in fig. 3A-3C, the exception provoking code may be inserted (instrumented) into the original code (source code) of the application program in a cut-plane form through an agent, whereby when the exception provoking code is to be invoked (when the cut-plane is reached), for example, in the case of the source code being executed by a client, the method of invoking is intercepted and the exception provoking code is executed during the interception, as if the execution flow of the source code was intercepted at the cut-point with a "cut-plane", as shown in fig. 3A-3C. By setting the cut (in) point, a cut (cut 1) forming an interception can be created accordingly, which can be understood herein as an interceptor, intercepted and optionally initialized when the program runs to the cut point, ending the interception at the cut (cut 2) or cut (out) point where the interception is completed by a related method of destroying the abnormal excitation code, as will be further described in connection with the specific embodiments of the present application.
In these embodiments, there may be a variety of specific implementations of inserting exception-triggering code in a slice. In one specific example, when the programming language is Java, it can be inserted dynamically at application runtime, either through a third party framework or through the dynamic proxy functionality of the JVM. In other examples, it is also conceivable that the slice call is compiled into bytecodes by a compiler at compile time, where new keywords are defined and the compiler is extended to implement instrumentation. In other examples, it is also conceivable that the bytecode of the slice target class is re-enhanced by a specific class loader.
In some embodiments, the facet-oriented programming (AOP) is implemented using ASM infrastructure techniques. For example, the abnormal excitation code may be inserted at multiple cuts using an ASM framework.
By way of explanation and not limitation, ASM is a framework for implementing AOP, where instrumentation is performed from the JAVA bytecode level, which may dynamically generate classes or enhance the functionality of existing classes. Specifically, ASM may directly generate binary class files, or may dynamically change class behavior before the class is loaded into the Java virtual machine. In addition, the ASM framework provides common byte code analysis and generation tools, and class generation, query or analysis conversion can be rapidly performed.
In some embodiments, the anomaly excitation code is used to increase the probability of anomalies occurring for a given visual control. As previously mentioned, current tests have difficulty accurately identifying, capturing, and capturing, abnormal problems that occur in non-standard user interface designs and layouts, such as insertion of particular views, and the like. For this reason, the anomaly excitation code of the embodiment of the present application is used to improve the probability of occurrence of anomalies under these scenarios.
In the specific embodiment shown in fig. 1B, the step S120 may include:
S121: determining a visual control for performing an anomaly test;
s122: determining a target class associated with an anomaly test of the visual control based on the determined visual control;
s123: determining, based on the determined visual control, an objective function of an objective class associated with an anomaly test of the visual control;
s124: based on the anomaly, a relative insertion location of the anomaly excitation code relative to the objective function is determined.
Various specific embodiments according to the present application will be described below in conjunction with fig. 1B and 2, 3A-3C, and 4.
In the embodiment of the application, the visual control has a normal meaning in the field, and is, for example, a visual expression form of a View (View).
As an explanation, especially in an Android or an Android-based operating system or a similar operating system according to the embodiment of the present application, activity is one of four components of Android, and is used to represent a visual interface of user operation, which provides an interface for a user to complete an operation instruction. An activity has its life cycle and performs onCreate, onStart, onResume etc. methods accordingly.
In the tree structure, under the activity (activity), a Window (Window) or a PhoneWindow is included in a manner of association inheritance, and under the Window, a View (View) or a View group (View group) may be included in a manner of association inheritance.
Further, in the embodiments of the present application, view is an abstraction of the visual controls in the user interface layer, which represents the corresponding controls. In some embodiments, the control may also be referred to as a container, e.g., a parent control may become a container that houses child controls.
Further, for views (views), associated inheritance and contained parent and child views in a tree structure may be formed. In some places herein, view may also be referred to as layout. It will be appreciated that in the tree structure of View, measurements, renderings and event distribution including Activity, window and View are transmitted stepwise through the tree structure.
Accordingly, child view classes of a parent view class (e.g., root view) may be defined in the code. Accordingly, the second control (container) may be implemented by placing the first control (container) into the second control (container) as a parent control (container) of the first control or as a child control of the second control (container). Accordingly, the parent/child View class and parent/child controls (containers) may be incorporated into the tree structure of View as previously described to pass parameters. This is known in the art, and will not be described in detail herein, and embodiments of the present application explicitly cover technical solutions having features of the present invention but represented by different representations (e.g. views, controls, containers), which all fall within the scope of the present invention.
In some embodiments, the visual controls described in embodiments of the present application may include any viable visual controls including, but not limited to, text edit boxes, buttons, links, images, and the like.
With continued reference to fig. 1B and 2, and fig. 3A-3C, in step S121, a particular control/container/View of the application to be used for anomaly testing may be determined. For example, demand analysis may be performed for newly added controls/containers/views for anomaly testing.
In one example, the control/container/View for exception testing is, for example, an active page of an application. For example, an application provider may wish to add an active skip function to the message page (primary page) of the application, i.e., drop down the message page to skip to an active link. The requirement requires dynamic creation of an active page control (View) to expose the active cover.
In a further embodiment, the cause of the anomaly problem for the control/container/View is further analyzed and determined in step S121 or in a separate step. And, the instrumentation scheme of the abnormal excitation code can be determined thereby.
For example, in one specific example, when dynamically creating a visual control (View), to adapt to different model screen sizes, the size (e.g., width, height) of the visual control (View) needs to be adapted. For this need, anomalies caused by View wide, high dynamic acquisition of 0 can be determined and their cause analyzed to determine the instrumentation scheme of the anomaly excitation code by analyzing the traffic source code.
Referring in conjunction with FIG. 4, and by way of explanation, the size of the visual control (View) need not be measured when creating the control. However, in order to draw the visual control (View), for example, because of the different model screen sizes, the dimensions (e.g., wide, high) of the visual control (View) need to be adapted when drawing a new visual control (View). Accordingly, normally, the parent control may call the onMeasure () method of the child control to measure the size of the child control, so as to obtain the size information (such as width and height) of the child control; the child controls are then assigned rendering controls available for rendering/rendering, in particular, for example, the incoming parameters widthMeasureSpec and highmeasurespec, i.e. the parent control informs the child control about the space available and about this space constraints, and the visualization control (or the corresponding View) can be dynamically rendered based on this space and constraints accordingly, for example by means of the addView method.
However, the inventor finds that the child control may not transfer valid size information to the parent control because the life cycle of the parent control (or the node with higher level) is not synchronous with the drawing of the newly added child control (View), for example, the child control may not be able to measure the size of the newly added child control (View) after the Activity is executed onCreate, onStart, onResume, in other words, the child control size (width, height) obtained by the parent control is 0. Thus, an abnormal problem may occur at the time of drawing of the child control (View) because the child controls obtained by the parent control are all 0 in size (width, height).
Further, in step S122, a target class file associated with the abnormal testing of the visual control may be determined based on the determined visual control. More specifically, the target class file may be determined based on the newly added visualization control and the cause of the anomaly.
Similarly, in step S123, an objective function of an objective class associated with the anomaly test of the visual control may be determined based on the determined visual control. More specifically, the objective function may be determined based on the newly added visual control and the cause of the anomaly.
Further, in step S124, a relative insertion position of the abnormal excitation code with respect to the objective function may be determined based on the abnormality. More specifically, the relative insertion position may be determined based on the newly added visual control and the cause of the anomaly. In the embodiment of the present application, in step S124 or in an independent step, the function and effect of the anomaly excitation code may also be determined based on the newly added visualization control and the cause of the anomaly.
In a further embodiment, the relative insertion positions include the abnormal excitation code before the objective function, after the objective function, and before and after the objective function, respectively. As shown in fig. 3A, an illustrative example of the exception-excited code being truncated (prepended) before the objective function; FIG. 3B shows an illustrative example of the truncation (post) of the abnormal excitation code after the objective function; fig. 3C shows a schematic example of a tangent plane (insertion position) of the abnormal excitation code before and after (surrounding) the objective function.
In the illustrative example of the present application, the implementation of steps S122 to S124 may be implemented based on an ASM framework. In this specific example, the ASM framework may be plugged into an engineering project, and the method may quickly and accurately obtain a function (method) and a call relationship between functions, and may also obtain class (class) information.
More specifically, object class (file) queries and object function queries may be implemented through the ASM framework. For example, in this particular example, it may be implemented by ASM framework configuration and code rewriting:
class name (className) query: the inventor realizes that the Android compiling process can compile java files into class files, and the ASM plug-in can directly read the class files and obtain all class names. The class name can help to screen out the target class, facilitate the instrumentation in the target class (file), and inject the abnormal excitation code. In this specific example, for an abnormal problem caused by that child controls obtained by a parent control are all 0 in size (width and height), the target class is, for example, a class corresponding to the parent control.
Function name (methodName) query: the class (class) file has names of various functions, the upper layer of the functions is the class (class) file, the ASM framework can directly read the function names in each class file, the function names can help to screen the objective function, and the relative position in the objective function is beneficial to injecting abnormal excitation codes. In this specific example, for an abnormal problem caused by that child control sizes (width and height) obtained by a parent control are all 0, the objective function is, for example, a creation function of the parent control class, and more specifically, a creation function onCreateRootView of a root view.
As previously described, different forms of insertion of exception-excited code may be implemented by ASM framework configuration and code overwriting, such as front, back, wrap-around. As an example, the pre-or post-insertion of the exception-excited code may be implemented by overwriting the following functions in the ASM framework:
org.objectweb. Asm.method viewer # visitdcode (pre-insert): the visitCode function is rewritten to realize the insertion of the exception-excited code from the bytecode level. The function is to make the project execute the injected code before executing the objective function, and then execute the logic of the function itself, thereby playing the role of exception test.
org.objectweb. Asm.method viewer # visitEnd (post insert): the implementation of the insertion of exception-activated code is similar to the rewriting of the visitEnd function, except that the exception-activated code functions by allowing the entry to execute the injected code after executing the logic of the object function itself.
The exception-excited code loop may also be implemented by overwriting the function or setting up a new function, bypassing some objective functions, such as bypassing the onMeasure function.
In the embodiment shown in fig. 4, the relative insertion position of the abnormal excitation code with respect to the objective function is determined to be a front, more specifically, before the creation function onCreateRootView of the parent control class, such as the root view.
In a further embodiment, the exception provoking code is operable to generate a random delay when executed based on a random seed.
For example, to ensure the robustness of the scheme, a random seed concept may be introduced by writing an exception-excited code, the extension time of the layout rendering being between [0,3000ms ], the random seed throwing a different extension time each time the exception-excited code is executed.
Those skilled in the art will appreciate that the insertion of the exception-excited code from the slice of step S120 described above may be implemented based on other frameworks or methods of AOP technology, which fall within the embodiments of the present application.
S130: compiling the second application code into which the exception provoking code has been inserted to obtain an application installation package for testing.
On this basis, an advantageous packaging scheme for dynamically acquiring a test of anomalies with a width, height, possibly 0, for View can be obtained.
Furthermore, a test scheme with strong configurability and high mobility can be designed according to the idea of AOP.
For example, as shown in fig. 5A, a test method for an application according to an embodiment of the present invention is shown. The test method for the application may include steps S510 to S530:
S510: encapsulating the application program by using an encapsulation method for the application program to obtain the application program installation package for testing;
s520: installing the application program installation package in the terminal to obtain an installed application program;
s530: and testing the installed application program to obtain a test result of the application program.
In some embodiments, the packaging method is a packaging method according to other embodiments of the present invention.
In some embodiments, the application code for generating the application installation package has the exception provoking code inserted therein, such as the second application code described in other embodiments.
In some embodiments, the terminal is an android operating system based terminal, such as a mobile terminal. In some embodiments, the operating system-based terminal, such as a mobile terminal, may be a native android-based terminal or a modified android operating system-based terminal. It is also conceivable that the terminal is based on other operating systems. Specific examples of terminals that may be used as embodiments of the present application will be described below in connection with fig. 6 and 7.
In a preferred embodiment of the invention, the mobile terminal may be a smart phone. Fig. 6 shows, by way of example only, a schematic hardware architecture of one particular embodiment of a terminal, such as a mobile terminal 600, such as a smartphone; and fig. 7 shows a system architecture diagram of one embodiment of a terminal, such as a mobile terminal 600, such as a smart phone, and more particularly, an android operating system architecture hierarchy diagram. The terminal examples shown in fig. 6 and 7 may also be used to implement the test method described in the embodiments of the present invention.
In the illustrated embodiment, a terminal, such as mobile terminal 600, may include a processor 601, an external memory interface 612, an internal memory 610, a Universal Serial Bus (USB) interface 613, a charge management module 614, a power management module 615, a battery 616, a mobile communication module 640, a wireless communication module 642, antennas 639 and 641, an audio module 634, a speaker 635, a receiver 636, a microphone 637, an ear-headphone interface 638, keys 609, a motor 608, an indicator 607, a Subscriber Identity Module (SIM) card interface 611, a display 605, a camera 606, and a sensor module 620, among others.
It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the mobile terminal 600. In other embodiments of the present application, mobile terminal 600 may include more or less components than illustrated, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
In some embodiments, the processor 601 may include one or more processing units. In some embodiments, the processor 601 may include one or a combination of at least two of the following: an Application Processor (AP), a modem processor, a baseband processor, a Graphics Processor (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, a neural Network Processor (NPU), etc. The different processing units may be separate devices or may be integrated in one or more processors.
The controller may be a neural hub and command center of the mobile terminal 600. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. The memory may hold instructions or data that the processor has just used or recycled. If the processor needs to reuse the instruction or data, it can be called directly from memory. Repeated accesses are avoided and the latency of the processor 601 is reduced, thus improving the efficiency of the system.
The NPU is a Neural Network (NN) computing processor, and can also be continuously self-learned by rapidly processing input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons.
The GPU is a microprocessor for image processing and is connected with the display screen and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor may include one or more GPUs that execute program instructions to generate or change display information.
A digital signal processor (ISP) is used to process digital signals, and may process other digital signals in addition to digital image signals.
In some embodiments, the processor 601 may include one or more interfaces. The interfaces may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a General Purpose Input Output (GPIO) interface, a Subscriber Identity Module (SIM) interface, a Universal Serial Bus (USB) interface, and the like.
It should be understood that the connection relationship between the modules illustrated in the embodiments of the present application is only illustrative, and does not limit the structure of the mobile terminal. In other embodiments of the present application, the mobile terminal may also use different interfacing manners in the foregoing embodiments, or a combination of multiple interfacing manners.
The wireless communication function of the mobile terminal 600 may be implemented by the antennas 639 and 641, the mobile communication module 640, the wireless communication module 642, the modem processor, the baseband processor, or the like.
Video codecs are used to compress or decompress digital video.
The mobile terminal 600 may implement audio functions through an audio module, speaker, receiver, microphone, earphone interface, application processor, etc. Such as music playing, recording, etc.
The audio module is used for converting digital audio information into analog audio signals for output and also used for converting analog audio input into digital audio signals.
Microphones are used to convert sound signals into electrical signals. When making a call or transmitting voice information, a user can sound near the microphone through the mouth, inputting a sound signal to the microphone.
The sensor module 620 may include one or more of the following sensors:
the pressure sensor 623 is configured to sense a pressure signal, converting the pressure signal into an electrical signal.
The air pressure sensor 624 is used to measure air pressure.
The magnetic sensor 625 includes a hall sensor.
The gyro sensor 627 may be used to determine a motion gesture of the mobile terminal 600.
The acceleration sensor 626 may detect the magnitude of acceleration of the mobile terminal 600 in various directions.
The distance sensor 629 may be configured to measure distance.
The proximity light sensor 621 may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode.
The ambient light sensor 622 is used to sense ambient light level.
The fingerprint sensor 631 may be configured to collect a fingerprint.
The touch sensor 632 may be disposed on a display screen, and the touch sensor and the display screen form a touch screen, which is also called a "touch screen". The touch sensor is used to detect a touch operation acting on or near it. The touch sensor may communicate the detected touch operation to the application processor to determine a touch event type, such as single click, double click, long press, tap, directional swipe, gather, and so forth.
The bone conduction sensor 633 may acquire a vibration signal.
An electronic device (computer), a software operating system such as a mobile terminal, may employ a layered architecture, an event driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture.
The embodiments shown herein illustrate an Android (Android) operating system platform in the form of a hierarchical architecture for illustrating the software structure of a mobile terminal. It is contemplated that embodiments herein may be implemented in different software operating systems.
Fig. 7 is a schematic diagram of an android operating system, and an android operating system may be adopted in the scheme of the embodiment of the present invention. The layered architecture divides the software into several layers, with the layers communicating through software interfaces. In some embodiments, the android system is divided into four layers, from top to bottom, an application layer 710, an application framework layer 720, android Runtime (run time) and system libraries 730, and a kernel layer 740, respectively.
The application layer 710 may include a series of application packages.
The application framework layer 720 provides an Application Programming Interface (API) and programming framework for application programs of the application layer. The application framework layer includes a number of predefined functions.
The window manager is used for managing window programs.
The content provider is used to store and retrieve data and make such data accessible to applications.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture.
The telephony manager is used to provide communication functions of the mobile terminal.
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction.
The android run time comprises a core library and a virtual machine, and is responsible for scheduling and management of an android system. The core library consists of two parts: one part is a function to be called by java language, and the other part is a core library of android. The application layer and the framework layer run in virtual machines.
The system library may include a plurality of functional modules. The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio video encoding formats, such as: MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
The kernel layer 740 is a layer between hardware and software. The kernel layer may include display drivers, camera drivers, audio interfaces, sensor drivers, power management, and GPS interfaces. In some embodiments of the invention, the display may invoke a display driver.
Furthermore, it is also conceivable that the "terminal" is not an entity terminal, but other means and/or software modules emulating a terminal. For example, in further embodiments, the terminal is a simulator simulating a terminal with an operating system, such as an android operating system, which falls within the scope of embodiments of the present application.
In some embodiments, installing the application installation package in the terminal may be accomplished by installing a local installation package file, such as an APK file in an android operating system based terminal or in a simulator thereof.
In an alternative embodiment, installing the application installation package in the terminal may be accomplished through an online store.
In some embodiments, the testing of the installed application includes: one or more given manual test actions are performed at the terminal where the application is installed.
As schematically shown in fig. 3, after the project is compiled (packaged) and installed, the application that has been injected with the abnormal excitation code by the AOP method can be tested by means of manual testing. Such manual testing may include one or more individual human-machine interactions, a plurality of human-machine interactions in a given order, multiple repetitive human-machine interactions, use of applications under different terminal/operating system configurations, or a combination thereof. The human-machine interaction comprises touch control, text input and/or voice input. Touch includes single point touch, such as single click, double click, multi-point touch, such as zoom, pan, rotate, and the like.
In an alternative embodiment, the testing of the installed application includes: and loading and executing an automatic test script by the terminal for installing the application program to automatically execute one or more automatic test actions, wherein the automatic test script records the one or more automatic execution actions, the execution time and the execution sequence.
In this alternative embodiment, scripts for automated testing may be used to simulate the interaction of manual testing and specific system configurations. In automated testing, any potential anomalies may be identified by automating one or more test cases set in a test script so that the application may be tested with high efficiency not attainable by manual testing effort or time.
As shown in connection with fig. 2, 3A-3C, and 4, when the anomaly excitation code is used to increase the probability of an anomaly occurring for a given visual control, a test may be performed for the anomaly associated with that visual control.
In the specific embodiment shown in fig. 5B, the testing the installed application program includes:
s521: triggering the creation of the visual control;
s522: responding to the trigger of creating the visual control, and screening the target class from all classes of the application program through class name inquiry;
s523: responding to the trigger of creating the visual control, and screening out the objective function from the objective class through function name inquiry;
s524: and executing the abnormal excitation code and the objective function of the objective class according to the relative insertion position.
In some embodiments, as previously described, for example, the screened out target class (file) is the parent control class.
In some embodiments, as previously described, for example, the filtered out objective function creates the function onCreateRootView for the parent control.
In some embodiments, the exception-triggering code is inserted for a pre-insertion, e.g., relative to the insertion location (cut), as described previously, as shown in FIG. 3A.
In some embodiments, the function of the exception-excited code is to introduce random delays, as previously described.
In some embodiments, anomalies caused by wide, high 0 views may be tested against a visual control (View) acquisition. As previously described, these anomalies may be, for example, display anomalies for visual controls or application crashes.
In the specific example shown in fig. 5C, the testing of the installed application may include:
s521': triggering creation of the visual control for multiple times;
s522': responsive to each trigger to create the visual control, the visual control communicates size information of the visual control to its parent control;
s523': randomly generating a delay through the abnormal excitation code, thereby randomly delaying or not delaying the transfer of the size information;
S524': the parent control allocates a drawing space for the visual control;
s525': and drawing the visual control based on the drawing space.
Wherein, in at least a portion of the triggering of creating the visual control, the randomly generated delay of the abnormal excitation code causes the transfer of the size information to be completed after the allocation of the drawing space or the drawing of the visual control.
In some embodiments, the aforementioned step S524 may include steps S522'-S525'.
In this embodiment, creation of the visualization control may be triggered multiple times by manual or automated testing. In a specific example, as previously described, the visual control is, for example, an active page displayed in an application, which may be jumped to, for example, by clicking on an active link in a drop down message page or a pop-up window. Here, triggering of the creation of the visual control may be achieved by clicking on the active link through a manual test or an automated test.
In this embodiment, as previously described, a visualization control, such as the active page, needs to be passed to the parent control at creation time, such as the size of the active page, in order for the parent control to allocate the appropriate rendering space to complete the rendering (rendering) of the visualization control (View). By way of explanation and not limitation, the appropriate rendering space is allocated by the parent control, for example, to accommodate different terminal screen sizes, but may be for other reasons. In this particular example, the parent control is, for example, a root view (RootView).
In this embodiment, by randomly delaying or not delaying the transmission of the visual control, for example, the size information (such as width and height) of the active page, the transmitted size information causes the parent control to acquire the size information of the visual control (View) as zero (width and height are zero) in some tests (triggers), that is, the parent control allocates the drawing control, even the visual control draws (renders), and then the parent control obtains the real size information of the child control.
As described in particular embodiments herein, the delay in the delivery of the size information (e.g., wide, high) may be achieved by a size measurement of a delay visualization control (View). That is, with an effective delay, the dimension measurement of the visual control (View) is not completed, or even started, until the parent control allocates drawing space for the visual control (View).
In a more specific embodiment, the delay in the size measurement of the visual control (View) is achieved by extending the rendering time of the parent control, e.g., the root View in the specific example. That is, with an effective latency, the rendering (rendering) of a parent control, such as a root View, is not completed until the parent control allocates a rendering space for the visual control (View).
In this more specific embodiment, one specific implementation is by overwriting and calling a code access (visitCode) function such that the instrumented exception-triggering code is inserted in a cut-plane form through the AOP, e.g., through the ASM framework, at a tangent point before the objective function of the target class, thereby executing the exception-triggering code inserted in a cut-plane form before executing the objective function. In one particular example, the target class is, for example, a class (e.g., class name RootView) corresponding to a parent control (root view) of the visual control, and the target function is, for example, a creation function (e.g., onCreateRootView function) of the parent control, as described above.
In one specific example, the abnormal excitation function includes, for example, code for generating random times. More specifically, the abnormal excitation function may be randomly derived from randomly extending times occurring within a given delay range, for example, by introducing a random seed, such that the rendering delay of the parent control is also within the given delay range, as described above.
In the embodiment of the present application, obtaining the test result of the application program includes: after the abnormal result is identified, the abnormal report data is provided. The exception reporting data may also be referred to herein as error reporting data. The reporting data may include anomaly or error location information. Additionally, the report data may also optionally include log records and meta information.
In some embodiments, the reporting data, or at least a portion thereof, such as an anomaly or error location, may be provided by a tester when a manual test is performed.
In other embodiments, a collection module for collecting exception report data may be installed in a terminal, such as a mobile terminal, in which an application is installed when an automated test is performed, and may be operated to collect exception stacks, log records, and meta information when an exception occurs during the automated test of the application. In some embodiments, the collection module may be integrated in the original application or an application injected with exception-triggering code.
In these embodiments, the occurrence of an application error may also be monitored, such as by one or more monitoring units, modules, and/or functions integrated by the application, to obtain or collect exception reporting data when an exception is detected, such as a display exception, crash, flashing back, stuck, dropped frame, etc.
In some embodiments, the anomalous location information includes a stack for helping to locate the misplaced location. In the embodiment of the application, the obtaining of the abnormal location information may be achieved through various means, and in particular, one or more units, modules and/or functions for calling the abnormal location information may be integrated in an application program.
In some embodiments, log (Log) records may also be referred to as oplogs, which relate to the Log of operations that an application program generates during use. In the embodiments of the present application, log records may be obtained in a variety of ways, for example, the log may be obtained through an application-integrated unit, module, and/or function. In embodiments of the present application, the log records may include log records of the application. In other embodiments of the present application, the logging may further include logging of the system, which may be obtained, for example, by tools, units, modules, and/or functions that are self-contained or modified by the system for logging.
In some embodiments, meta Information (Meta Information) relates to intrinsic Information of an application and/or intrinsic Information of a terminal running the application, such as a mobile terminal, including but not limited to, an application and/or a terminal, device Information such as a mobile terminal, environment Information, problem scene mark Information, etc., such as an application version, language environment, language version, terminal brand, terminal model, terminal unique identification code, terminal system type, system version, etc.
In some embodiments, it may further include: after identifying the exception result, a repair exception (BUG) request is submitted. When an exception is identified, an exception repair request may be submitted in the test process pipeline, either automatically or by a tester, to request the developer to repair the exception problem, which is not described in detail herein.
In the embodiment of the application, a packaging device and a testing device for application programs are also correspondingly provided.
Fig. 8 shows an encapsulation device 800 for an application according to an embodiment of the invention. The encapsulation apparatus 800 for an application program may include an acquisition unit 810, an insertion unit 820, and a compiling unit 830. The acquisition unit 810 is configured to acquire an original first application code of the application. The inserting unit 820 is configured to insert exception-excited code at a plurality of slices of the original first program code by slice-oriented programming to obtain second application code. The compiling unit 830 is configured to compile the second application code into which the abnormal excitation code has been inserted to obtain an application installation package for testing.
Fig. 9 shows a test apparatus 900 for an application according to an embodiment of the invention. The test apparatus 900 for an application may include a packaging unit 910, an installing unit 920, and a testing unit 930. The encapsulation unit 910 is configured to encapsulate the application installation package for testing by using the encapsulation method for an application according to any embodiment of the present application. The installation unit 920 is configured to install the application installation package in the terminal to obtain an installed application. The test unit 930 is configured to test the installed application program to obtain a test result of the application program.
The encapsulation means and/or the testing means disclosed in the embodiments of the present application may be implemented by software, hardware, firmware or a combination thereof. The packaging apparatus and/or testing apparatus disclosed in embodiments of the present application may be implemented by one or more computer devices, such as a general purpose computer or a special purpose computer.
Features of the method embodiments may be incorporated in an apparatus, device or storage medium embodiment or other method embodiments in a non-contradictory manner to obtain new embodiments, and features of the apparatus embodiment may also be incorporated in a non-contradictory manner to obtain new embodiments, within the scope of the invention.
In a further embodiment of the present application, there is also provided an electronic device that may include a processor and a memory storing a computer program, the processor being configured to perform the method of any of the embodiments of the present application when the computer program is run.
Fig. 10 shows a schematic diagram of an exemplary electronic device 1000 that may implement methods of embodiments of the present application, which in some embodiments may include more or fewer electronic devices than shown. In some embodiments, it may be implemented with a single or multiple electronic devices. In some embodiments, implementation may be with cloud or distributed electronic devices.
As shown in fig. 10, the electronic device 1000 includes a processor 1001 that can perform various appropriate operations and processes in accordance with programs and/or data stored in a Read Only Memory (ROM) 1002 or programs and/or data loaded from a storage portion 1008 into a Random Access Memory (RAM) 1003. The processor 1001 may be a single-core or multi-core processor, or may include a plurality of processors. In some embodiments, the processor 1001 may include a general-purpose host processor (e.g., CPU) and one or more special coprocessors such as, for example, a Graphics Processor (GPU), a neural Network Processor (NPU), a Digital Signal Processor (DSP), or other general-purpose or application-specific integrated circuits, etc. In the RAM1003, various programs and data necessary for the operation of the electronic apparatus 1000 are also stored. The processor 1001, the ROM1002, and the RAM1003 are connected to each other by a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
The above-described processor is used in combination with the memory to execute a program stored in the memory, which when executed by a computer is capable of realizing the steps or functions of the model generation method, the identification method described in the above-described embodiments.
The following components are connected to the I/O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output portion 1007 including a display, a speaker, and the like; a storage portion 1008 including a hard disk or the like; and a communication section 1009 including a network interface card such as a LAN card, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The drive 1010 is also connected to the I/O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is installed as needed in the drive 1010, so that a computer program read out therefrom is installed as needed in the storage section 1008.
Fig. 10 shows schematically only an electronic device, but an electronic device according to an embodiment of the present application may comprise more or fewer components than the electronic device shown in fig. 10 or have the same, partially the same or a different architecture than the embodiment device shown in fig. 10.
Although not shown, in some embodiments a computer readable storage medium is also provided, storing a computer program configured to perform the method of any of the embodiments of the present application when executed. The computer program comprises program modules/units constituting the apparatus according to the embodiments of the present application, which when executed, are capable of performing functions corresponding to the steps of the methods described in the embodiments above. The computer program may also be run on an electronic device as described in embodiments of the present application.
Storage media in embodiments of the present application include non-volatile and/or volatile articles of manufacture that can implement information storage by any method or technology. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
Those skilled in the art will appreciate that the embodiments of the present description may be implemented in a variety of forms, such as a method, system, or computer program product. Thus, it will be apparent to those skilled in the art that the functional modules/units or controllers and associated method steps set forth in the above embodiments may be implemented in software, hardware, and a combination of software/hardware.
The acts or steps of the methods, procedures described in accordance with the embodiments of the present application do not have to be performed in a specific order and still achieve desirable results unless explicitly stated. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Various embodiments are described herein, but the description of the various embodiments is not exhaustive and the same or similar features or portions between the various embodiments may be omitted for the sake of brevity. Herein, "one embodiment," "some embodiments," "example," "specific example," or "some examples" means that it is applicable to at least one embodiment or example, but not all embodiments, according to the present application. The above terms are not necessarily meant to refer to the same embodiment or example. Those skilled in the art may combine and combine the features of the different embodiments or examples described in this specification and of the different embodiments or examples without contradiction.
The exemplary systems and methods of the present application have been particularly shown and described with reference to the foregoing embodiments, which are merely examples of the best modes for carrying out the systems and methods. It will be appreciated by those skilled in the art that various changes may be made to the embodiments of the systems and methods described herein in practicing the systems and/or methods without departing from the spirit and scope of the invention as defined in the following claims.

Claims (15)

1. A packaging method for an application program, comprising:
acquiring an original first application program code of the application program;
inserting abnormal excitation codes into a plurality of sections of the original first program code by section-oriented programming to obtain second application program codes;
compiling the second application code into which the exception provoking code has been inserted to obtain an application installation package for testing.
2. The application program packaging method according to claim 1, wherein inserting exception-excited code into a plurality of slice planes of the original first program code by slice-oriented programming to obtain second application program code comprises:
the abnormal excitation code is inserted in the plurality of slices using an ASM framework.
3. The encapsulation method for an application according to claim 1 or 2, wherein the anomaly excitation code is used to increase the probability of anomalies occurring for a given visual control.
4. A packaging method for an application program according to claim 3, wherein said inserting exception-excited code into a plurality of slices of said original first program code by slice-oriented programming to obtain second application program code comprises:
determining a visual control for performing an anomaly test;
determining a target class associated with an anomaly test of the visual control based on the determined visual control;
determining, based on the determined visual control, an objective function of an objective class associated with an anomaly test of the visual control;
based on the anomaly, a relative insertion location of the anomaly excitation code relative to the objective function is determined.
5. The method of claim 4, wherein the relative insertion locations include before the objective function, after the objective function, and before and after the objective function, respectively.
6. A packaging method for an application according to claim 3, wherein said determining a relative insertion position of the abnormal excitation code with respect to the objective function based on the abnormality comprises:
an exception-triggering code for randomly generated delays is inserted before an objective function, which is a function associated with the visual control passing size information to a parent control.
7. The method of claim 6, wherein the target class is a parent control class of the visual control and the target function of the target class is a creation function of the parent control class.
8. The encapsulation method for an application according to claim 6 or 7, wherein the anomaly excitation code is configured to generate a random delay based on a random seed when executed.
9. A test method for an application program, comprising:
encapsulating the application installation package for testing by using the encapsulation method for application according to any one of claims 1 to 8;
installing the application program installation package in the terminal to obtain an installed application program;
And testing the installed application program to obtain a test result of the application program.
10. The application testing method according to claim 9, wherein the testing the installed application includes:
one or more given manual test actions are performed at the terminal where the application is installed.
11. The application testing method according to claim 9, wherein the testing the installed application includes:
and loading and executing an automatic test script by the terminal for installing the application program to automatically execute one or more automatic test actions, wherein the automatic test script records the one or more automatic test actions, the execution time and the execution sequence thereof.
12. The application program testing method according to any one of claims 9 to 11, wherein the application program packaging method is the packaging method for an application program according to any one of claims 4 to 8;
the testing of the installed application program comprises the following steps:
triggering the creation of the visual control;
responding to the trigger of creating the visual control, and screening the target class from all classes of the application program through class name inquiry;
Responding to the trigger of creating the visual control, and screening out the objective function from the objective class through function name inquiry;
and executing the abnormal excitation code and the objective function of the objective class according to the relative insertion position.
13. The application program testing method according to any one of claims 9 to 11, wherein the application program packaging method is the packaging method for an application program according to any one of claims 6 to 8;
the testing of the installed application program comprises the following steps:
triggering creation of the visual control for multiple times;
responsive to each trigger to create the visual control, the visual control communicates size information of the visual control to its parent control;
randomly generating a delay through the abnormal excitation code, thereby randomly delaying or not delaying the transfer of the size information;
the parent control allocates a drawing space for the visual control;
rendering the visual control based on the rendering space;
wherein, in at least a portion of the triggering of creating the visual control, the randomly generated delay of the abnormal excitation code causes the transfer of the size information to be completed after the allocation of the drawing space or the drawing of the visual control.
14. An electronic device, comprising: a processor and a memory storing a computer program, the processor being configured to implement the method according to any one of claims 1 to 13 when the computer program is run.
15. A storage medium storing a computer program configured to implement the method of any one of claims 1 to 13 when run.
CN202211650184.7A 2022-12-21 2022-12-21 Packaging method, testing method, electronic device and storage medium for application program Pending CN116048963A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211650184.7A CN116048963A (en) 2022-12-21 2022-12-21 Packaging method, testing method, electronic device and storage medium for application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211650184.7A CN116048963A (en) 2022-12-21 2022-12-21 Packaging method, testing method, electronic device and storage medium for application program

Publications (1)

Publication Number Publication Date
CN116048963A true CN116048963A (en) 2023-05-02

Family

ID=86128664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211650184.7A Pending CN116048963A (en) 2022-12-21 2022-12-21 Packaging method, testing method, electronic device and storage medium for application program

Country Status (1)

Country Link
CN (1) CN116048963A (en)

Similar Documents

Publication Publication Date Title
CN108027722B (en) Dynamically updating applications in compilation and deployment
US8433733B2 (en) Web application record-replay system and method
CN109918055B (en) Application program generation method and device
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
US20150378864A1 (en) Systems and methods for instrumenting applications for performance monitoring
US8490117B1 (en) Bridging script engines
CN104375819A (en) System, Method, and Apparatus for Automatic Recording and Replaying of Application Executions
CN104407980A (en) Mobile application automated testing device and method
CN104137057A (en) Generating and caching software code
CN112424836A (en) Techniques for displaying shader tables associated with ray traced images
CN110737589A (en) automatic point burying method, device, medium and electronic equipment
CN111831538A (en) Debugging method, device and storage medium
CN113127050B (en) Application resource packaging process monitoring method, device, equipment and medium
CN108228266B (en) Method and device for starting Fragment component between different plug-ins under Android plug-in framework
US9489179B2 (en) Application programming interface tracing mechanism
CN111258802A (en) Method for capturing application program crash information and related equipment
CN108304230B (en) Implementation method and device for adjusting application attribute and readable storage medium
CN111708704A (en) Cloud real machine testing method and device, terminal and storage medium
CN116719579A (en) AI model observability realization method and device, electronic equipment and storage medium
CN104778087B (en) A kind of information processing method and information processing unit
CN115509913A (en) Software automation test method, device, machine readable medium and equipment
CN113672908B (en) Fixed point pile inserting method, related device and system
CN116048963A (en) Packaging method, testing method, electronic device and storage medium for application program
CN114676436A (en) Android application multimedia analysis library vulnerability mining system and method based on structural variation
CN103473116A (en) Remote call method and device for data with large data volume

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