CN112685316A - Code execution path acquisition method and device, computer equipment and storage medium - Google Patents

Code execution path acquisition method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112685316A
CN112685316A CN202110011784.8A CN202110011784A CN112685316A CN 112685316 A CN112685316 A CN 112685316A CN 202110011784 A CN202110011784 A CN 202110011784A CN 112685316 A CN112685316 A CN 112685316A
Authority
CN
China
Prior art keywords
code
log
execution path
information
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110011784.8A
Other languages
Chinese (zh)
Inventor
陈策
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Pinwei Software Co Ltd
Original Assignee
Guangzhou Pinwei Software 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 Guangzhou Pinwei Software Co Ltd filed Critical Guangzhou Pinwei Software Co Ltd
Priority to CN202110011784.8A priority Critical patent/CN112685316A/en
Publication of CN112685316A publication Critical patent/CN112685316A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a device for acquiring a code execution path, computer equipment and a storage medium, wherein the method comprises the following steps: adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement, executing the target code according to a test case, acquiring log information generated in the executing process by using the log printing statement, analyzing the log information, and acquiring the executing path information of the target code. According to the invention, through carrying out secondary development on the original pile inserting logic and inserting some log printing statements, extra time consumption is not increased and the existing service code logic is not changed, so that the information such as code execution path and the like can be obtained by analyzing after the service scene is executed.

Description

Code execution path acquisition method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of software testing technologies, and in particular, to a method and an apparatus for acquiring a code execution path, a computer device, and a storage medium.
Background
In the software development process, the developed application program needs to be subjected to related tests, such as code coverage tests and the like. Code coverage (English) is a measure in software testing and describes the proportion and degree of testing of source Code in a program, and the proportion is called Code coverage. Code coverage characterizes how much code can be covered during testing.
In the process of testing the code coverage rate, the execution path of the code is also very important information, in the existing scheme, the path information can only be obtained through stack information provided by a system, but the problem is difficult to predict, so that the system stack information can hardly accurately retain useful data, and the system stack information also has the problems that the problem can not be presented across threads, the time is very long, the execution efficiency of the thread in which the system stack information is located is influenced, the path information of the source code is difficult to trace, and the like.
Therefore, it is desirable to provide a new method for obtaining a code execution path to solve the above problems.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for acquiring a code execution path, a computer device, and a storage medium, so as to overcome the problems in the prior art.
In order to solve one or more technical problems, the invention adopts the technical scheme that:
in a first aspect, a method for associating test information is provided, where the method includes the following steps:
adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
executing the target code according to the test case, and acquiring log information generated in the executing process by using the log printing statement;
and analyzing the log information to acquire the execution path information of the target code.
Further, the adding the preset instrumentation code to the code to be tested and the generating the target code include:
determining a target instrumentation position in a code to be tested, adding the log printing statement to the target instrumentation position, and generating a target code, wherein the target instrumentation position comprises a method entry in the code to be tested.
Further, before executing the target code according to the test case, executing a clearing operation on a preset log collection tool;
the executing the target code according to the test case, and acquiring the log information generated in the executing process by using the log printing statement comprises:
executing the target code according to the test case, acquiring log information generated in the executing process by using the log printing statement, and outputting the log information to the preset log collecting tool.
Further, the preset log collection tool comprises jacoco.
Further, the analyzing the log information and acquiring the execution path information of the target code includes:
and analyzing the log information, and performing duplicate removal processing on an analysis result to acquire the execution path information of the target code.
Further, the method further comprises:
and when the execution path information does not meet the preset requirement, sending out early warning information.
Further, the method further comprises:
and after the execution path information is associated with the test case, uploading the execution path information to a target server for subsequent viewing.
In a second aspect, there is provided an apparatus, comprising:
the code inserting module is used for adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
the log collection module is used for executing the target code according to the test case and acquiring log information generated in the execution process by using the log printing statement;
and the path generation module is used for analyzing the log information and acquiring the execution path information of the target code.
In a third aspect, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the following steps are implemented:
adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
executing the target code according to the test case, and acquiring log information generated in the executing process by using the log printing statement;
and analyzing the log information to acquire the execution path information of the target code.
In a fourth aspect, there is provided a computer readable storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
executing the target code according to the test case, and acquiring log information generated in the executing process by using the log printing statement;
and analyzing the log information to acquire the execution path information of the target code.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
according to the code execution path acquisition method, the code execution path acquisition device, the computer equipment and the storage medium, the target code is generated by adding the preset instrumentation code to the code to be tested, wherein the preset instrumentation code comprises the log printing statement, the target code is executed according to the test case, the log information generated in the execution process is acquired by using the log printing statement, the log information is analyzed to acquire the execution path information of the target code, and the analysis is performed to acquire the information such as the code execution path after the execution of the service scene is completed without increasing extra time consumption and changing the existing service code logic by performing secondary development on the original instrumentation logic and inserting some log printing statements.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart illustrating a method of obtaining a code execution path in accordance with an illustrative embodiment;
FIG. 2 is a flowchart illustrating a method of obtaining a code execution path according to another example embodiment;
FIG. 3 is a block diagram illustrating an apparatus for obtaining a code execution path according to an example embodiment;
FIG. 4 is a schematic diagram illustrating an internal architecture of a computer device, according to an example embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, 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. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As described in the background art, on one hand, when a code coverage rate test is performed, code execution path information is relatively important information, but the acquisition scheme of the code execution path information in the prior art has the problems of high implementation difficulty, inaccurate acquired path information, long acquisition time consumption, influence on the execution efficiency of a thread in which an acquisition process is located, difficulty in tracing the source code path information, and the like. On the other hand, in coverage transactions, the instrumentation technique is used, but in actual application, the instrumentation technique is only inserted into a boolean array to play a role of a marker.
In order to solve the above problem, the inventive embodiment of the present invention provides a new method for acquiring a code execution path, where in order to acquire code execution path information, a stub code is developed for the second time, a log printing statement (e.g., a print xxx statement) is inserted into the code through stub logic, and when the code is executed, the log printing or sending the log printing to a remote server is performed on related information, such as information of a service path, time consumption, and the like. Thereby acquiring code execution path information.
Fig. 1 is a flowchart illustrating a method for acquiring a code execution path according to an exemplary embodiment, and referring to fig. 1, the method for acquiring a code execution path includes two parts:
1. stake insertion processing
The coverage transaction often uses the logic of Jacoco instrumentation, Jacoco is an open source coverage tool, mainly aiming at java language, and Jacoco mainly uses the instrumentation mode to record coverage data and injects the coverage data through a probe. In the embodiment of the invention, the information is developed for the second time, and some log printing statements are inserted, so that the information such as a service path, time consumption and the like can be obtained by analyzing after the service scene is executed.
In specific implementation, according to actual requirements, modifying jacoco, adding a log at a target instrumentation position (such as all method inlets), wherein the log mainly comprises a special tag (log filtering keyword), a class name, a timestamp and the like, and then issuing the modified jacoco to an internal project construction management server (such as maven) for packaging.
2. The code execution path information collection mainly comprises the following processes:
step one, obtaining an automatic case list through a test plan
Specifically, the test plan is formulated according to the test requirements of the user for the code to be tested, and the test plan can be formed by arranging a plurality of test cases corresponding to the code to be tested. In the embodiment of the present invention, a test plan corresponding to the code to be tested is obtained from the test management platform, and is analyzed to obtain an automatic case list or list, where the automatic case list or list has information related to the test case corresponding to the code to be tested, such as information of case name, case ID, and the like, which is not described herein repeatedly.
Step two, initializing case execution environment
Specifically, the case execution environment is a test environment of the code to be tested, which is an environment close to a real production environment, and may be, for example, a static test environment.
Step three, emptying the log
Specifically, in the embodiment of the present invention, a preset log collection tool is used to receive log information generated in the code execution process. The pre-set log collection tool includes, but is not limited to, logcat. Logcat is a command line tool in Android, and can be used to obtain log information of a program, and Logcat includes multiple commands, and different commands execute different operations. Before executing the automation use case, a clearing operation needs to be executed on the preset log collection tool to clear all historical log information in the buffer of the preset log collection tool.
Step four, executing the automatic case, and acquiring the log information generated in the executing process
Specifically, in the implementation of the present invention, because the log print statement is added to the code to be tested by using the instrumentation technique, after the automated use case is executed, not only the execution result data can be generated, but also the log information output by the log print statement can be generated, and the log information can be input to the preset log collection tool.
Step five, filtering the log information
Specifically, the collected log information may include a plurality of information, and in order to reduce the workload of subsequent calculation, the collected log information needs to be filtered. In specific implementation, the required log information can be extracted from the log information according to the log filtering keyword (tag).
Step six, analyzing and processing the log and obtaining a code execution path
Specifically, the log information extracted in the fifth step is analyzed, and the analysis processing operation includes, but is not limited to, deduplication, calculation, and the like, and the code execution path information is acquired.
Step seven, uploading the code execution path information to the server
Specifically, after the execution path information and the test case (i.e., the automation case) are associated, the execution path information and other required information are uploaded to the target server together, so that subsequent related personnel can check and call the information for use in different services, such as time-consuming analysis, accurate test analysis, problem tracking and positioning, and the like. As a preferred example, in the implementation, the execution path information may be associated with the test case through information such as a case name and a case id.
Step eight, repeating the step three to the step seven until all the cases in the whole test plan are executed
Specifically, since the test plan of the code to be tested corresponds to a plurality of test cases, the third to seventh steps can be executed in a circulating manner until all cases in the whole test plan are executed, and the test of the code to be tested is completed.
Fig. 2 is a flowchart illustrating a method for acquiring a code execution path according to an exemplary embodiment, and referring to fig. 2, the method includes the following steps:
s1: adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement.
In particular, instrumentation techniques, such as jacoco, are used in coverage transactions, and are typically used to insert boolean arrays to perform the marking function. In the embodiment of the invention, the log information is developed for the second time, and the log printing statement is inserted into the code to be tested through the instrumentation technology, so that the log information is generated after the execution of the service scene is finished. Because the method is carried out on the original instrumentation logic, additional time consumption is not increased, and the existing service code logic is not changed. It should be noted that, in addition to the log printing statement, the instrumentation code in the embodiment of the present invention may also include other statements, which may be specifically set according to an actual requirement of a user, and is not limited herein.
S2: and executing the target code according to the test case, and acquiring log information generated in the executing process by using the log printing statement.
Specifically, because the target code is generated by adding instrumentation codes such as log print statements to the code to be tested, after the target code is executed according to the test case, not only can code execution information be generated, but also log information generated in the execution process can be acquired through the log print statements.
S3: and analyzing the log information to acquire the execution path information of the target code.
As a preferred implementation manner, in an embodiment of the present invention, adding the preset instrumentation code to the code to be tested, and generating the target code includes:
determining a target instrumentation position in a code to be tested, adding the log printing statement to the target instrumentation position, and generating a target code, wherein the target instrumentation position comprises a method entry in the code to be tested.
Specifically, when a preset instrumentation code is added to a code to be tested, a target instrumentation position needs to be determined first, and preferably, the target instrumentation position in the embodiment of the present invention is all method entries in the code to be tested. In addition, the target instrumentation position may include a first statement of the program, a start of a branch statement, a start of a loop statement, a statement before a next entry statement, an end statement of the program, an end of a branch statement, an end of a loop statement, and the like.
As a preferred implementation manner, in the embodiment of the present invention, before executing the target code according to the test case, the method further includes performing a clearing operation on a preset log collection tool;
the executing the target code according to the test case, and acquiring the log information generated in the executing process by using the log printing statement comprises:
executing the target code according to the test case, acquiring log information generated in the executing process by using the log printing statement, and outputting the log information to the preset log collecting tool.
Specifically, a preset log collection tool may be used to receive log information generated during the execution of the target code output by the log print statement. The preset log collection tool includes, but is not limited to, logcat and other tools. Before executing the target code according to the test case, a clearing operation needs to be executed on the preset log collection tool to clear the historical log information stored in the buffer area of the preset log collection tool.
As a preferred implementation manner, in the embodiment of the present invention, the preset log collection tool includes jacoco.
As a preferred implementation manner, in an embodiment of the present invention, the analyzing the log information and acquiring the execution path information of the target code includes:
and analyzing the log information, and performing duplicate removal processing on an analysis result to acquire the execution path information of the target code.
Specifically, in order to reduce the subsequent calculation workload and the like, in the embodiment of the present invention, the collected log information is preprocessed, and in specific implementation, the collected log information is analyzed, and the generated analysis result is subjected to deduplication processing, so as to obtain a corresponding relationship between the target code and the execution path, that is, the execution path information of the target code is obtained.
As a preferred implementation manner, in an embodiment of the present invention, the method further includes:
and when the execution path information does not meet the preset requirement, sending out early warning information.
Specifically, after the execution path information of the target code is acquired, the execution path information can be compared with a preset requirement, whether the execution path information meets the preset requirement or not is judged, and if the execution path information does not meet the preset requirement, early warning information can be sent out to remind relevant personnel of checking. The early warning information can be sent to related personnel through mails, short messages and the like.
As a preferred implementation manner, in an embodiment of the present invention, the method further includes:
and after the execution path information is associated with the test case, uploading the execution path information to a target server for subsequent viewing.
Specifically, the execution path information may be associated with the test case through fields such as a case name and a case ID, which is not limited herein.
Fig. 3 is a schematic structural diagram illustrating an apparatus for acquiring a code execution path according to an exemplary embodiment, and referring to fig. 3, the apparatus includes:
the code inserting module is used for adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
the log collection module is used for executing the target code according to the test case and acquiring log information generated in the execution process by using the log printing statement;
and the path generation module is used for analyzing the log information and acquiring the execution path information of the target code.
As a preferred implementation manner, in an embodiment of the present invention, the code insertion module is specifically configured to:
determining a target instrumentation position in a code to be tested, adding the log printing statement to the target instrumentation position, and generating a target code, wherein the target instrumentation position comprises a method entry in the code to be tested.
As a preferred implementation manner, in an embodiment of the present invention, the apparatus further includes:
the log clearing module is used for executing clearing operation on a preset log collecting tool before the target code is executed according to the test case;
the log collection module is specifically configured to execute the target code according to a test case, obtain log information generated in an execution process by using the log printing statement, and output the log information to the preset log collection tool.
As a preferred implementation manner, in the embodiment of the present invention, the preset log collection tool includes jacoco.
As a preferred implementation manner, in an embodiment of the present invention, the path generating module is specifically configured to:
and analyzing the log information, and performing duplicate removal processing on an analysis result to acquire the execution path information of the target code.
As a preferred implementation manner, in an embodiment of the present invention, the apparatus further includes:
and the abnormity early warning module is used for sending out early warning information when the execution path information does not meet the preset requirement.
As a preferred implementation manner, in an embodiment of the present invention, the apparatus further includes:
and the information transmission module is used for uploading the execution path information and the test case to a target server for subsequent checking after the execution path information is associated with the test case.
Fig. 4 is a schematic diagram illustrating an internal configuration of a computer device according to an exemplary embodiment, which includes a processor, a memory, and a network interface connected through a system bus, as shown in fig. 4. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of optimization of an execution plan.
Those skilled in the art will appreciate that the configuration shown in fig. 4 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing devices to which aspects of the present invention may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
As a preferred implementation manner, in an embodiment of the present invention, the computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
executing the target code according to the test case, and acquiring log information generated in the executing process by using the log printing statement;
and analyzing the log information to acquire the execution path information of the target code.
As a preferred implementation manner, in the embodiment of the present invention, when the processor executes the computer program, the following steps are further implemented:
determining a target instrumentation position in a code to be tested, adding the log printing statement to the target instrumentation position, and generating a target code, wherein the target instrumentation position comprises a method entry in the code to be tested.
As a preferred implementation manner, in the embodiment of the present invention, when the processor executes the computer program, the following steps are further implemented:
before executing the target code according to the test case, executing clearing operation on a preset log acquisition tool;
executing the target code according to the test case, acquiring log information generated in the executing process by using the log printing statement, and outputting the log information to the preset log collecting tool.
As a preferred implementation manner, in the embodiment of the present invention, when the processor executes the computer program, the following steps are further implemented:
and analyzing the log information, and performing duplicate removal processing on an analysis result to acquire the execution path information of the target code.
As a preferred implementation manner, in the embodiment of the present invention, when the processor executes the computer program, the following steps are further implemented:
and when the execution path information does not meet the preset requirement, sending out early warning information.
As a preferred implementation manner, in the embodiment of the present invention, when the processor executes the computer program, the following steps are further implemented:
and after the execution path information is associated with the test case, uploading the execution path information to a target server for subsequent viewing.
In an embodiment of the present invention, a computer-readable storage medium is further provided, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the following steps:
adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
executing the target code according to the test case, and acquiring log information generated in the executing process by using the log printing statement;
and analyzing the log information to acquire the execution path information of the target code.
As a preferred implementation manner, in the embodiment of the present invention, when executed by the processor, the computer program further implements the following steps:
determining a target instrumentation position in a code to be tested, adding the log printing statement to the target instrumentation position, and generating a target code, wherein the target instrumentation position comprises a method entry in the code to be tested.
As a preferred implementation manner, in the embodiment of the present invention, when executed by the processor, the computer program further implements the following steps:
before executing the target code according to the test case, executing clearing operation on a preset log acquisition tool;
executing the target code according to the test case, acquiring log information generated in the executing process by using the log printing statement, and outputting the log information to the preset log collecting tool.
As a preferred implementation manner, in the embodiment of the present invention, when executed by the processor, the computer program further implements the following steps:
and analyzing the log information, and performing duplicate removal processing on an analysis result to acquire the execution path information of the target code.
As a preferred implementation manner, in the embodiment of the present invention, when executed by the processor, the computer program further implements the following steps:
and when the execution path information does not meet the preset requirement, sending out early warning information.
As a preferred implementation manner, in the embodiment of the present invention, when executed by the processor, the computer program further implements the following steps:
and after the execution path information is associated with the test case, uploading the execution path information to a target server for subsequent viewing.
In summary, the technical solution provided by the embodiment of the present invention has the following beneficial effects:
according to the code execution path acquisition method, the code execution path acquisition device, the computer equipment and the storage medium, the target code is generated by adding the preset instrumentation code to the code to be tested, wherein the preset instrumentation code comprises the log printing statement, the target code is executed according to the test case, the log information generated in the execution process is acquired by using the log printing statement, the log information is analyzed to acquire the execution path information of the target code, and the analysis is performed to acquire the information such as the code execution path after the execution of the service scene is completed without increasing extra time consumption and changing the existing service code logic by performing secondary development on the original instrumentation logic and inserting some log printing statements.
It should be noted that: the apparatus for acquiring a code execution path provided in the foregoing embodiment, when triggering a path acquisition service, is only illustrated by dividing the functional modules, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, an internal structure of the apparatus is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the code execution path obtaining apparatus and the code execution path obtaining method provided in the above embodiments belong to the same concept, that is, the apparatus is based on the code execution path obtaining method, and a specific implementation process thereof is detailed in the method embodiment and is not described herein again.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A method for acquiring a code execution path, the method comprising the steps of:
adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
executing the target code according to the test case, and acquiring log information generated in the executing process by using the log printing statement;
and analyzing the log information to acquire the execution path information of the target code.
2. The method for obtaining the code execution path according to claim 1, wherein the adding the preset instrumentation code to the code to be tested and generating the target code comprises:
determining a target instrumentation position in a code to be tested, adding the log printing statement to the target instrumentation position, and generating a target code, wherein the target instrumentation position comprises a method entry in the code to be tested.
3. The method for acquiring the code execution path according to claim 1 or 2, wherein the method further comprises executing a clearing operation on a preset log collection tool before executing the target code according to the test case;
the executing the target code according to the test case, and acquiring the log information generated in the executing process by using the log printing statement comprises:
executing the target code according to the test case, acquiring log information generated in the executing process by using the log printing statement, and outputting the log information to the preset log collecting tool.
4. The method according to claim 3, wherein the predetermined log collection tool comprises jacoco.
5. The method according to claim 1 or 2, wherein the parsing the log information and obtaining the execution path information of the target code includes:
and analyzing the log information, and performing duplicate removal processing on an analysis result to acquire the execution path information of the target code.
6. The method for obtaining the code execution path according to claim 1 or 2, wherein the method further comprises:
and when the execution path information does not meet the preset requirement, sending out early warning information.
7. The method for obtaining the code execution path according to claim 1 or 2, wherein the method further comprises:
and after the execution path information is associated with the test case, uploading the execution path information to a target server for subsequent viewing.
8. An apparatus for obtaining a code execution path, the apparatus comprising:
the code inserting module is used for adding a preset instrumentation code into a code to be tested to generate a target code, wherein the preset instrumentation code comprises a log printing statement;
the log collection module is used for executing the target code according to the test case and acquiring log information generated in the execution process by using the log printing statement;
and the path generation module is used for analyzing the log information and acquiring the execution path information of the target code.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110011784.8A 2021-01-04 2021-01-04 Code execution path acquisition method and device, computer equipment and storage medium Pending CN112685316A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110011784.8A CN112685316A (en) 2021-01-04 2021-01-04 Code execution path acquisition method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110011784.8A CN112685316A (en) 2021-01-04 2021-01-04 Code execution path acquisition method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112685316A true CN112685316A (en) 2021-04-20

Family

ID=75455856

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110011784.8A Pending CN112685316A (en) 2021-01-04 2021-01-04 Code execution path acquisition method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112685316A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377674A (en) * 2021-07-02 2021-09-10 北京奇艺世纪科技有限公司 Log code adding method and device
CN113486346A (en) * 2021-05-27 2021-10-08 贵州电网有限责任公司 Runtime safety detection method and device based on Java Agent instrumentation technology

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106681912A (en) * 2016-12-08 2017-05-17 武汉斗鱼网络科技有限公司 Method and device for automatic testing of code coverage rate, applied to Android system
CN106802866A (en) * 2017-01-23 2017-06-06 浙江大学 A kind of restoring method of the execution route of Android program
CN108595313A (en) * 2018-03-08 2018-09-28 北京三快在线科技有限公司 Daily record generation method, device, electronic equipment and the storage medium of application program
CN110058999A (en) * 2019-03-13 2019-07-26 平安普惠企业管理有限公司 Electronic device, application exception localization method and storage medium
CN110321275A (en) * 2018-03-29 2019-10-11 腾讯科技(上海)有限公司 Program monitoring method, calculates equipment and storage medium at device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106681912A (en) * 2016-12-08 2017-05-17 武汉斗鱼网络科技有限公司 Method and device for automatic testing of code coverage rate, applied to Android system
CN106802866A (en) * 2017-01-23 2017-06-06 浙江大学 A kind of restoring method of the execution route of Android program
CN108595313A (en) * 2018-03-08 2018-09-28 北京三快在线科技有限公司 Daily record generation method, device, electronic equipment and the storage medium of application program
CN110321275A (en) * 2018-03-29 2019-10-11 腾讯科技(上海)有限公司 Program monitoring method, calculates equipment and storage medium at device
CN110058999A (en) * 2019-03-13 2019-07-26 平安普惠企业管理有限公司 Electronic device, application exception localization method and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113486346A (en) * 2021-05-27 2021-10-08 贵州电网有限责任公司 Runtime safety detection method and device based on Java Agent instrumentation technology
CN113377674A (en) * 2021-07-02 2021-09-10 北京奇艺世纪科技有限公司 Log code adding method and device
CN113377674B (en) * 2021-07-02 2024-03-08 北京奇艺世纪科技有限公司 Log code adding method and device

Similar Documents

Publication Publication Date Title
CN106909510B (en) Method for obtaining test case and server
CN103164328B (en) The regression testing method of a kind of business function, Apparatus and system
CN111290956B (en) Brain graph-based test method and device, electronic equipment and storage medium
US20170097812A1 (en) Automated and heuristically managed solution to quantify cpu and path length cost of instructions added, changed or removed by a service team
Groce et al. From scripts to specifications: the evolution of a flight software testing effort
CN112685316A (en) Code execution path acquisition method and device, computer equipment and storage medium
CN109857631A (en) Code coverage statistical method, device, equipment and storage medium based on artificial intelligence
CN109857637B (en) Java language method coverage rate and method input and output statistical method based on annotation
KR102269286B1 (en) the automatic monitoring system for annotation
CN112685312A (en) Test case recommendation method and device for uncovered codes
CN113535538A (en) Application full-link automatic testing method and device, electronic equipment and storage medium
CN111966587A (en) Data acquisition method, device and equipment
CN111459814A (en) Automatic test case generation method and device and electronic equipment
CN113254350A (en) Flink operation testing method, device, equipment and storage medium
CN117743145A (en) Test script generation method and device based on coding template and processing equipment
CN111767213B (en) Database check point testing method and device, electronic equipment and storage medium
CN117493188A (en) Interface testing method and device, electronic equipment and storage medium
CN112612697A (en) Software defect testing and positioning method and system based on byte code technology
CN112084108A (en) Test script generation method and device and related components
CN109508204B (en) Front-end code quality detection method and device
US10650174B1 (en) System and method for visualizing event sequences for expressions using both hardware and software state information
CN110502433A (en) A kind of computer software technology exploitation debugging system
CN115576831A (en) Test case recommendation method, device, equipment and storage medium
CN115994086A (en) Image processing method and device, storage medium and terminal
Hammoudi et al. A traceability dataset for open source systems

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210420

RJ01 Rejection of invention patent application after publication