CN109408356B - Code coverage rate acquisition method for manual testing of target application - Google Patents

Code coverage rate acquisition method for manual testing of target application Download PDF

Info

Publication number
CN109408356B
CN109408356B CN201710705612.4A CN201710705612A CN109408356B CN 109408356 B CN109408356 B CN 109408356B CN 201710705612 A CN201710705612 A CN 201710705612A CN 109408356 B CN109408356 B CN 109408356B
Authority
CN
China
Prior art keywords
target application
software development
code coverage
development kit
coverage rate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710705612.4A
Other languages
Chinese (zh)
Other versions
CN109408356A (en
Inventor
杨瑾
刘泽文
杨文亮
祝中良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN201710705612.4A priority Critical patent/CN109408356B/en
Publication of CN109408356A publication Critical patent/CN109408356A/en
Application granted granted Critical
Publication of CN109408356B publication Critical patent/CN109408356B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a code coverage rate acquisition method for manually testing a target application. The method constructs a software development kit, associates the software development kit with the target application; the software development kit is run to automatically test the code coverage of the target application and send a coverage file to the server until the transfer is successful.

Description

Code coverage rate acquisition method for manual testing of target application
Technical Field
The invention relates to the field of computers, in particular to a code coverage rate acquisition method for target application manual testing.
Background
As the popularity and range of applications of electronic computers has increased, so has the demand and usage of computer programs.
Code coverage is an indicator of the coverage of product code by a test activity during the writing and testing of a computer program. The purpose of the code coverage test is to confirm whether the product code is working as expected. Through the statistics of the code coverage rate, a developer can know how much code of the program is executed and test coverage of the code is not enough, so that problems possibly occurring in the program can be found.
At present, a plurality of internet and communication companies research a code coverage rate test method. However, the research of the existing code coverage test methods has mainly focused on the improvement of the test program itself, for example, in patent application 200710032674.X, a method for determining code coverage is disclosed, which first determines the total code amount of the tested program, the base address of the tested program, and the relative virtual address of each code line, then sets the terminal according to these information, and monitors the occurrence of the terminal during the test. In this way, a test of code coverage is performed.
However, improving the accuracy of the code coverage test is only one aspect, and what is needed is to improve the work efficiency of the code coverage test. Currently, the test code coverage is mostly applied to the unit test stage to evaluate the test quality of the unit test. In mobile application testing, test code coverage is rarely applied in the manual testing phase.
Because the application program to be tested is run on the testing equipment, the generated file of the manual test coverage rate is generally saved on the memory card, and a plurality of testers generally execute test cases on a plurality of pieces of equipment in each test. Copying and saving the coverage files on multiple devices becomes a time consuming and laborious task. And the state of the test coverage rate cannot be flexibly reset on the premise of not modifying the application, and the coverage rate of a certain function on the code cannot be accurately recorded.
Disclosure of Invention
The invention aims to provide a collection method capable of automatically realizing the storage of test coverage, the automatic transmission of a test coverage file and the failure retransmission in the test process aiming at the problems encountered when a target application is tested, in particular to the problems encountered when the application in an Android system is tested. The working mode of manually copying and storing the coverage rate execution files from a plurality of devices is changed, and the working efficiency is improved.
Specifically, an embodiment of the present invention provides a code coverage acquisition method for a target application manual test, where the method includes:
loading a pre-constructed software development kit in a system where the target application is located;
associating the software development kit with the target application;
running the software development kit to automatically perform the steps of:
calling a code coverage rate testing tool to perform code coverage rate testing on the target application, and generating and storing a code coverage rate file;
starting a transmission program, and transmitting the generated code coverage rate file of the target application to a server;
judging whether the code coverage rate file is successfully transmitted or not, and if the code coverage rate file is successfully transmitted, deleting the generated code coverage rate file; otherwise, monitoring the network state and repeating the transmitting operation until the code coverage rate file is transmitted to the server successfully.
Preferably, the method further comprises the following steps: resetting the code coverage tested by the code coverage testing tool.
Preferably, the step of monitoring the network status and repeatedly performing the transmission operation until the code coverage file is successfully transmitted to the server comprises: and registering broadcast messages of network changes and program starting, and after receiving the broadcast messages, transmitting the code coverage rate file cached in the local to the server again.
Preferably, the software development kit is integrated with a code coverage test tool and further includes local memory.
Preferably, the software development kit comprises a reset interface for interacting with a user, and the reset interface is used for executing the reset of the code coverage rate state.
Preferably, the step of associating the software development kit with the target application comprises: and adding an integration code to the target Application, wherein the integration code is used for outputting an Application object of the target Application to the software development toolkit.
Preferably, the step of transmitting the generated code coverage file of the target application to a server further comprises: the code coverage file is transmitted to the server along with the relevant state information of the target application.
Preferably, the step of loading a pre-constructed software development kit in the system where the target application is located includes: installing and starting a pre-constructed software development kit in a system where the target application is located; or directly starting a pre-constructed software development kit installed in a third-party storage device coupled with the system where the target application is located in the system where the target application is located.
In addition, the software development kit can be associated with the target application in the process of loading a pre-constructed software development kit in the system where the target application is located.
The embodiment of the present invention further provides a storage device storing a software development kit, wherein when the storage device is coupled to a system where a target application is located and the software development kit is loaded in the system, the software development kit is associated with the target application, and the software development kit is run to perform the following steps:
calling a code coverage rate testing tool to perform code coverage rate testing on the target application, and generating and storing a code coverage rate file;
starting a transmission program, and transmitting the generated code coverage rate file of the target application to a server;
judging whether the code coverage rate file is successfully transmitted or not, and if the code coverage rate file is successfully transmitted, deleting the generated code coverage rate file; otherwise, monitoring the network state and repeating the transmitting operation until the code coverage rate file is transmitted to the server successfully.
Preferably, when the software development kit is run, the following steps are further executed: resetting the code coverage tested by the code coverage testing tool.
Preferably, the code coverage testing tool is Jacoco Agent.
Preferably, the step of performing the monitoring of the network status and repeating the transmitting operation until the code coverage file is successfully transmitted to the server comprises: and registering broadcast messages of network changes and program starting, and after receiving the broadcast messages, transmitting the code coverage rate file cached in the local to the server again.
Preferably, the software development kit is integrated with a code coverage test tool.
Preferably, the software development kit comprises a reset interface for interacting with a user, and the reset interface is used for executing the reset of the code coverage rate state.
Preferably, the step of associating the software development kit with the target application comprises: and adding integration codes to the target Application, wherein the integration codes are used for outputting the Application object of the target Application to the software development kit.
Preferably, the step of transmitting the generated code coverage file of the target application to a server further comprises: the code coverage file is transmitted to the server along with the relevant state information of the target application.
Preferably, the step of coupling the storage device with a system in which the target application is located and loading the software development kit in the system comprises: installing and starting the software development kit in a system where the target application is located; or directly starting the software development kit in the system where the target application is located.
Preferably, the software development kit is associated with the target application during loading of the software development kit in the system in which the target application is located.
It should be noted that the term "register" in the present invention refers to registering or registering a recipient of an event in an Android or other operating system, where the event may include a network change, a program start, and the like.
Technical effects
In the existing Android application test mode, the generated coverage rate file is stored in a memory card (for example, an SD card) of the smart terminal, and then the smart terminal needs to be connected, exported, and summarized, and then a report is generated. Using the method of the present invention, after constructing the software development tool SDK, associating the software development tool package with the target application; the software development kit is run to automatically test the code coverage of the target application and send a coverage file to the server until the transfer is successful, completing the totalization of the coverage file. The scheme provided by the invention changes the working mode of manually copying and storing the coverage rate execution file from a plurality of devices, and can also provide a reset function on the running page, so that a tester can reset the coverage rate state at any time, the coverage condition of the code at the required test stage can be accurately recorded, and the working efficiency is greatly improved.
Drawings
FIG. 1 is a schematic flow chart diagram of a code coverage acquisition method of the present invention;
fig. 2 is an exemplary screenshot of a coverage test performed using the coverage acquisition method of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention and the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components or steps of an embodiment of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings and the specific embodiments of the present invention.
In this embodiment, the description of the code coverage acquisition method related to the present invention is described by taking an Android system as an example, and at this time, the target application is an application program running under the Android system. Fig. 1 is a schematic flow chart of a code coverage acquisition method of a first embodiment of the present invention. As shown in fig. 1, in the present embodiment, the code coverage rate collecting method for the target application manual test includes the following steps:
s1: and loading a pre-constructed software development kit in a system where the target application is located.
In order to collect the code coverage rate of the target application, a pre-constructed software development kit needs to be loaded in a system where the target application is located. The loading mode comprises the following steps: installing and starting the pre-constructed software development kit in the system where the target application is located; or, directly starting a pre-built software development kit installed in a third-party storage device coupled to the system where the target application is located in the system where the target application is located, for example, coupling a removable storage device (e.g., an optical disc, a U-disc, an SD card, a TF card, etc.) loaded with the pre-built software development kit with a smart terminal (e.g., a smart mobile terminal of an android system, etc.) installed with the target application, so that the pre-built software development kit can be directly started in the system where the target application is located; or directly starting a software development kit of a pre-constructed network version on a shared server or a shared space under the internet or the local area network to load the pre-constructed software development kit in a system where the target application is located in the internet or the local area network. The coupling described herein may include, but is not limited to: the method comprises the steps of placing an optical disk loaded with a pre-constructed software development kit in an optical drive driver of the intelligent terminal, inserting a U disk or an SD card or a TF card or the like loaded with the pre-constructed software development kit into a corresponding interface of the intelligent terminal provided with the target application, and communicating a shared server or a shared space storing the pre-constructed network version software development kit with the intelligent terminal provided with the target application through the Internet or a local area network.
Preferably, a software development kit (Android SDK) of an Android system is constructed in advance, and the software development kit of the Android system has the following functions: calling a code coverage rate testing tool and generating and storing a code coverage rate testing file; starting an Android Service to automatically transmit the generated code test coverage rate file or the generated code test coverage rate file and related parameters of the target application to a remote or back-end server; then judging whether the transmission is successful, if so, deleting the generated code coverage rate file stored locally; otherwise, the generated code coverage file is cached and retransmitted, which avoids the occurrence of missing code test coverage files when the network is unavailable or unstable.
In addition, the software development kit has an interface for interacting with a user, such as a floating button providing a reset function, and the like, and the user can reset the code coverage tested by the code coverage testing tool through the interactive interface (reset button) at any time. The floating button may be referred to as a virtual floating button or a physical button. In this embodiment, a virtual floating button is employed.
S2: the constructed software development kit is associated with the target application.
The associated meanings mentioned here mean: the software development kit, e.g. the Android system, loaded into the system where the target application is located is made to interact with the target application in any way, both data and programmatically.
In a preferred mode, the step of associating the built software development kit, such as the Android system, with the target application comprises the following steps: and adding integration codes to the target Application, wherein the integration codes are used for outputting the Application object of the target Application to the software development kit. Adding the integration code in the target application can be realized in a manual mode, for example, a tester manually adds the integration code in the target application; of course, the method can also be implemented in an automatic manner, that is, the software development kit is associated with the target application in the process of loading the pre-constructed software development kit in the system where the target application is located. For example, in the process of installing and starting the pre-constructed software development kit in the system where the target application is located, or in the process of directly starting and loading the pre-constructed software development kit in the system where the target application is located, the required integrated code is automatically added to the target application by the software development kit. Taking an Android system as an example, the target Application transmits an Android Application instance to a software development kit SDK, and the software development kit SDK can acquire relevant states of the target Application through the object, such as registering a lifecycle callback function.
S3: running the software development kit to automatically perform the steps of:
s3-1) calling a code coverage testing tool to carry out code coverage testing on the target application, and generating and saving a code coverage file. Specifically, since the association between the software development kit of the Android system and the target application is established, for example, the software development kit of the Android system may start the target application, and may also invoke a code coverage testing tool, which may be a Jacoco Agent, to perform a code coverage test on the target application.
And the Android system software development kit outputs the measured current code coverage rate of the target application to a target file and performs local storage, wherein the local storage can be stored in an physically independent local storage or a drawn virtual storage space.
The code coverage testing tool may be integrated into or otherwise in communication with and capable of being invoked by a software development kit.
S3-2) starting a transmission program, and transmitting the generated code coverage rate file of the target application to a server;
s3-3) judging whether the code coverage rate file is successfully transmitted, if so, deleting the generated code coverage rate file; otherwise, monitoring the network state and repeating the transmitting operation until the code coverage rate file is transmitted to the server successfully.
The steps of monitoring a network status and repeatedly performing a transfer operation until the code coverage file is successfully transferred to the server include: and registering broadcast messages of network changes and program starting, and after receiving the broadcast messages, transmitting the code coverage rate file cached in the local to the server again.
Preferably, if the network communication fails, the software development kit for example of the Android system constructed in the present invention may cache a plurality of code coverage files generated by a plurality of tests during the network failure, and send all the cached coverage files to the server once the network recovery is monitored, and preferably, send all the cached coverage files to the server together with the corresponding state information of the target application. In this preferred embodiment, the software development kit is integrated with the code coverage testing tool.
In addition, the software development kit may further include a local memory, i.e., a memory card, such as an SD card, a TF card, etc., and may also be a usb disk.
The above-described two steps S3-2 and S3-3 are actually a loop of repeated judgment processes.
The server can be a local server or a remote server, and the server communicates with the device where the application to be tested is located through a wired or wireless communication mode, so that the code coverage rate file can be transmitted.
In fact, more preferably, in addition to transmitting the code coverage file, the transmission of the relevant state file of the target application may also be performed, that is, the step S3-2 further includes: the code coverage file is transmitted to the server along with the relevant state information of the target application. The relevant state information of the target application comprises: version information of the program: such as version identification in a code versioning system, ID of the current application installation package, and these version information are used to associate code coverage information with a particular version of source code.
In addition, the code coverage rate acquisition method of the embodiment further includes: resetting the code coverage tested by the code coverage testing tool. The resetting of the code coverage status is not necessary for a single test, but is necessary for the case where multiple tests are required for the same or different applications, by which the accuracy of subsequent coverage tests is guaranteed.
The resetting of code coverage may be performed manually by a user, and may be performed automatically by a software development kit.
The resetting step performed automatically may be performed at multiple time points, for example, the resetting step may be set when the software development kit is started, or the resetting step may be set after the software development kit calls the code coverage testing tool to perform the code coverage test and outputs the code coverage file.
The manual reset mode is to make the reset operation more free, and an interface interacting with the user may be added to a software development kit of, for example, an Android system, for example, the software development kit generates a floating button for resetting on the target application, so that the user can reset the code coverage status of the test only by clicking the floating button, that is, the reset of the code coverage status is performed through the reset interface, and is not required to modify the target application.
In the conventional method for realizing reset, the application needs to be modified, and the code for realizing reset is inserted in some life cycles of the application; such as when the program exits, a reset is implemented. In this way, the code for resetting the coverage rate is introduced into the original business logic of the program, so that the program is not convenient to carry, and the risk of damaging the production code is also introduced.
Preferably, the software development kit of the present invention is a "pluggable" software development kit, where reference to "pluggable" refers to: the built software development kit is added without modifying the service logic of the program, so that the integration is convenient, and the integration or the removal can be convenient. When the code coverage rate test of the target application is needed, combining the constructed software development kit such as an Android system with the target application on the target device, running the software development kit to call a coverage rate test tool for testing and automatically transmitting the generated code coverage rate file to the server.
Although in the above-described first embodiment and the corresponding preferred embodiment, the loading of the pre-constructed software development kit in the system in which the target application is located and the association of the software development kit with the target application are respectively described as being divided into two steps S1 and S2; however, an example is also described above in which the software development kit can be associated with the target application in the process of loading the pre-constructed software development kit in the system in which the target application is located, and thus, those skilled in the art will know that: the loading of the pre-constructed software development kit in the system where the target application is located and the association of the software development kit with the target application, which are described separately in two steps S1 and S2, can be implemented as one step, that is, in the second embodiment: the code coverage rate acquisition method for the target application manual test comprises the following steps:
loading a pre-constructed software development kit in a system where a target application is located and associating the software development kit with the target application in a loading process;
running the software development kit to automatically perform the steps of:
calling a code coverage rate testing tool to perform code coverage rate testing on the target application, and generating and storing a code coverage rate file;
starting a transmission program, and transmitting the generated code coverage rate file of the target application to a server;
judging whether the code coverage rate file is successfully transmitted or not, and if the code coverage rate file is successfully transmitted, deleting the generated code coverage rate file; otherwise, monitoring the network state and repeating the transmitting operation until the code coverage rate file is transmitted to the server successfully.
At this time, the contents of the first embodiment and the preferred embodiment described above with reference to fig. 1 can be applied to the second embodiment without conflict, which will be obvious to those skilled in the art and will not be described repeatedly herein.
According to the code coverage rate acquisition method for the target application manual test, a pre-constructed software development kit is associated with the target application; the software development kit is run to automatically test the code coverage of the target application and automatically send a coverage file to the server until the transfer is successful, completing the totalization of the coverage files. The scheme provided by the invention changes the working mode of manually copying and storing the coverage rate execution file from a plurality of devices, and can also provide a reset function on the running page, so that a tester can reset the coverage rate state at any time, the coverage condition of the code at the required test stage can be accurately recorded, and the working efficiency is greatly improved.
Fig. 2 is an exemplary screenshot of a coverage test performed using the coverage acquisition method of the present invention. The floating button of the insect graph in the upper right corner of fig. 2 is a code coverage generation entry provided by a software development kit of the Android system after the software development kit is loaded.
The example shown in fig. 2 is a code coverage acquisition test performed on a reading-like App-Android version flag reading App.
In order to collect the code coverage rate of the reading class App, a pre-constructed Android system software development kit, in particular a pluggable Android system software development kit, is loaded in a system where the reading class App is located. The software development kit of the Android system is integrated with a code coverage test tool of, for example, Jacoco Agent. In order to combine the software development kit of the Android system with the reading type App, only the Application type needs to be realized in the reading type App, and the following line of codes is added in the realized onCreate method of the Application type:
new ReportBug.Builder(this,"xxxx").build()
where "xxxx" is an identification code assigned to the target application.
In a preferred example, after the above steps are performed, a floating reset button is arranged on the display page of the reading class App for resetting the code coverage status.
Then, clicking a floating button of the insect graph displayed on the page to run the software development kit, and automatically executing the following series of actions:
firstly, the software development toolkit calls a code coverage rate testing tool Jacoco Agent to perform code coverage rate testing on reading class App-Android version flag reading by using an onCreate function of an Application object, and the coverage rate information of a testing step on a code is recorded in the testing process. A code coverage file is generated that contains coverage information for the program source code for the test execution step, such as whether certain instructions, lines, or branches of a certain method are covered for a certain class. For the example in fig. 2, the measured code coverage is the coverage of the source code read by the Android version flag in the step related to the operation of the book reading page by the tester, and the measured coverage automatically generates a code test coverage file and stores the code test coverage file on the memory card.
The reset of the coverage status can then be done manually or automatically in a preferred application with a reset function.
And then, starting a code coverage rate file transmission program by the software development kit through Android Service, monitoring a coverage rate transmission state by monitoring received HTTP Response, monitoring the transmission condition of the code coverage rate file in real time, deleting the generated code coverage rate test file by issuing a deletion command if the transmission is successful, or else, monitoring the network state by registering an application network condition monitor and retrying to transmit the code coverage rate file again when the network is recovered until the transmission is successful.
When manual reset is realized, the software development kit generates a floating button on a target application, and a user clicks the floating button to directly execute the reset; of course, the floating button may also correspond to a menu, that is, a menu appears after the user clicks the floating button, and the menu displays, for example: a reset option; send and reset options, etc. The transfer code coverage file is executed when the user selects the send and reset options, while a reset of the coverage status is executed.
The transmitted file may include, in addition to the generated code coverage file: the identifier of the current target application (above "xxxx") and the version information of the target application, which together identify the version of one target application. And the code coverage rate file and the related state file of the target application are directly transmitted to a background server through a post method and are stored by the background server.
In addition, the present invention also provides a storage device storing a software development kit, the storage device being coupled to a system in which a target application is located and the software development kit being associated with the target application when the storage device is coupled to the system and the software development kit is loaded in the system, the software development kit being executed to perform the steps of:
calling a code coverage rate testing tool to perform code coverage rate testing on the target application, and generating and storing a code coverage rate file;
starting a transmission program, and transmitting the generated code coverage rate file of the target application to a server;
judging whether the code coverage rate file is successfully transmitted or not, and if the code coverage rate file is successfully transmitted, deleting the generated code coverage rate file; otherwise, monitoring the network state and repeating the transmitting operation until the code coverage rate file is transmitted to the server successfully.
The implementation steps and procedures described in the first and second embodiments and their alternative embodiments above are also applicable here. Wherein the step of coupling the storage device with a system in which the target application resides and loading the software development kit in the system comprises: installing and starting the software development kit in a system where the target application is located; or directly starting the software development kit in the system where the target application is positioned. The coupling described herein may include, but is not limited to: and placing the optical disc stored with the software development kit in an optical drive driver of the intelligent terminal, inserting the U disc, the SD card, the TF card or the like stored with the software development kit into a corresponding interface of the intelligent terminal provided with the target application, and communicating a shared service terminal or a shared space stored with the software development kit of a pre-constructed network version with the intelligent terminal provided with the target application through the Internet or a local area network.
Associating the software development kit with a target application is: the software development kit loaded into the system in which the target application resides is caused to interact data and program with the target application in any manner. Preferably, the method for associating the software development kit with the target application comprises: and adding an integration code to the target Application, wherein the integration code is used for outputting an Application object of the target Application to the software development toolkit. Adding the integration code in the target application can be realized in a manual mode, for example, a tester manually adds the integration code in the target application; of course, the software development kit may also be automatically associated with the target application in the process of loading the software development kit in the system where the target application is located. For example, in the process of installing and starting the software development kit in the system where the target application is located, or in the process of directly starting and loading the software development kit in the system where the target application is located, the software development kit automatically adds the required integration code to the target application.
Preferably, when the software development kit is run, the following steps can be further executed: resetting the code coverage tested by the code coverage testing tool. The resetting of code coverage may be performed manually by a user, and may be performed automatically by a software development kit. The resetting step performed automatically may be performed at multiple time points, for example, the resetting step may be set when the software development kit is started, or the resetting step may be set after the software development kit calls the code coverage testing tool to perform the code coverage test and outputs the code coverage file. In a preferred embodiment of manual reset, the software development kit includes a reset interface for user interaction, through which reset of the code coverage status is performed. The reset interface is, for example, a floating button that the software development kit generates for resetting on the target application.
Preferably, the code coverage testing tool is Jacoco Agent.
Wherein the step of performing the monitoring of the network status and repeating the transfer operation until the code coverage file is successfully transferred to the server comprises: and registering broadcast messages of network changes and program starting, and after receiving the broadcast messages, transmitting the code coverage rate file cached in the local to the server again.
Preferably, the software development kit is integrated with a code coverage test tool.
Preferably, the step of executing the step of transmitting the generated code coverage file of the target application to a server further comprises: the code coverage file is transmitted to the server along with the relevant state information of the target application. The relevant state information of the target application comprises: version information of the program: such as version identification in a code versioning system, ID of the current application installation package, and these version information are used to associate code coverage information with a particular version of source code.
In addition, the software development kit can be associated with the target application in the process of loading the software development kit in the system where the target application is located.
Parts not described in detail herein may refer to the description of the first and second embodiments and their respective preferred embodiments, and will not be repeated here.
According to the storage device stored with the software development kit, when a tester uses the storage device to manually test the code coverage rate of the target application, the software development kit stored in the storage device is associated with the target application; and running the software development kit to automatically test the code coverage rate of the target application, and automatically sending the coverage rate file to the server until the transmission is successful, and finishing the totalization of the coverage rate file. The storage device with the software development kit stored in the invention changes the working mode of manually copying and storing the coverage rate execution file from a plurality of devices, and can also provide a reset function on the running page, so that a tester can reset the coverage rate state at any time, the coverage condition of a code at a required test stage can be accurately recorded, and the working efficiency is greatly improved.
It should be noted that, although the foregoing embodiment of the present invention describes the code coverage acquisition method according to the present invention by taking an Android system as an example, it should be understood by those skilled in the art that when testing target applications under other operating systems, including but not limited to target applications under ios and windows systems, on the basis of reading and understanding the spirit of the present invention, those skilled in the art can extend the code coverage acquisition method for manually testing target applications according to the present invention to code coverage acquisition for manually testing target applications under other operating systems.
The software development kit described in the present invention can be stored in a computer or intelligent device readable storage medium when it is implemented in the form of software functional units and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention, or a part thereof, which substantially contributes to the prior art, may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing an intelligent mobile device to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (15)

1. A code coverage acquisition method for manual testing of a target application, the method comprising:
loading a pre-constructed software development kit in a system where the target application is located;
associating the software development kit with the target application;
running the software development kit to automatically perform the steps of:
calling a code coverage rate testing tool which is communicated with a software development kit to perform code coverage rate testing on the target application, and generating and storing a code coverage rate file, wherein the code coverage rate file comprises coverage information of a test execution step on a program source code;
starting a transmission program, and transmitting the generated code coverage rate file of the target application to a server;
judging whether the code coverage rate file is successfully transmitted or not, and if the code coverage rate file is successfully transmitted, deleting the generated code coverage rate file; otherwise, monitoring the network state and repeatedly executing the transmission operation until the code coverage rate file is successfully transmitted to the server;
the step of associating the software development kit with the target application comprises:
in the process of installing and starting a pre-constructed software development kit in a system where the target Application is located, or in the process of directly starting and loading the pre-constructed software development kit in the system where the target Application is located, the software development kit automatically adds required integration codes to the target Application to realize that the software development kit is associated with the target Application, and the integration codes are used for outputting an Application object of the target Application to the software development kit.
2. The method of claim 1, further comprising: resetting the code coverage tested by the code coverage testing tool.
3. The method of claim 1, wherein the code coverage testing tool is a Jacoco Agent.
4. The method of claim 1, wherein the steps of monitoring network status and repeatedly performing the transfer operation until the code coverage file is successfully transferred to the server comprise: and registering broadcast messages of network changes and program starting, and after receiving the broadcast messages, transmitting the code coverage rate file cached in the local to the server again.
5. The method of claim 2, wherein the software development kit includes a reset interface for interacting with a user, and wherein resetting the code coverage status is performed via the reset interface.
6. The method of claim 1, wherein the step of transmitting the generated code coverage file of the target application to a server further comprises: transmitting the code coverage file to the server along with associated state information for the target application.
7. The method according to any one of claims 1 to 6, wherein the step of loading a pre-built software development kit in the system in which the target application resides comprises: installing and starting a pre-constructed software development kit in a system where the target application is located; or directly starting a pre-constructed software development kit installed in a third-party storage device coupled with the system where the target application is located in the system where the target application is located.
8. The method according to claim 1, wherein the software development kit is associated with the target application in a process of loading a pre-constructed software development kit in a system in which the target application is located.
9. A storage device storing a software development kit, the software development kit being associated with a target application when the storage device is coupled to a system in which the target application resides and the software development kit is loaded in the system, the software development kit being executed to perform the steps of:
calling a code coverage rate testing tool which is communicated with a software development kit to perform code coverage rate testing on the target application, and generating and storing a code coverage rate file, wherein the code coverage rate file comprises coverage information of a test execution step on a program source code;
starting a transmission program, and transmitting the generated code coverage rate file of the target application to a server;
judging whether the code coverage rate file is successfully transmitted or not, and if the code coverage rate file is successfully transmitted, deleting the generated code coverage rate file; otherwise, monitoring the network state and repeatedly executing the transmission operation until the code coverage rate file is successfully transmitted to the server;
performing the step of associating the software development kit with the target application comprises: in the process of installing and starting a pre-constructed software development kit in a system where the target Application is located, or in the process of directly starting and loading the pre-constructed software development kit in the system where the target Application is located, the software development kit automatically adds required integration codes to the target Application to realize that the software development kit is associated with the target Application, and the integration codes are used for outputting an Application object of the target Application to the software development kit.
10. The storage device of claim 9, further performing: and resetting the code coverage rate tested by the code coverage rate testing tool.
11. The storage device of claim 9, wherein the code coverage testing tool is a Jacoco Agent.
12. The storage device of claim 9, wherein performing the steps of monitoring network status and repeatedly performing transfer operations until the code coverage file is successfully transferred to the server comprises: and registering broadcast messages of network changes and program starting, and after receiving the broadcast messages, transmitting the code coverage rate file cached in the local to the server again.
13. The storage device of claim 10, wherein the software development kit includes a reset interface for interacting with a user, and wherein resetting the code coverage status is performed via the reset interface.
14. The storage device of claim 9, wherein the step of executing the step of transmitting the generated code coverage file of the target application to a server further comprises: the code coverage file is transmitted to the server along with the relevant state information of the target application.
15. The storage device of any of claims 9-14, wherein performing the steps of coupling the storage device to a system in which the target application resides and loading the software development kit in the system comprises: installing and starting the software development kit in a system where the target application is located; or directly starting the software development kit in the system where the target application is located.
CN201710705612.4A 2017-08-17 2017-08-17 Code coverage rate acquisition method for manual testing of target application Active CN109408356B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710705612.4A CN109408356B (en) 2017-08-17 2017-08-17 Code coverage rate acquisition method for manual testing of target application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710705612.4A CN109408356B (en) 2017-08-17 2017-08-17 Code coverage rate acquisition method for manual testing of target application

Publications (2)

Publication Number Publication Date
CN109408356A CN109408356A (en) 2019-03-01
CN109408356B true CN109408356B (en) 2022-09-06

Family

ID=65454810

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710705612.4A Active CN109408356B (en) 2017-08-17 2017-08-17 Code coverage rate acquisition method for manual testing of target application

Country Status (1)

Country Link
CN (1) CN109408356B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104391795A (en) * 2014-12-03 2015-03-04 北京京东尚科信息技术有限公司 Method and system for automatically testing coverage rate in distributed system
CN107018046A (en) * 2017-06-06 2017-08-04 上海鋆创信息技术有限公司 A kind of collecting method, device, terminal and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104391795A (en) * 2014-12-03 2015-03-04 北京京东尚科信息技术有限公司 Method and system for automatically testing coverage rate in distributed system
CN107018046A (en) * 2017-06-06 2017-08-04 上海鋆创信息技术有限公司 A kind of collecting method, device, terminal and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
jacoco统计Android手工测试覆盖率并自动上报服务器;佚名;《https://blog.csdn.net/weixin_30917213/article/details/98195469》;20170725;第1-15页 *
JAVA代码覆盖率工具JaCoCo-实践篇;佚名;《https://www.itdaan.com/blog/2016/11/15/b379599308c8ae373caea848a223d583.html》;20160829;第1-6页 *

Also Published As

Publication number Publication date
CN109408356A (en) 2019-03-01

Similar Documents

Publication Publication Date Title
CN109302522B (en) Test method, test device, computer system, and computer medium
CN103377127B (en) The development and testing system of web page product, method of testing and device
CN106294102B (en) Application program testing method, client, server and system
CN112241360B (en) Test case generation method, device, equipment and storage medium
CN109165170B (en) Method and system for automatic request test
CN107391362A (en) Application testing method, mobile terminal and storage medium
CN111258913A (en) Automatic algorithm testing method and device, computer system and readable storage medium
CN105022694A (en) Test case generation method and system for mobile terminal test
CN112148606B (en) Buried point test method, buried point test device, buried point test equipment and computer readable medium
CN113434464A (en) Distributed log processing system and method
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN112187933A (en) Method and system for monitoring services in multi-architecture cloud platform
CN111651232A (en) One-machine multi-control method, device and system and electronic equipment
CN111324480A (en) Large host transaction fault positioning system and method
CN111061448A (en) Log information display method and device, electronic equipment and storage medium
CN112822073B (en) Test method, device, system, electronic equipment and readable storage medium
CN110908708B (en) Code release method, device and system
CN109408356B (en) Code coverage rate acquisition method for manual testing of target application
KR20140055282A (en) Web appalication error analisis system, apparatus and method for user terminal
CN112596750B (en) Application testing method and device, electronic equipment and computer readable storage medium
CN114218072A (en) Test script generation method and device, storage medium and computer equipment
CN110795330A (en) Monkey pressure testing method and device
CN115437903A (en) Interface test method, device, apparatus, storage medium, and program
CN112558982A (en) Code detection method and device and computer equipment
CN110990246A (en) Tracking processing method and device for large-scale cluster deployment delivery log

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200422

Address after: 310052 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Alibaba (China) Co.,Ltd.

Address before: 510627 Guangdong city of Guangzhou province Whampoa Tianhe District Road No. 163 Xiping Yun Lu Yun Ping radio square B tower 13 floor 03 unit self

Applicant before: GUANGZHOU ALIBABA LITERATURE INFORMATION TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
CB02 Change of applicant information

Address after: Room 554, 5 / F, building 3, 969 Wenyi West Road, Wuchang Street, Yuhang District, Hangzhou City, Zhejiang Province

Applicant after: Alibaba (China) Co.,Ltd.

Address before: 310052 room 508, 5th floor, building 4, No. 699 Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant before: Alibaba (China) Co.,Ltd.

GR01 Patent grant
GR01 Patent grant