A method, device, equipment and storage medium for testing an application program
By implanting a test-specific program in the class loading module of the operating system and running the application on the simulator to obtain class loading data, the problem of low dynamic test coverage is solved and accurate evaluation of the application is achieved.
Patent Information
- Application Number
- CN202011445239.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2040-12-08
AI Technical Summary
Existing applications have low dynamic test coverage, cannot accurately evaluate test results, and cannot effectively quantify test results.
Pre-implant the test-specific program in the class loading module of the operating system, deploy the matching operating system in the simulator, run the application under test through the simulator and operating system, obtain the class loading data of the application, and parse the class A collection of names to calculate class test coverage.
This achieves accurate acquisition of the class test coverage of the application, thereby enabling accurate evaluation of the test results of the application to be tested.
Smart Images

Figure CN112506782B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of software testing, and in particular to a method, apparatus, device and storage medium for testing an application program. Background Art
[0002] With the continuous development of Internet technology and computer technology, application testing has become an indispensable part of the application development process.
[0003] At present, the current testing of applications is mainly divided into static detection and dynamic monitoring. For static detection, only the application file itself needs to be checked, and the accuracy of the test can be improved through vulnerability scanning, key checking and other methods. For dynamic testing of applications, the application software is usually run on a terminal, and then its runtime actions are monitored; however, many codes of the application need to be run in specific scenarios, and general task tests will not trigger them. Therefore, when dynamically detecting the application, the test coverage of the application code is low, and the actual test effect is poor. At the same time, since the test results cannot be effectively quantified, it is impossible to accurately evaluate the test results of the application. Summary of the invention
[0004] The embodiment of the present invention provides a method, apparatus, device and storage medium for testing an application program to obtain class loading data of the application program to be tested.
[0005] In a first aspect, an embodiment of the present invention provides a method for testing an application program, comprising:
[0006] Obtain an application to be tested, and deploy an operating system matching the application on a simulator; wherein a test-specific program is pre-implanted in a class loading module of the operating system;
[0007] The application is run through the simulator and the operating system, and the class loading data of the application is obtained through the test-specific program.
[0008] In a second aspect, an embodiment of the present invention provides a testing device for an application program, including:
[0009] An application acquisition module is used to acquire an application to be tested and deploy an operating system matching the application on the simulator; wherein a test-specific program is pre-implanted in a class loading module of the operating system;
[0010] The class loading data acquisition module is used to run the application program through the simulator and the operating system, and to acquire the class loading data of the application program through the test-specific program.
[0011] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0012] one or more processors;
[0013] a storage device for storing one or more programs,
[0014] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for testing the application program described in any embodiment of the present invention.
[0015] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for testing an application program described in any embodiment of the present invention.
[0016] The technical solution disclosed in the embodiment of the present invention, after obtaining the application to be tested, pre-implanted a test-specific program in the class loading module of the operating system that matches the application, and deployed the operating system that matches the application on the simulator, and simultaneously ran the application to be tested through the current simulator and the operating system, and according to the pre-implanted test-specific program, achieved the acquisition of the class loading data of the application to be tested, and at the same time, by parsing the application to obtain a class name set, and according to the class loading data and the class name set, achieved the accurate acquisition of the class test coverage of the application, thereby achieving the accurate evaluation of the test results of the application to be tested. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flow chart of a method for testing an application program provided in Embodiment 1 of the present invention;
[0018] Figure 2A It is a flow chart of a method for testing an application program provided in a specific application scenario 1 of the present invention;
[0019] Figure 2B is a structural block diagram of a testing device for an application program provided in Embodiment 2 of the present invention;
[0020] Figure 3 This is a structural block diagram of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0021] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0022] Embodiment 1
[0023] Figure 1 This is a flowchart of a method for testing an application provided in Embodiment 1 of the present invention. This embodiment can be applied to obtaining class loading data of an application to be tested when testing an application. The method can be executed by a testing device for an application in an embodiment of the present invention. The device can be implemented by software and / or hardware and integrated in an electronic device. The method specifically includes the following steps:
[0024] S110, obtaining an application to be tested, and deploying an operating system matching the application on a simulator; wherein a test-specific program is pre-implanted in a class loading module of the operating system.
[0025] The application to be tested includes a complete application (Application, App) and a software development kit demo (SDK demo) packaged as an application; wherein a complete application refers to a computer program developed to run on an operating system in order to complete one or several specific tasks; SDK is a collection of related documents, examples and tools to assist in the development of application programs. The test object in the embodiment of the present invention includes not only a single complete application but also an SDK demo, that is, the test method has universal applicability. An operating system is an interface program module between a computer user and computer hardware, used to manage and control computer hardware and software resources. Among them, a mobile terminal operating system can provide a unified interface and a friendly interactive interface for users to use mobile terminals, including open source operating systems (e.g., Android systems) and closed open source operating systems (e.g., iOS systems). There are large differences between application programs developed for different operating systems, and it is impossible to achieve universal use of different operating systems. Therefore, after obtaining the application to be tested, it is necessary to obtain its corresponding applicable operating system.
[0026] The test-specific program is a pre-written special test program based on C language, which only performs special test operations, can avoid unnecessary redundant operations, and improve test efficiency. The C language is easy to compile and has high operating efficiency, which can further improve test efficiency. In the embodiment of the present invention, the pre-written test professional program is implanted in the class loading module in the operating system. When the application is running in the matching operating system, the class loading module of the operating system loads the class related to the current task in the application. The test-specific program can record the time information and name information of each class loaded by the class loading module and store it locally. Among them, a class is a function containing a data description and a set of operation data or message transmission, which is the basic component of the application. The class instance is called an object. A simulator refers to a program that can simulate the functions and instruction systems of a hardware processor to enable a computer or other multimedia platform (for example, a tablet computer, a mobile phone) to run on other platforms. The embodiment of the present invention can test various applications matching different operating systems by deploying the operating system implanted with the test-specific program to the simulator.
[0027] Optionally, in an embodiment of the present invention, the test-specific program includes a Java calling interface and / or an Object-C calling interface. Java is an object-oriented programming language, which is widely used in the development of mobile applications for the Android system and has the advantages of being powerful and easy to use; Objective-C is a programming language that is expanded by adding object-oriented features to the C language, and is the main programming language for writing iOS applications, with the advantages of flexible execution and high execution efficiency; by setting the Java calling interface and the Object-C calling interface in the test-specific program, the current mainstream mobile terminal operating system class loading module can be used to call the test-specific program, and the monitoring application can be used to call the test-specific program to obtain the test result data generated by the test-specific program.
[0028] Optionally, in an embodiment of the present invention, before deploying the operating system matching the application on the simulator, it also includes: obtaining the operating system matching the application, and determining whether the operating system is an open source operating system; if the operating system is not an open source operating system, implanting the test-specific program into the class loading module of the operating system through the hook technology. The open source operating system refers to the operating system software with open source code, and the user can follow the open source agreement (GNU is Not The operating system is used, compiled and republished by the user, such as the Android operating system, and the non-open source operating system refers to an operating system whose source code is not disclosed and corresponds to the open source operating system. The user cannot recompile and republish the operating system, such as the iOS system of Apple. In the embodiment of the present invention, if it is determined that the operating system matched by the application to be tested is an open source operating system, the source code corresponding to the operating system is obtained, and the class loading module of the operating system can directly add the test-specific program to the operating system through the Java call interface, thereby realizing the acquisition of class loading data. If it is determined that the operating system matched by the application to be tested is a non-open source operating system, the source code of the operating system cannot be obtained at this time, and the hook (HOOK) technology is used to add the test-specific program to the class loading module of the operating system, wherein the HOOK technology is a special message processing mechanism, which can monitor various event messages in the operating system or process, intercept and process messages sent to the target window; by adopting the HOOK technology, it is possible to add the test-specific program to the class loading module of the operating system when the source code of the operating system cannot be obtained, so as to realize the monitoring of the class loading module, and then obtain the data of the class loaded by the class loading module.
[0029] Optionally, in an embodiment of the present invention, the operating system matching the application is deployed on the simulator, specifically including: if the operating system is an open source operating system, the operating system in which the test-specific program has been implanted is burned into the simulator. Burning refers to installing the read-only memory containing the operating system into the simulator; specifically, when the operating system is an open source operating system, the source code corresponding to the operating system can be directly obtained, and the test-specific program can be added to the corresponding class loading module to form a changed operating system; since the application testing requires a test carrier, such as a simulator or a mobile phone, the changed operating system source code is recompiled into a read-only memory, and the compiled read-only memory is burned into a matching simulator; by configuring the simulator with the changed operating system source code, the application suitable for the open source system can be tested and the class loading data of the application can be obtained.
[0030] Optionally, in an embodiment of the present invention, the operating system matching the application is deployed on the simulator, specifically including: if the operating system is a non-open source operating system, the operating system in which the test-specific program has been implanted is recompiled so that the recompiled operating system supports sandbox operation. Sandbox is a virtual system program, in which a browser or other applications that need to be tested can be run; by running the application to be tested in the sandbox, the operating system changes generated by the application running can be deleted at any time to avoid the test application from having a permanent impact on the system hardware. Specifically, since the operating system is non-open source, the corresponding source code cannot be obtained, and the specific running status of the application cannot be obtained, which brings certain risks; therefore, after adding the test-specific program to the matching operating system using HOOK technology, the operating system is recompiled into an operating system program that supports sandbox operation, which can improve the security of application testing and achieve the acquisition of class loading data of the application to be tested.
[0031] S120, running the application program through the simulator and the operating system, and obtaining class loading data of the application program through the test-specific program.
[0032] Specifically, after obtaining a simulator configured with an operating system that matches the application to be tested, the current simulator is used to run the application. At this time, the test-specific program will record all class data loaded by the class loading module of the operating system, and add the recorded class loading data to the test-specific database; the class loading data includes the loading time and class name of each application class loaded by the class loading module. If the operating system corresponding to the application is an open source operating system, the application to be tested can be run directly through the simulator and the matching operating system; if the operating system corresponding to the application is a non-open source operating system, the application needs to be packaged as an application that can be run in a sandbox environment, and the packaged application needs to be run in the simulator to obtain the class loading data.
[0033] Optionally, in an embodiment of the present invention, obtaining the class loading data of the application through the test-specific program includes: sending the class loading data of the application to a test-specific database through the test-specific program, and obtaining the class loading data of the application through the test-specific database. Specifically, the class loading data of the class loading module recorded by the test-specific program can be added to the test-specific database using the calling interface of the test-specific program, wherein the test-specific database can store the time and name of the corresponding class loading in the form of a table. The class loading data in the test-specific database can be displayed in real time on the front-end interface by calling the program, so that the tester can obtain the test status of the application in real time, and at the same time, the class loading data can be checked for duplicates, and the repeatedly loaded classes can be screened to obtain non-duplicate class loading data.
[0034] Optionally, in an embodiment of the present invention, after obtaining the class loading data of the application, it also includes: parsing the application to obtain a class name set, and determining the class test coverage of the application based on the class loading data of the application. The class name set contains the names of all classes declared in the application to be tested; the class test coverage refers to the ratio of the number of non-repetitive class loading data of the application to the number of classes in the class name set. For example, if the class loading data of the application is 180 and the number of classes contained in the class name set is 200, the current class test coverage is 90%; specifically, after obtaining the application to be tested, the application is statically parsed to obtain the names of all classes defined in the application file, and the names of all classes are added to the class name set; by comparing and searching the obtained non-repetitive class loading data with the names of the classes contained in the class name set, and obtaining the class test coverage through the ratio, and displaying the obtained class test coverage in real time. Optionally, after obtaining the current test coverage, continue to test the preset tasks of the application to obtain the highest possible test coverage. When it is found that the test coverage is stable and no longer changes after a preset time (for example, 10 minutes) or a preset number of tasks (for example, 10 tasks, which may include multiple test tasks such as login, password modification, viewing, searching, downloading and uploading), the test is terminated.
[0035] The technical solution disclosed in the embodiment of the present invention, after obtaining the application to be tested, pre-implanted a test-specific program in the class loading module of the operating system that matches the application, and deployed the operating system that matches the application on the simulator, and simultaneously ran the application to be tested through the current simulator and the operating system, and according to the pre-implanted test-specific program, achieved the acquisition of the class loading data of the application to be tested, and at the same time, by parsing the application to obtain a class name set, and according to the class loading data and the class name set, achieved the accurate acquisition of the class test coverage of the application, thereby achieving the accurate evaluation of the test results of the application to be tested.
[0036] Specific application scenario 1
[0037] Figure 2A This is a flow chart of a method for testing an application program provided in a specific application scenario 1 of the present invention. In this application scenario, the class loading data and class test coverage of the application program to be tested are obtained through an open source Android operating system and a dedicated test program. Specifically, the system includes:
[0038] S210, obtaining a dedicated test program written in C language, wherein the dedicated test program uses JNI (Java Native Interface) technology to provide a Java calling interface, and the dedicated test program is connected to the dedicated test database through the Java calling interface.
[0039] S220. Obtain the source code of the Android system, and add the test-specific program to the findClass method of the DexPathList class of the class loading module.
[0040] S230, compiling the source code of the Android system after adding the test-specific program into a read-only memory (ROM), and burning the ROM into a Google native mobile phone pixel.
[0041] S240, obtaining the App to be tested, and using the APKTool tool to decompile the App to be tested into smali source code, and adding the class declared in the smali source code to the total class table.
[0042] S250, installing the App to be tested on the Google native phone pixel phone.
[0043] S260. Run the App through the Google native pixel phone to execute various services of the App, record the class names loaded by the class loading module of the Android system through the test-specific program, store the loaded class names in the test-specific database, and monitor the test-specific database in real time through a dedicated monitoring program to obtain the loaded class names.
[0044] S270, by marking the loaded class names in the total class table, real-time statistics are obtained on the percentage of marked classes in all classes in the total class table to obtain class test coverage, and output it through a display device.
[0045] S280: Observe the class test coverage in real time, and terminate the test when it is determined that the class test coverage remains unchanged after a preset time or a preset number of tasks.
[0046] The technical solution disclosed in the embodiment of the present invention, after obtaining the App to be tested, obtains the total class table corresponding to the App to be tested, implants a test-specific program in the class loading module of the Android operating system, and deploys the modified operating system on a pixel phone, and runs the App to be tested through the pixel phone and the operating system at the same time, and obtains the class loading data of the App to be tested through the pre-implanted test-specific program, obtains the class test coverage based on the total class table and the class loading data, thereby realizing accurate evaluation of the test results of the application to be tested.
[0047] Embodiment 2
[0048] Figure 2B It is a structural block diagram of an application testing device provided by the second embodiment of the present invention, and the device specifically comprises: an application acquisition module 201 and a class loading data acquisition module 202;
[0049] The application acquisition module 201 is used to acquire the application to be tested and deploy the operating system matching the application to the simulator; wherein the class loading module of the operating system is pre-implanted with a test-specific program;
[0050] The class loading data acquisition module 202 is used to run the application program through the simulator and the operating system, and to acquire the class loading data of the application program through the test-specific program.
[0051] The technical solution disclosed in the embodiment of the present invention, after obtaining the application to be tested, pre-implanted a test-specific program in the class loading module of the operating system that matches the application, and deployed the operating system that matches the application on the simulator, and simultaneously ran the application to be tested through the current simulator and the operating system, and according to the pre-implanted test-specific program, achieved the acquisition of the class loading data of the application to be tested, and at the same time, by parsing the application to obtain a class name set, and according to the class loading data and the class name set, achieved the accurate acquisition of the class test coverage of the application, thereby achieving the accurate evaluation of the test results of the application to be tested.
[0052] Optionally, based on the above technical solution, the application program testing device further includes:
[0053] The class test coverage acquisition module is used to parse the application to obtain a set of class names, and determine the class test coverage of the application based on the class loading data of the application.
[0054] Optionally, based on the above technical solution, the test-specific program includes a Java calling interface and / or an Object-C calling interface.
[0055] Optionally, based on the above technical solution, the application program testing device further includes:
[0056] A system type determination module, used to obtain an operating system that matches the application program and determine whether the operating system is an open source operating system;
[0057] The test-specific program implantation module is used to implant the test-specific program into the class loading module of the operating system through hook technology if the operating system is a non-open source operating system.
[0058] Optionally, based on the above technical solution, the application acquisition module 201 is specifically used to burn the operating system in which the test-specific program has been implanted into the simulator if the operating system is an open source operating system.
[0059] Optionally, based on the above technical solution, the application acquisition module 201 is specifically used to recompile the operating system in which the test-specific program has been implanted if the operating system is a non-open source operating system, so that the recompiled operating system supports sandbox operation.
[0060] Optionally, based on the above technical solution, the class loading data acquisition module 202 is specifically used to send the class loading data of the application to the test-specific database through the test-specific program, and obtain the class loading data of the application through the test-specific database.
[0061] The above device can execute the application test method provided by any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by any embodiment of the present invention.
[0062] Embodiment 3
[0063] Figure 3 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Figure 3 A block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 3 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0064] like Figure 3 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 that connects various system components (including the memory 28 and the processing unit 16).
[0065] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0066] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0067] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 3 not shown, usually called a "hard drive"). Although Figure 3Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0068] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0069] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0070] The processing unit 16 executes various functional applications and data processing by running the program stored in the memory 28, for example, implementing the test method of the application provided by any embodiment of the present invention. That is, the application to be tested is obtained, and an operating system matching the application is deployed in a simulator; wherein a test-specific program is pre-implanted in the class loading module of the operating system; the application is run through the simulator and the operating system, and the class loading data of the application is obtained through the test-specific program.
[0071] Embodiment 4
[0072] Embodiment 4 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for testing an application program as described in any embodiment of the present invention is implemented; the method includes:
[0073] Obtain an application to be tested, and deploy an operating system matching the application on a simulator; wherein a test-specific program is pre-implanted in a class loading module of the operating system;
[0074] The application is run through the simulator and the operating system, and the class loading data of the application is obtained through the test-specific program.
[0075] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0076] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0077] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0078] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0079] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for testing an application, characterized in that: include: Obtain an application to be tested, and deploy an operating system matching the application on a simulator; wherein a test-specific program is pre-implanted in a class loading module of the operating system; Run the application program through the simulator and the operating system, and obtain class loading data of the application program through the test-specific program; The obtaining of the class loading data of the application program through the test-specific program includes: sending the class loading data of the application program to a test-specific database through the test-specific program, and obtaining the class loading data of the application program through the test-specific database; the test-specific program is used to record the time information and name information of all classes loaded by the class loading module; Before deploying the operating system matching the application program on the simulator, the method further includes: Obtaining an operating system that matches the application program, and determining whether the operating system is an open source operating system; If the operating system is a non-open source operating system, the test-specific program is implanted into the class loading module of the operating system through the hook technology; the hook technology is also used to monitor various event messages in the operating system.
2. The method according to claim 1, characterized in that: After obtaining the class loading data of the application, it also includes: The application is parsed to obtain a set of class names, and class test coverage of the application is determined based on class loading data of the application.
3. The method according to claim 1, characterized in that The test-specific program includes a Java calling interface and / or an Object-C calling interface.
4. The method according to claim 1, characterized in that: The step of deploying the operating system matching the application program on the simulator specifically includes: If the operating system is an open source operating system, the operating system in which the test-specific program has been implanted is burned into the simulator.
5. The method according to claim 1, characterized in that The step of deploying the operating system matching the application program on the simulator specifically includes: If the operating system is a non-open source operating system, the operating system in which the test-specific program has been implanted is recompiled so that the recompiled operating system supports sandbox operation.
6. A testing device for an application, characterized in that: include: An application acquisition module is used to acquire an application to be tested and deploy an operating system matching the application on the simulator; wherein a test-specific program is pre-implanted in a class loading module of the operating system; A class loading data acquisition module, used to run the application program through the simulator and the operating system, and to acquire the class loading data of the application program through the test-specific program; The class loading data acquisition module is specifically used to send the class loading data of the application to the test-specific database through the test-specific program, and obtain the class loading data of the application through the test-specific database; the test-specific program is used to record the time information and name information of all classes loaded by the class loading module; A system type determination module, used to obtain an operating system that matches the application program and determine whether the operating system is an open source operating system; The test-specific program implantation module is used to implant the test-specific program into the class loading module of the operating system through hook technology if the operating system is a non-open source operating system; the hook technology is also used to monitor various event messages in the operating system.
7. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the test method for the application program according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the program implements the test method of the application program according to any one of claims 1 to 5.
