Application program exception test method and device, equipment, program and medium

Through the collaborative work of the anomaly tool program and the real-time detection service program, non-intrusive anomaly testing is realized, which solves the problems of low testing efficiency and poor accuracy in mobile terminal automated testing, and improves the stability of the test and the robustness of the system.

CN118779207APending Publication Date: 2024-10-15SHENZHEN TENCENT NETWORK INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310388685.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-03
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing technology lacks effective abnormality testing methods in mobile terminal automated testing, resulting in low testing efficiency and poor accuracy, and intrusive testing has a great impact on system stability.

Method used

Use the exception tool program to construct abnormal data that matches the target application, and establish a communication connection with the real-time detection service program to detect resource status in real time, adjust resources, ensure test stability, and achieve non-intrusive exception testing.

Benefits of technology

It improves the efficiency and accuracy of abnormality testing, reduces testing costs, and ensures the stability of testing and the robustness of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779207A_ABST
    Figure CN118779207A_ABST
Patent Text Reader

Abstract

The invention provides an exception test method for an application program, which comprises the following steps: establishing communication connection between an exception tool program and a real-time detection service program through a socket service, and sending exception data and configuration information of the exception tool program to the real-time detection service program; when it is determined that the resources needed by the abnormal test are insufficient, the resources needed by the abnormal test are adjusted; when it is determined that the abnormal tool program stops, the abnormal tool program is restarted. The invention further provides an exception testing device for the application program, electronic equipment, a program product and a storage medium. According to the invention, the efficiency and coverage of the application program exception test can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to application program testing technology, and in particular to an abnormality testing method, device, electronic device, program product and storage medium for application programs. Background Art

[0002] Related technologies When conducting automated testing of code, the current research on automated testing in the industry is basically only at the conceptual level. However, the abnormal testing in actual use is similar to the chaos engineering often mentioned in microservices. It can also be simply understood as a kind of chaos engineering capability similar to that on mobile terminals. In essence, it is to make a certain part of the system fall into a downtime or abnormal state, and then verify whether the system can respond normally in this abnormal state, so as to test the robustness and stability of the software under such abnormal systems. However, the current research on automated testing on mobile terminals is basically zero, and conventional scenario testing methods are basically some scripted auxiliary test code solutions to forcibly construct. This type of abnormal testing has low testing efficiency and poor accuracy. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides an exception testing method, device, electronic device, program product and storage medium for an application, which can automatically adapt to different exception testing environments, while improving the test efficiency and coverage of the exception testing, reducing the cost of exception testing, and improving the accuracy of the test.

[0004] The technical solution of the embodiment of the present invention is achieved as follows:

[0005] An embodiment of the present invention provides an abnormality testing method for an application program, comprising:

[0006] Identify target applications that require exception testing;

[0007] constructing exception data matching the target application program through an exception tool program;

[0008] The abnormal tool program establishes a communication connection with the real-time detection service program through a socket service, and sends the abnormal data and the configuration information of the abnormal tool program to the real-time detection service program;

[0009] The abnormality tool program performs an abnormality test on the target application program according to the abnormal data;

[0010] The real-time detection service program performs real-time detection on the resources required for the abnormal test and the survival status of the abnormal tool program;

[0011] When it is determined that the resources required for the abnormal test are insufficient, adjusting the resources required for the abnormal test;

[0012] When it is determined that the abnormal tool program is stopped, the abnormal tool program is restarted.

[0013] The embodiment of the present invention further provides an abnormality testing device for an application program, the device comprising:

[0014] The information transmission module determines the target application that needs to be tested for anomalies;

[0015] An information processing module, used for constructing abnormal data matching the target application program through an abnormal tool program;

[0016] The information processing module is used to establish a communication connection with the real-time detection service program through the abnormal tool program through the socket service, and send the abnormal data and the configuration information of the abnormal tool program to the real-time detection service program;

[0017] The information processing module is used to perform an exception test on the target application according to the exception data through the exception tool program;

[0018] The information processing module is used to perform real-time detection of the resources required for the abnormal test and the survival status of the abnormal tool program through the real-time detection service program;

[0019] The information processing module is used to adjust the resources required for the abnormal test when it is determined that the resources required for the abnormal test are insufficient;

[0020] The information processing module is used to restart the abnormal tool program when it is determined that the abnormal tool program is stopped.

[0021] In the above solution, the information processing module is used to obtain abnormal parameters matching the target application program through the abnormal tool program;

[0022] The information processing module is used to obtain the parameters of the interface corresponding to the target code and the corresponding tested function according to the target application information;

[0023] The information processing module is used to determine the parameter types included in the tested function;

[0024] The information processing module is used to process the intermediate representation according to the parameter type contained in the tested function and the abnormal parameter to form an abnormal test case corresponding to the intermediate representation.

[0025] In the above scheme, the information processing module is used to call the definition information corresponding to the block code type when the parameter type contained in the tested function is a block code type parameter;

[0026] The information processing module is used to obtain the test case corresponding to the intermediate representation;

[0027] The information processing module is used to add definition information corresponding to the corresponding block code type to the normal test case corresponding to the intermediate representation according to the abnormal parameters, so as to form an abnormal test case corresponding to the intermediate representation.

[0028] In the above scheme, the information processing module is used to call the control code corresponding to the protocol type parameter when the parameter type contained in the tested function is a protocol type parameter;

[0029] The information processing module is used to obtain the test case corresponding to the intermediate representation;

[0030] The information processing module is used to control the protocol type included in the test case corresponding to the intermediate representation according to the abnormal parameter, so as to form an abnormal test case corresponding to the intermediate representation.

[0031] In the above scheme, the information processing module is used for, when it is determined that the resources required for the abnormal test are insufficient, the real-time detection service program determines the error value of the resources required for the abnormal test;

[0032] The information processing module is used to send the error value to the abnormal tool program through the communication connection;

[0033] The information processing module is used by the exception tool program to supplement the exception data according to the error value until the resources required for the exception test are reached.

[0034] In the above scheme, the information processing module is used for, when it is determined that the abnormal tool program is stopped, the real-time detection service program sends a restart instruction and the configuration information to the abnormal tool program through the communication connection;

[0035] The information processing module is used to respond to the restart instruction, and the abnormal tool program restores the structure of the abnormal data according to the configuration information.

[0036] In the above scheme, the information processing module is used to obtain the target code included in the abnormal test case;

[0037] The information processing module is used to parse the target code through the test framework executor component;

[0038] The information processing module is used to control the execution flow of all common logics in the target code through the test framework executor component when parsing the target code of the annotated test case, so as to obtain the test result of the exception test.

[0039] In the above solution, when the target application is a game program, the abnormal data matching the target application constructed by the abnormal tool program includes at least one of the following:

[0040] Memory exception data, processor resource exception data, file read and write exception data, and disk storage exception data;

[0041] When the target application is an instant messaging program, the abnormal data matching the target application constructed by the abnormal tool program includes at least one of the following:

[0042] Memory exception data, processor resource exception data, file descriptor exception data, and disk storage exception data.

[0043] An embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0044] A memory for storing executable instructions;

[0045] The processor is used to implement the exception testing method of the preceding application program when running the executable instructions stored in the memory.

[0046] An embodiment of the present invention further provides a computer-readable storage medium storing executable instructions, wherein the executable instructions, when executed by a processor, implement an exception testing method for a preceding application program.

[0047] The embodiments of the present invention have the following beneficial effects:

[0048] 1) The embodiment of the present invention determines a target application that needs to be tested for exceptions; constructs exception data that matches the target application through an exception tool program; the exception tool program establishes a communication connection with a real-time detection service program through a socket service, and sends the exception data and configuration information of the exception tool program to the real-time detection service program; the exception tool program performs an exception test on the target application based on the exception data; thereby, the exception tool program can continuously apply to the system for various exception data resources in the background, thereby achieving the effect of non-invasively constructing exception data and performing exception testing non-invasively.

[0049] 2) The real-time detection service program performs real-time detection on the resources required for the abnormal test and the survival status of the abnormal tool program; when it is determined that the resources required for the abnormal test are insufficient, the resources required for the abnormal test are adjusted; when it is determined that the abnormal tool program is stopped, the abnormal tool program is restarted. In this way, the data construction of the real-time dynamic scheduling abnormal test can be realized, while keeping the abnormal tool program always in a survival state to ensure the stability of the test. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A schematic diagram of a usage scenario of the abnormality testing method for an application provided by an embodiment of the present invention;

[0051] Figure 2 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;

[0052] Figure 3 A schematic diagram of a city entry test triggering technique in an embodiment of the present invention;

[0053] Figure 4 A schematic diagram of the types of abnormal tests in an embodiment of the present invention;

[0054] Figure 5 An optional flowchart of the abnormality testing method for an application provided by an embodiment of the present invention;

[0055] Figure 6 This is a schematic diagram of the effect of the application exception test device in an embodiment of the present invention;

[0056] Figure 7 An optional flow chart of a test case generation method provided in an embodiment of the present invention;

[0057] Figure 8 A schematic diagram of the implementation principle of the real-time detection service program in an embodiment of the present invention;

[0058] Fig. 9 A schematic diagram of a special process started in an embodiment of the present invention;

[0059] Fig.10 A schematic diagram of the front-end display of the application exception testing method according to an embodiment of the present invention;

[0060] Fig.11 Schematic diagram of a game program abnormality testing process in an embodiment of the present invention. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present invention. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present invention.

[0062] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0063] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following interpretations.

[0064] 1) In response, it is used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.

[0065] 2) Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing. It is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model application, which can form a resource pool and be used on demand, flexible and convenient. Cloud computing technology will become an important support. The background services of technical network systems require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can only be achieved through cloud computing.

[0066] 3) Testing script: The entire testing process or part of the testing process can be automatically executed through the testing script. For example, the logical sequence of the test can be written in the testing script, and when it is automatically executed, it will be executed in the written order.

[0067] 4) Mini Program is a program developed based on a front-end language (such as JavaScript) to implement services in a Hyper Text Markup Language (HTML) page. It is downloaded by a client (such as a browser or any client with an embedded browser core) via a network (such as the Internet) and interpreted and executed in the client's browser environment, saving the steps of installation in the client. For example, by waking up the mini program in the terminal through voice commands, the social network client can download and run mini programs for various services such as ticket purchase, task processing and production, and data display.

[0068] 5) Test Case: used to execute a test function. For example, in a game, purchasing a specified equipment or releasing a specified skill can be used as a test case.

[0069] 6) Integrated Development Environment (IDE): A type of application software that assists in developing computer programs, generally including tools such as code editors, compilers, debuggers, and graphical user interfaces. It integrates the development software services such as code writing, analysis, compilation, and debugging functions. All software or software suites with this feature can be called an integrated development environment. For example, Microsoft's Visual Studio series, Borland's C++Builder, and Delphi series are all IDEs. The IDE program can run independently or in conjunction with other programs. The embodiments of the present invention mainly refer to small program debugging tools.

[0070] 7) Test environment, the Instrumentation framework is the core of the Android test environment, and many test frameworks are based on its implementation. Instrumentation is actually a class in the Android Framework. Its function is to detect the interaction between the Android system and the application. Therefore, the control of the application by the test application is realized. Instrumentation will be initialized during the App startup phase and then saved as an instance variable in the Activity Thread object. The creation of the Application, the callback of the Activity life cycle method and other operations will be completed through Instrumentation, and the corresponding method of Instrumentation will be called first.

[0071] 8) AndroidJUnitRunner, one of the Android unit testing frameworks, is a test runner for Android that is compatible with JUnit 4. The test runner can load the test package and the application to be tested to the device, run the test, and report the test results.

[0072] 9) app_process: A native executable program provided by Linux in the Android system, located in the / system / bin / directory of the Android system. The original zygote process is also started by this executable file. Its function is to start a native Java program in the shell based on this executable program. Therefore, based on this function, a process with system-level shell execution permission can be started.

[0073] 10) Abnormal test: refers to various sudden abnormalities caused by insufficient or tight resources during the dynamic changes in the load of system resources during the operation of the application, such as memory application failure, file handle descriptor opening failure, insufficient CPU resources causing threads to fail to work properly, etc. This is similar to chaos engineering of system resources on mobile terminals. Although the industry has not made a detailed and standardized definition of this abnormal test, generally speaking, if you need to verify some extreme scenarios and simulate the robustness of software in low-end configuration systems, then there is a certain demand for this test scenario.

[0074] Figure 1 A schematic diagram of a usage scenario of the abnormality testing method for an application provided by an embodiment of the present invention, see Figure 1, the terminal (including the terminal 10-1 and the terminal 10-2) is provided with a corresponding client capable of executing different functions, wherein the corresponding client is a terminal (including the terminal 10-1 and the terminal 10-2) downloading the corresponding target code from the corresponding server 200 through the network 300, the terminal is connected to the server 200 through the network 300, the network 300 can be a wide area network or a local area network, or a combination of the two, and a wireless link is used to realize data transmission, wherein the software source code can be a program code written in one or more programming languages. The software source code may include a program file for executing the business logic and a test program file for testing the program entity executing the business logic. The server 200 may extract the code object to be tested from the test program file. In addition, the server 200 may also extract a set of code objects from the program file for executing the business logic. In this way, the server 200 may use the code object to be tested as a positive sample, and may also use the code object that does not need to be tested as a negative sample. In some embodiments of the present invention, before performing software testing, the tester needs to analyze each code object in the software code to filter out the code object to be tested and the code object not to be tested. Here, a code object refers to a testable functional module in the software. In software codes of different programming languages, code objects can be different types of code entities. For example, in software code of C language, a code object can be a function. In software code of JAVA language, a code object can be a class, and in OC language on the iOS side, it can be a piece of target code. In software code of C++ language, a code object can be a class or a function. In this application, the specific types of code (target code) objects are no longer distinguished.

[0075] The structure of the server of the embodiment of the present invention is described in detail below. The server can be implemented in various forms, such as a dedicated terminal with a multimedia information processing function, or a server with a multimedia information processing function, such as the aforementioned Figure 1 Server 200 in. Figure 2 The schematic diagram of the composition structure of the server provided in the embodiment of the present invention can be understood as follows: Figure 2 Only an exemplary structure of the server is shown, not all structures, and can be implemented as needed. Figure 2 Partial or complete structure shown.

[0076] The server provided in the embodiment of the present invention includes: at least one processor 201, a memory 202, a user interface 203 and at least one network interface 204. The various components in the server 200 are coupled together through a bus system 205. It can be understood that the bus system 205 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 205 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, in Figure 2 Various buses are labeled as bus system 205 .

[0077] The user interface 203 may include a display, a keyboard, a mouse, a trackball, a click wheel, keys, buttons, a touch pad or a touch screen.

[0078] It is understood that the memory 202 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. The memory 202 in the embodiment of the present invention can store data to support the operation of the terminal (such as 10-1). Examples of these data include: any computer program for operating on the terminal (such as 10-1), such as an operating system and an application. Among them, the operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application can include various applications.

[0079] In some embodiments, the abnormality testing device for the application provided by the embodiment of the present invention can be implemented in a combination of software and hardware. As an example, the abnormality testing device for the application provided by the embodiment of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the abnormality testing method for the application provided by the embodiment of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), or other electronic components.

[0080] As an example of an abnormality testing device for an application provided in an embodiment of the present invention being implemented by a combination of software and hardware, the abnormality testing device for an application provided in an embodiment of the present invention can be directly embodied as a combination of software modules executed by a processor 201, and the software module can be located in a storage medium, and the storage medium is located in a memory 202. The processor 201 reads the executable instructions included in the software module in the memory 202, and completes the abnormality testing method for the application provided in an embodiment of the present invention in combination with necessary hardware (for example, including the processor 201 and other components connected to the bus 205).

[0081] As an example, the processor 201 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0082] As an example of hardware implementation of the abnormality testing device for the application provided in the embodiment of the present invention, the device provided in the embodiment of the present invention can be directly executed by a processor 201 in the form of a hardware decoding processor, for example, one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), or other electronic components to implement the abnormality testing method for the application provided in the embodiment of the present invention.

[0083] The memory 202 in the embodiment of the present invention is used to store various types of data to support the operation of the server 200. Examples of such data include: any executable instructions for operating on the server 200, such as executable instructions, and the program implementing the abnormality testing method from the application program of the embodiment of the present invention can be included in the executable instructions.

[0084] In other embodiments, the abnormality testing device for application programs provided by the embodiments of the present invention may be implemented in software. Figure 2The abnormality testing device 2020 of the application stored in the memory 202 is shown, which can be software in the form of a program and a plug-in, and includes a series of modules. As an example of a program stored in the memory 202, the abnormality testing device 2020 of the application can be included. The abnormality testing device 2020 of the application includes the following software modules: an information transmission module 2081 and an information processing module 2082. When the software modules in the abnormality testing device 2020 of the application are read into the RAM by the processor 201 and executed, the abnormality testing method of the application provided by the embodiment of the present invention will be implemented. The functions of each software module in the abnormality testing device 2020 of the application are introduced below:

[0085] The information transmission module 2081 determines the target application program that needs to be tested for anomalies;

[0086] An information processing module 2082, for constructing abnormal data matching the target application program through an abnormal tool program;

[0087] The information processing module 2082 is used to establish a communication connection with the real-time detection service program through the abnormal tool program through the socket service, and send the abnormal data and the configuration information of the abnormal tool program to the real-time detection service program;

[0088] An information processing module 2082 is used to perform an exception test on the target application program according to the exception data through an exception tool program;

[0089] The information processing module 2082 is used to perform real-time detection of the survival status of the resources required for the abnormal test and the abnormal tool program through the real-time detection service program;

[0090] The information processing module 2082 is used to adjust the resources required for the abnormal test when it is determined that the resources required for the abnormal test are insufficient;

[0091] The information processing module 2082 is used to restart the abnormal tool program when it is determined that the abnormal tool program is stopped.

[0092] In the above solution, the information processing module 2082 is used to obtain the abnormal parameters matching the target application program through the abnormal tool program;

[0093] The information processing module 2082 is used to obtain the parameters of the interface corresponding to the target code and the corresponding tested function according to the target application information;

[0094] Information processing module 2082, used to determine the parameter types contained in the tested function;

[0095] The information processing module 2082 is used to process the intermediate representation according to the parameter types and abnormal parameters contained in the tested function to form an abnormal test case corresponding to the intermediate representation.

[0096] In the above solution, the information processing module 2082 is used to call the definition information corresponding to the block code type when the parameter type included in the tested function is a block code type parameter;

[0097] The information processing module 2082 is used to add definition information corresponding to the corresponding block code type in the test case corresponding to the intermediate representation form according to the abnormal parameters, so as to form an abnormal test case corresponding to the intermediate representation form.

[0098] In the above solution, the information processing module 2082 is used to call the control code corresponding to the protocol type parameter when the parameter type included in the tested function is a protocol type parameter;

[0099] An information processing module 2082 is used to obtain a test case corresponding to the intermediate representation;

[0100] The information processing module 2082 is used to control the protocol type included in the test case corresponding to the intermediate representation according to the abnormal parameters, so as to form an abnormal test case corresponding to the intermediate representation.

[0101] In the above scheme, the information processing module 2082 is used for the real-time detection service program to determine the error value of the resources required for the abnormal test when it is determined that the resources required for the abnormal test are insufficient;

[0102] An information processing module 2082, for sending the error value to the abnormality tool program via a communication connection;

[0103] The information processing module 2082 is used for the abnormal tool program to supplement the abnormal data according to the error value until the resources required for the abnormal test are reached.

[0104] In the above solution, the information processing module 2082 is used for the real-time detection service program to send a restart instruction and configuration information to the abnormal tool program through a communication connection when it is determined that the abnormal tool program is stopped;

[0105] The information processing module 2082 is used to respond to the restart instruction, and the abnormal tool program restores the structure of the abnormal data according to the configuration information.

[0106] In the above solution, the information processing module 2082 is used to obtain the target code included in the abnormal test case;

[0107] The information processing module 2082 is used to parse the target code through the test framework executor component;

[0108] The information processing module 2082 is used to control the execution flow of all common logics in the target code through the test framework executor component when parsing the target code of the annotated test case to obtain the test result of the exception test.

[0109] In the above solution, when the target application is a game program, the abnormal data matching the target application constructed by the abnormal tool program includes at least one of the following:

[0110] Memory exception data, processor resource exception data, file read and write exception data, and disk storage exception data;

[0111] When the target application is an instant messaging program, the abnormal data matching the target application constructed by the abnormal tool program includes at least one of the following:

[0112] Memory exception data, processor resource exception data, file descriptor exception data, and disk storage exception data.

[0113] An embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0114] A memory for storing executable instructions;

[0115] The processor is used to implement the exception testing method of the preceding application program when running the executable instructions stored in the memory.

[0116] An embodiment of the present invention further provides a computer-readable storage medium storing executable instructions, wherein the executable instructions implement an exception testing method for a preceding application program when executed by a processor.

[0117] according to Figure 2 The electronic device shown, in one aspect of the present application, the present application also provides a computer program product or a computer program, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the different embodiments and combinations of embodiments provided in various optional implementations of the above-mentioned abnormality test method of the application program.

[0118] Combination Figure 2 The server 200 shown illustrates the exception testing method for an application provided by an embodiment of the present invention. In order to better understand the difference between the exception testing method for an application provided by the present application and the single process testing in the related art, some technical means in the process testing are first briefly described.

[0119] refer to Figure 3 , Figure 3 This is a schematic diagram of a city entry test triggering technique in an embodiment of the present invention. Figure 3 The instrumented unit tests shown are tests that run on physical devices and emulators. They can use Android framework APIs and supporting APIs, such as AndroidX APIs, Android framework APIs, and Androidsupporting APIs to complete the test. Instrumented tests provide higher fidelity than local unit tests, such as Figure 3 As shown, each Android module project will automatically construct an Android Test directory to provide developers with test codes for implementing Instrumentation Test. When these test codes are finally compiled, they will be packaged in the form of a Test Apk. This Test Apk file will provide a verification mechanism with the same signature as the target business App. When the adb shell am command is used to start the Instrumentation Test, the Android system will start the target App with the same signature based on the various information components provided in the Test Apk, and then execute the logic of the test code in the target App environment. Figure 3 As shown, the entire Android Test needs to be based on the adb shell am command to notify the Android system to start the corresponding test. The test app will be automatically read and parsed by the Android system, and then the target test app will be started for testing.

[0120] refer to Figure 4 , Figure 4 This is a schematic diagram of the types of abnormal tests in the embodiment of the present invention, in which various sudden abnormalities are caused by insufficient resources or resource shortages during the dynamic change of system resource load during the operation of the application, such as memory application failure, file handle fd opening failure, insufficient CPU resources causing threads to fail to work normally, etc. Figure 4 The exception tests shown are basically implemented on the auxiliary construction of the script code. For example, when testing memory exceptions, it is usually necessary to use the test code or choose to embed similar memory exception construction code in a certain business logic context in the corresponding scenario; then construct a specific amount of memory through a specific native programming language (such as C++'s new / malloc).

[0121] It can be seen that most of the exception testing solutions in related technologies can only use the existing programming language interface in the test code to apply for corresponding resources from the operating system, or forcibly obtain resources in a preemptive manner. However, these methods will encounter the following problems in engineering practice:

[0122] 1) Code intrusion problem: If you want to perform the exception test method in the context of business logic in the related art, you only need to add some test code responsible for constructing exception data to the business logic code; for example, in a certain main scenario, call the C++ new function through the native layer to construct a memory exception data block of a specific size, so as to verify whether the logic and performance related to the main scenario are as expected when the memory is insufficient, or whether there are memory scenarios that can cope with such extreme scenarios or simulate low-end machine configurations. However, to construct exception data in this way, some test code must be embedded in the business logic code, which is an unacceptable code standard issue whether in the R&D period or the product operation period, and this type of test code is still completely intrusive, that is, it must be in the same project as the business logic code, so it will have an adverse effect on the subsequent code quality maintenance. Therefore, the intrusive exception test in the related art is not conducive to the maintenance and operation of the target application.

[0123] 2) The problem of accuracy of exception testing: The related technology can move the exception construction from the target process to other processes when performing exception testing. For example, if you need to construct an exception test environment for a game program in an environment with a memory of less than 1GB, if you cannot accept invasive exception testing, you can construct an external tool apk separately, implement the exception code logic that needs to be constructed in this unique tool apk, and then you can implement the data construction of this type of exception test. However, the defect of this method is that the accuracy of the exception test is poor. That is, the exception data constructed by the exception tool program may differ in quantity from the data constructed by the actual system allocation. For example, a 1GB memory exception is constructed by the tool, but the memory scheduling of the Linux operating system has a priority principle and will be allocated to the foreground process resources first. Therefore, the resources actually allocated by the system memory scheduling algorithm may be only 800MB, and the effect of the exception test cannot support the actual use of the target application.

[0124] 3) Application survival problem: When performing exception testing, if a background process continues to preemptively apply for system resources, then the scheduling strategy of the Linux-based Android system is likely to automatically clean up these background processes to ensure that the foreground service can always obtain limited system resources with high priority. Therefore, if exceptions are continuously constructed in a separate background process, this abnormal process will be forcibly stopped by the system in the background, resulting in the effect of the exception construction being forcibly interrupted, and the exception test cannot be continued, which affects the effect of the exception test.

[0125] To overcome the above defects, see Figure 5 , Figure 5 An optional flow chart of the abnormality testing method for an application provided by an embodiment of the present invention is provided. It can be understood that: Figure 5 The steps shown can be performed by various servers of the abnormality testing device running the application, for example, a dedicated test terminal with an application abnormality testing function or a test server with a simulated Android system. Figure 5 The steps shown are explained.

[0126] Step 501: The application exception testing device determines a target application that needs to be tested for exceptions.

[0127] Among them, reference Figure 6 , Figure 6 The following is a schematic diagram of the application exception test effect in the embodiment of the present invention. Due to the complexity and diversity of the user's device environment, the performance of a certain page of the APP in different Android environments (different Android versions) is likely to be inconsistent, or unexpected crashes and other abnormal problems may occur in different network environments. Taking the small program of the instant messaging client as an example, when recommending a certain type of small program to the user, it is necessary to detect the status of each page in the small program through the application exception test. The traditional automated testing method based on the use case maintenance method can no longer meet the quality assurance requirements under the rapid iteration of the product. On the one hand, it is because the maintenance cost of the use case is too high and the stability is too poor, and it is difficult to achieve the purpose of improving efficiency. On the other hand, there are too many contents and scenarios that need to be tested in the business, and manual testing cannot fully cover them, such as memory leaks, stability tests, compatibility tests, weak network tests, etc. At the same time, many pages of the small program are not complicated in themselves, but if they are covered manually or by writing automated use cases, there are too many different paths for the same entrance, and the implementation cost is very high. Therefore, the application exception test mainly covers those scenarios that cannot be covered manually or the cost of covering them is very high, such as memory leak tests, basic function regression tests, compatibility tests, and weak network tests.

[0128] Due to the different types of target applications, the constructed exception data is also different. For example, when the target application is a game program, the exception data constructed by the exception tool program that matches the target application includes at least one of the following: memory exception data, processor resource exception data, file read and write exception data, and disk storage exception data; when the target application is an instant messaging program, the exception data constructed by the exception tool program that matches the target application includes at least one of the following: memory exception data, processor resource exception data, file descriptor exception data, and disk storage exception data.

[0129] The embodiment of the present invention can also implement application exception testing for any target object based on cloud technology, and save the corresponding test results. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model application. It can form a resource pool, which is used on demand and is flexible and convenient. Cloud computing technology will become an important support. Cloud computing refers to the delivery and use mode of IT infrastructure, which means obtaining the required resources through the network in an on-demand and easily scalable manner; cloud computing in a broad sense refers to the delivery and use mode of services, which means obtaining the required services through the network in an on-demand and easily scalable manner. This service can be IT and software, Internet-related, or other services. Cloud computing is the product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing. With the development of the Internet, real-time data streams, and the diversification of connected devices, as well as the demand for search services, social networks, mobile commerce, and open collaboration, cloud computing has developed rapidly. Different from the previous parallel distributed computing, the emergence of cloud computing will promote revolutionary changes in the entire Internet model and enterprise management model from a conceptual perspective.

[0130] Cloud storage is a new concept that extends and develops from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of storage devices of various types (storage devices are also called storage nodes) in the network to work together through application software or application interfaces to provide data storage and business access functions. At present, the storage method of the storage system is to create a logical volume. When creating a logical volume, a physical storage space is allocated for each logical volume. The physical storage space may be composed of disks of a storage device or several storage devices. The client stores data on a logical volume, that is, the data is stored on the file system. The file system divides the data into many parts, each of which is an object. The object contains not only data but also additional information such as data identification (ID, ID entity). The file system writes each object into the physical storage space of the logical volume, and the file system records the storage location information of each object. Therefore, when the client requests to access the data, the file system can allow the client to access the data according to the storage location information of each object. The process of the storage system allocating physical storage space to a logical volume is as follows: based on the estimated capacity of the objects stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the grouping of independent redundant disk arrays (RAID, Redundant Array of Independent Disks), the physical storage space is pre-divided into stripes. A logical volume can be understood as a stripe, thereby allocating physical storage space to the logical volume.

[0131] The application exception test results can be stored in the cloud server. When the application is maintained, the application exception test results in the cloud server are obtained to maintain the application, thereby saving time for performing the application exception test again.

[0132] refer to Figure 6 , Figure 6 FIG. 1 is a logical architecture diagram of an abnormality test of an application program according to an embodiment of the present invention, such as Figure 6As shown, the abnormal test method of the application provided by the present application is jointly executed by an abnormal tool program (abnormal tool APP) and a real-time detection service program (TChao Monitor Service), wherein the bottom of the logical architecture diagram represents the public system scheduling management strategy of the Android system, such as memory management, CPU scheduling algorithm, etc., which is related to the specific Android system version and a specific Linux kernel algorithm. And the target application in the upper right corner represents the business application program that needs to construct abnormal data when performing abnormal testing, because the abnormal tool program will occupy the notification bar in the form of a foreground service to run, so the resident notification bar is always used to keep the background alive, in the abnormal tool program, the abnormal data will be continuously constructed by the abnormal parameters pre-configured by the user, and then the socket service and the real-time detection service program background service are continuously synchronized and communicated. After running the abnormal tool program, when using the game application program normally, the corresponding abnormal data restrictions will be encountered in any scene, and the abnormal tool will continue to apply for various abnormal data resources to the system in the background. In this way, the effect of constructing abnormalities is achieved without intrusion.

[0133] The other real-time detection service program, which also runs in the background, continuously performs real-time detection of the survival status of resources and abnormal tools in the background. When the abnormal tool starts to construct abnormal data with specific parameters, it will be synchronized to the real-time detection service program through the socket. The real-time detection service program will configure the abnormal construction parameters at that time to persist locally, and then continue to call the relevant real-time detection interface to detect the overall resource situation of the Android system at this time. When errors are found in resources, requests for supplementary abnormal construction will be continuously sent to the abnormal tool program through the socket. The abnormal tool program will continue to construct abnormal data with error values, and then repeat and continue the whole process until the accuracy of the abnormal construction can reach the expected range value.

[0134] In addition, when the exception tool program is continuously constructed in the background, it will be restricted by the scheduling strategy of the Android system, so it is very likely to be killed by the system management mechanism during the process of continuously constructing exceptions. When the exception tool program stops, the real-time detection service program will obtain the stop information through the dynamic real-time detection process survival status. At this time, it will start to call the internal logic and restart the exception tool program through the am command. At the same time, the socket communication is used to transparently transmit the previously continuously synchronized and persistent exception configuration information to the newly started exception tool program. The exception tool program will restore the exception construction data and process when it was stopped before according to the transmitted exception configuration information. Through this continuous game process, the effect and demand of continuously constructing exceptions can be achieved.

[0135] Combine the following Figure 6The logical architecture of the application anomaly test shown illustrates the working processes of the anomaly tool program and the real-time detection service program executed by the application anomaly test device.

[0136] The exception tool program implements 1) constructing exception data, 2) performing an exception test on the target application, and 3) sending the exception data and configuration information of the exception tool program to the real-time detection service program by executing steps 502 to 504.

[0137] Step 502: The application exception testing device constructs exception data matching the target application through an exception tool program.

[0138] In some embodiments of the present invention, constructing abnormal data matching the target application program through an abnormal tool program can be implemented in the following ways:

[0139] Obtain exception parameters that match the target application through the exception tool program; obtain the parameters of the interface corresponding to the target code and the corresponding tested function according to the target application information; determine the parameter types contained in the tested function; process the intermediate representation according to the parameter types and exception parameters contained in the tested function to form an exception test case corresponding to the intermediate representation. Due to the diversity of test environments, the multi-process parallel testing method of this application is used as an example to adapt to different test environments, achieve the effect of automated testing, and reduce the frequency of manual intervention by developers. In the test case acquisition stage, for some target codes that cannot be directly split, the parameters of the interface corresponding to the target code and the corresponding tested function can also be obtained according to the main process information and the sub-process information; determine the parameter types contained in the tested function; process the intermediate representation according to the parameter types contained in the tested function to form a test case corresponding to the intermediate representation. Among them, the use case code framework can be automatically generated according to the obtained interface code data, wherein the parameters of the interface include: interface name, return value type, parameter list, class name and other data, wherein the content of the tested function includes: introduction of dependent header files, test class definition, setup / teardown functions, use case annotation information, and use case function code.

[0140] The following is an explanation of the process of forming test cases corresponding to the intermediate representations.

[0141] refer to Figure 7 , combined with Figure 2 The server 200 shown illustrates the test case generation method provided by the embodiment of the present invention, see Figure 7 , Figure 7 An optional flow chart of the test case generation method provided in the embodiment of the present invention is as follows: Figure 7The steps shown are explained.

[0142] Step 701: When the parameter type contained in the tested function is a block code type parameter, the definition information corresponding to the block code type is called.

[0143] Through step 701, it is possible to add definition information corresponding to the corresponding block code type in the test case corresponding to the intermediate representation.

[0144] Step 702: When the parameter type included in the tested function is a protocol type parameter, call the control code corresponding to the protocol type parameter.

[0145] Through step 702, it is possible to control the protocol type included in the test case corresponding to the intermediate form of expression, so as to generate the corresponding assertion code in conjunction with obtaining the return value. Taking the game program test environment as an example, for the real-time detection service program TChaoMonitorService, multiple test cases can be stored in the test case library of TChaoMonitorService, which can include the test cases collected by the tester in the historical test phase, or the targeted test cases set for the target game program. After obtaining the test case corresponding to the intermediate form of expression, the following two methods can be used: 1) add the definition information corresponding to the corresponding block code type, 2) control the protocol type included in the test case, and obtain the abnormal test case corresponding to the intermediate form of expression according to the test requirements.

[0146] Step 703: When the parameter types contained in the tested function include block code type parameters and protocol type parameters, the corresponding asynchronous waiting code is called.

[0147] In some embodiments of the present invention, the mapping relationship between the return value type and the assertion code example is shown in Table 1, wherein only the correct and complete assertion code can be generated to detect the target code in conjunction with the test case.

[0148] Table 1

[0149] Step 704: Add definition information corresponding to the corresponding block code type to the test case corresponding to the intermediate representation to obtain the test case.

[0150] After obtaining the test case of the process test, continue to execute step 503 to complete the data synchronization with the real-time detection service program.

[0151] Step 503: The abnormality testing device of the application establishes a communication connection with the real-time detection service program through the abnormality tool program by using the socket service, and sends the abnormality data and the configuration information of the abnormality tool program to the real-time detection service program.

[0152] Step 504: The application exception testing device performs an exception test on the target application according to the exception data through the exception tool program.

[0153] refer to Figure 6 ,The tool App for anomaly testing is composed of three parts: socket ,component (socket), scheduling service component and ,abnormal interface component. The socket component is a native detection service ,implemented in Java and is responsible for synchronizing the ,abnormal parameters with the real-time detection service program.

[0154] The scheduling service component synchronizes specific exception data and configuration information of the exception tool program, including the following functions:

[0155] 1) The exception parameter configuration function and sp function can realize that every time the exception construction parameters are set through the tool UI, the tool will persist the exception construction parameters specified by the tool user through android sharedpreferences. Among them, sp storage is specifically used to store the data types of a single small data storage, including:

[0156] a)boolean, float, int, long, String;

[0157] b) The path where data is saved: / data / data / packageNmae / shared_prefs / yyy.xml.

[0158] 2) Abnormal data synchronization logic function: by continuously calling the interface of the socket layer, the executed abnormal construction parameters are transmitted to the real-time detection service program service. Through this function, the specific configuration parameter data of the current expected construction can be synchronized to the real-time detection end in real time, so that the real-time detection end can dynamically call back the abnormal tool according to the actual resource load of the system. Therefore, using the abnormal data synchronization logic function, the abnormal data synchronization has two capabilities. One is responsible for passing the expected abnormal construction parameters to the real-time detection service program real-time detection end, and the other is to detect the scheduling abnormal construction request from the real-time detection service program real-time detection end through the socket, and then dynamically and continuously construct the required abnormal data in real time.

[0159] 3) An exception data recovery logic function: When the exception tool program is forcibly killed by the Android system, it is awakened and restarted by the real-time detection service program, and the previously synchronized exception configuration data is obtained from the real-time detection service program. The exception data is reconstructed through the underlying exception construction interface to achieve the purpose of persistently constructing exceptions and meet the requirements of the test scenario.

[0160] The third part is the native layer logic based on C++, which mainly includes various exception construction logic interfaces based on native programming languages ​​(such as C++). For example, memory exceptions are forced to apply for memory blocks through new / malloc, and CPU exceptions are forced to start some threads to grab CPU time slice resources through threads, etc. This is basically similar to the traditional method of constructing exception scenarios, so I will not go into details here.

[0161] The real-time detection service program is implemented through steps 505 to 507: 1) detecting the survival status of the abnormal tool program to ensure that the abnormal tool program is always in a survival state; 2) adjusting the resources required for the abnormal test in real time.

[0162] Step 505: The abnormality testing device of the application program performs real-time detection of the survival status of the resources required for the abnormality test and the abnormality tool program through the real-time detection service program.

[0163] Step 506: The abnormality testing device of the application program detects the service program in real time, and when it is determined that the resources required for the abnormality testing are insufficient, the resources required for the abnormality testing are adjusted.

[0164] For example, when performing memory anomaly detection for memory below 1G, if it is determined that the remaining memory in the system is greater than 1G, the real-time detection service program continues to notify the anomaly tool program to continue occupying the memory until the remaining memory in the system is less than or equal to 1G.

[0165] Step 507: The abnormality testing device of the application program detects the service program in real time, and when it is determined that the abnormal tool program is stopped, restarts the abnormal tool program.

[0166] Before introducing the real-time detection service program, we first explain the implementation principle of the real-time detection service program. Figure 8 , Figure 8The schematic diagram of the implementation principle of the real-time detection service program in the embodiment of the present invention, wherein app_process is actually a system-level executable program embedded in the Android system, located in the / system / bin / directory of the Android file system, wherein the original application process zygote is also constructed by this executable program; but although ordinary user-level Apps are copied from the zygote process, they are generally restricted in various permissions in the initialization logic related to the copy. However, although the executable program of this app_process cannot be used by ordinary App processes, it can be driven by the adb executable program on the PC side, so as long as the adb terminal on the PC side starts the Linux process through this app_process, it can have system-level execution permissions. Taking the Android operating system as an example, there are several common hook frameworks in the Android system: Xposed (controls the Zygote process by replacing the / system / bin / app_process program, so that the app_process will load the XposedBridge.jar Jar package during the startup process, thereby hijacking the Zygote process and the Dalvik virtual machine it creates), Cydia Substrate (a code modification platform that can modify the code of any process) and Legend (an APK hook framework in the non-root environment of the Android system. The framework code is concise and highly versatile, and is suitable for some hook scenarios during reverse engineering. It directly constructs the virtual machine data structure corresponding to the new and old methods, and then replaces the information and writes it into the memory).

[0167] Fig. 9 This is a schematic diagram of a special process started in an embodiment of the present invention, wherein the composition of a special process includes the following five parts: program code, data, variables (occupying system memory), open files (file descriptors), and environment (a series of environment variables). Some of these five parts are shared between processes; some are exclusive to processes. (Here we are talking about the components of the process, not the memory space composition of the process)

[0168] In the Linux system, each process is assigned a unique numeric number, which is the process identifier PID. Their usual value range is a positive integer from 2 to 32768 (because the serial number 1 is already occupied). When the process is started, the system will sequentially select the next unused number as its PID. When the process is started through app_process, the logic of app_process is different from the normal App startup logic. The process started in this way belongs to the native Java process of the Linux system. Since app_process will inherit from the init process with pid 1 by default, the process started in this way naturally has the shell permissions corresponding to the init process. For example Fig. 9 As shown in the figure, when an EventDog shell Service process is started through app_process, it can be seen through the ps command that the parent process of this EventDog shell Service process is the init process with pid 1, so the system-level shell command can be executed through the java process component in this process. Therefore, this capability can be used to perform various real-time system-level dynamic real-time detection capabilities such as real-time detection of process survival status by ps and real-time detection of system memory status by top in the background. On this basis, when the app_process process is run in the backend, it can be used to detect the system resource situation and the process survival status of the abnormal tool apk in real time. Once a change occurs, it can be synchronized to the abnormal tool apk using the native communication method of the socket, while also ensuring the ability of the abnormal tool program to keep alive.

[0169] refer to Figure 6 The logical structure shown in the figure is that the core modules of the entire real-time detection service program are based on Figure 8 The Android app_process shown starts a special background process with shell permissions. This process has the ability to run various system-level resource real-time detections in the backend and control application restarts. The real-time detection service program also uses the native socket module to synchronize and communicate with the abnormal tool. The main functions of the socket part are basically the same as the data synchronization and data recovery in the abnormal tool introduced earlier. The difference is that when synchronizing data, the socket in the real-time detection service program acts as a service end to periodically obtain synchronization data from the socket client of the abnormal tool; and when data is recovered, it transmits synchronization data to the socket client of the abnormal tool.

[0170] The underlying core modules of the real-time detection service program are mainly two sub-services of real-time detection capabilities: the system resource real-time detection sub-service and the process real-time detection keep-alive sub-service. Both sub-services are based on the shell executor as the basic capability to encapsulate the relevant real-time detection capabilities. The system resource real-time detection sub-service is responsible for real-time detection of the system-level load required in the Android system. Its principle is based on the top command of Linux, and continuously obtains the latest data of the current system from the runtime execution callback, such as available memory, CPU load, io, etc.; when the socket receives the abnormal configuration data synchronized from the abnormal tool socket client in real time, it will comprehensively judge whether the callback scheduling difference value is needed based on the global data indicators detected in real time, and will also cache the abnormal configuration data on the tool side. The process real-time detection keep-alive sub-service is another core capability of parallel execution. It is mainly based on commands such as ps and am, and continuously detects whether the abnormal tool program is alive in real time. Once the process is detected to be stopped, am will be called to restart the abnormal tool program, and then the previously cached abnormal configuration data will be sent through the socket to notify the abnormal tool to restore the previous abnormal construction logic. Based on such a mutually synchronized logic, the data construction of the exception test is dynamically scheduled in real time, while the exception tool program is kept alive to ensure the stability of the exception test.

[0171] In order to better illustrate the abnormality testing method of the application provided by the present application, the abnormality testing method of the application provided by the present application is described below by taking the abnormality testing of a shooting game (such as PUBG Mobile) through Unreal Engine 4 as an example, wherein: Fig.10 The front-end display diagram of the application exception testing method of the embodiment of the present invention is shown in FIG. In order to ensure the normal operation of the game screen, it is necessary to construct memory exception data, processor resource exception data, file read and write exception data, and disk storage exception data, and perform exception tests respectively. Fig.10 As shown, when the service required by the tool is started, it will be resident in the Android system Figure 4 There are two services in it, one is the socket service (TChaoMonitorService) provided by the Java native background process, and the other is the foreground service implemented by Android natively (a socket service is also encapsulated internally, that is, the exception tool App). When the target game program is started and enters any scene, exceptions will be continuously constructed in the backend to ensure that the exception tool will continue to occupy the system's available running memory resources until the available running memory resources provided to the target game program are only the expected 1GB.

[0172] Fig.11The following is a schematic diagram of the abnormal test process of the game program in the embodiment of the present invention. Taking the abnormal extreme test scenario where the system running memory is less than 1GB as an example, assuming that the running memory configuration of the Android system is 4GB, when the relevant abnormal test capability needs to be used, on an Android mobile phone with the tool provided by the present invention installed, the shell service in the tool Apk is started through the adb command on the PC side. The following steps are performed:

[0173] Step 1101: Construct memory exception data matching the game program through an exception tool program.

[0174] Before executing step 1101, it is necessary to start the corresponding class (javaservice class) of the abnormal tool program through the adb command. This class will serve as the main entry point and start the socket local service and two real-time detection sub-services in the form of a java native process.

[0175] When the exception tool continues to construct memory exception data in the background after receiving the scheduling synchronization, the Android system will stop the exception tool process that survives in the background to ensure the priority of the foreground program resources. At this time, the process real-time detection keep-alive sub-service of TChaoMonitorService will detect that the process information of the exception tool has been killed. At this time, the shell executor will be called to restart the exception tool process based on the am command. At the same time, the information of the expected system remaining available running memory of 1G that needs to be constructed before will be synchronized to the newly restarted exception tool through the socket. The exception tool will continue the unfinished construction logic until the memory exception test requirements are met.

[0176] Step 1102: The abnormal tool program establishes a communication connection with the real-time detection service program through the socket service, and sends the abnormal data and the configuration information of the abnormal tool program to the real-time detection service program.

[0177] Before executing step 1102, after installing the apk tool application provided by the technical solution, a foreground service will automatically be stationed in the notification bar of the Android device. This foreground service is a preemptive service provided by the abnormal tool program. At this time, the socket service will be started in this foreground service and start real-time detection. In addition, after starting the abnormal tool program, you can configure various abnormal configurations in the tool UI. Because you need to construct an available running memory of 1GB, you need to Fig.10 Enter 1024 (the default unit is MB) in the position 1 (Mem Left Size) shown in the figure to complete the construction of available operating memory. Fig.10Click the StartMemLeft button in the dialog box to start the memory exception data construction. After the configuration information is completed, you can switch the exception tool program to the background and start opening the target game program App. Fig.10 The position 2 shown in the figure can display the logo of the constructed available running memory. Fig.10 The StartMemLoad button in the Fig.10 The front-end display diagram of the application exception testing method shown in FIG. 10 , the user can also test the GPU exception and the disk exception separately according to the testing requirements of the game program, by triggering the SartCpuLoad button shown in 10 to select the GPU to be tested, or by triggering the StartDiskLoad button shown in 10 to select the disk to be tested.

[0178] Step 1103: The abnormality tool program performs an abnormality test on the game program according to the abnormal data.

[0179] When the service required by the abnormal tool program is started, the previous embodiment will be permanently resident in the Android system. Figure 6 There are two services in it, one is the socket service (TChaoMonitorService) provided by the Java native background process, and the other is the foreground service implemented by Android natively (a socket service is also encapsulated internally, that is, the exception tool program). When the target game program is started and enters any scene, memory exception data will be continuously constructed in the backend to ensure that the exception tool program will continue to occupy the system's available running memory resources until the available running memory resources provided to the target game program are only the expected 1GB.

[0180] Step 1104: The real-time detection service program performs continuous real-time detection on the survival status of the resources required for the abnormal test and the abnormal tool program.

[0181] Step 1105: When it is determined that the memory resources required for the abnormal test are insufficient, the memory resources required for the abnormal test are adjusted; when it is determined that the abnormal tool program is stopped, the abnormal tool program is restarted until the abnormal test of the game program is completed.

[0182] Since the allocation of physical running memory is always determined by the memory scheduling algorithm of the operating system, ordinary App processes cannot intervene. Therefore, although the abnormal tool will forcibly apply for 3GB of abnormal memory data resources at the beginning (these are actually virtual memory resources), the physical running memory actually allocated to the abnormal tool by the operating system may be less than 3GB. Therefore, at this time, TChaoMonitorService will use the system resource real-time detection sub-service to detect the available physical running memory of the system as a whole in real time. When it is found that the available physical running memory is still higher than 1GB, for example, it is found through detection that the actual available physical running memory is still 1.5GB available, then the scheduling value of 0.5GB will be re-called back to the abnormal tool program through the socket. The abnormal tool program will continue to construct 0.5GB of abnormal memory data after receiving the scheduling. Then TChaoMonitorService continues to detect in real time until the actual available physical running memory is less than or equal to 1GB, and then the scheduling is stopped. It should be noted that the scheduling value of 0.5GB is only an example, and this application does not make specific restrictions on the scheduling value in the resource adjustment process.

[0183] Beneficial technical effects:

[0184] 1) The embodiment of the present invention determines the target application that needs to be tested for exceptions; constructs exception data that matches the target application through an exception tool program; the exception tool program establishes a communication connection with a real-time detection service program through a socket service, and sends the exception data and configuration information of the exception tool program to the real-time detection service program; the exception tool program performs an exception test on the target application based on the exception data; thereby, the exception tool program can continuously apply to the system for various exception data resources in the background, thereby achieving the effect of non-invasively constructing exception data and performing exception testing non-invasively.

[0185] 2) The real-time detection service program detects the resources required for the abnormal test and the survival status of the abnormal tool program in real time; when it is determined that the resources required for the abnormal test are insufficient, the resources required for the abnormal test are adjusted; when it is determined that the abnormal tool program is stopped, the abnormal tool program is restarted. In this way, the data construction of the real-time dynamic scheduling of the abnormal test can be realized, while keeping the abnormal tool program always alive to ensure the stability of the test.

[0186] 3) Since the system will stop the abnormal tool program from time to time, the real-time detection service program will continuously restart the abnormal tool program, and use the abnormal configuration information saved during data synchronization to restore the abnormal data construction when it was stopped and continue to execute the abnormal data construction process. In this way, the effect and demand of continuously constructing abnormal data for abnormal testing can be achieved.

[0187] The above are only embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for abnormal testing of an application, characterized in that: The method comprises: Identify target applications that require exception testing; constructing exception data matching the target application program through an exception tool program; The abnormal tool program establishes a communication connection with the real-time detection service program through a socket service, and sends the abnormal data and the configuration information of the abnormal tool program to the real-time detection service program; The abnormality tool program performs an abnormality test on the target application program according to the abnormal data; The real-time detection service program performs real-time detection on the resources required for the abnormal test and the survival status of the abnormal tool program; When it is determined that the resources required for the abnormal test are insufficient, adjusting the resources required for the abnormal test; When it is determined that the abnormal tool program is stopped, the abnormal tool program is restarted.

2. The method according to claim 1, characterized in that The constructing of abnormal data matching the target application program through an abnormal tool program includes: Acquiring exception parameters matching the target application program through the exception tool program; According to the target application information, obtaining parameters of the interface corresponding to the target code and the corresponding tested function; Determine the parameter types included in the tested function; The intermediate representation is processed according to the parameter type contained in the tested function and the abnormal parameter to form an abnormal test case corresponding to the intermediate representation.

3. The method according to claim 2, characterized in that The processing of the intermediate representation according to the parameter type contained in the tested function and the abnormal parameter to form an abnormal test case corresponding to the intermediate representation includes: When the parameter type included in the tested function is a block code type parameter, calling definition information corresponding to the block code type; Obtaining a test case corresponding to the intermediate representation; According to the abnormal parameters, definition information corresponding to the corresponding block code type is added to the test case corresponding to the intermediate representation form to form an abnormal test case corresponding to the intermediate representation form.

4. The method according to claim 2, characterized in that: The processing of the intermediate representation according to the parameter type contained in the tested function and the abnormal parameter to form an abnormal test case corresponding to the intermediate representation includes: When the parameter type included in the tested function is a protocol type parameter, calling a control code corresponding to the protocol type parameter; Obtaining a test case corresponding to the intermediate representation; According to the abnormal parameters, the protocol type included in the test case corresponding to the intermediate representation is controlled to form an abnormal test case corresponding to the intermediate representation.

5. The method according to claim 1, characterized in that When it is determined that the resources required for the abnormal test are insufficient, adjusting the resources required for the abnormal test includes: When it is determined that the resources required for the abnormal test are insufficient, the real-time detection service program determines an error value of the resources required for the abnormal test; sending the error value to the anomaly tool program via the communication connection; The exception tool program supplements the exception data according to the error value until the resources required for the exception test are reached.

6. The method according to claim 1, characterized in that When it is determined that the abnormal tool program is stopped, restarting the abnormal tool program includes: When it is determined that the abnormal tool program is stopped, the real-time detection service program sends a restart instruction and the configuration information to the abnormal tool program through the communication connection; In response to the restart instruction, the exception tool program restores the configuration of the exception data according to the configuration information.

7. The method according to claim 2, characterized in that The abnormality tool program performs an abnormality test on the target application according to the abnormal data, including: Obtaining the target code included in the abnormal test case; Parsing the target code through a test framework executor component; When the target code of the annotated test case is parsed, the execution flow of all common logics in the target code is controlled by the test framework executor component to obtain the test result of the exception test.

8. The method according to claim 1, characterized in that The method further comprises: When the target application is a game program, the abnormal data matching the target application constructed by the abnormal tool program includes at least one of the following: Memory exception data, processor resource exception data, file read and write exception data, and disk storage exception data; When the target application is an instant messaging program, the abnormal data matching the target application constructed by the abnormal tool program includes at least one of the following: Memory exception data, processor resource exception data, file descriptor exception data, and disk storage exception data.

9. An abnormality testing device for an application, characterized in that: The device comprises: The information transmission module determines the target application that needs to be tested for anomalies; An information processing module, used for constructing abnormal data matching the target application program through an abnormal tool program; The information processing module is used to establish a communication connection with the real-time detection service program through the abnormal tool program through the socket service, and send the abnormal data and the configuration information of the abnormal tool program to the real-time detection service program; The information processing module is used to perform an exception test on the target application according to the exception data through the exception tool program; The information processing module is used to perform real-time detection of the resources required for the abnormal test and the survival status of the abnormal tool program through the real-time detection service program; The information processing module is used to adjust the resources required for the abnormal test when it is determined that the resources required for the abnormal test are insufficient; The information processing module is used to restart the abnormal tool program when it is determined that the abnormal tool program is stopped.

10. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable instructions; A processor, configured to implement the abnormality testing method for an application program as described in any one of claims 1 to 8 when running the executable instructions stored in the memory.

11. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the abnormality testing method for the application program according to any one of claims 1 to 8 is implemented.

12. A computer-readable storage medium storing executable instructions, characterized in that: When the executable instructions are executed by a processor, the abnormality testing method for the application program according to any one of claims 1 to 8 is implemented.