Method and apparatus for processing source code, and storage medium
By adding private variables to unexecuted methods in the code testing platform, code coverage information is automatically recorded and obtained, which solves the cost and complexity problems of manually obtaining code coverage in the existing technology, realizes automatic acquisition of code coverage, and reduces Reduce maintenance costs and increase flexibility.
Patent Information
- Application Number
- PCT/CN2023/141089
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-06-25
- Filing Date
- 2023-12-22
- Publication Date
- 2024-09-26
AI Technical Summary
Obtaining code coverage in the existing technology requires manual participation by technical personnel, which increases cost and complexity, and is difficult to automate.
By adding private variables to unexecuted methods in the code testing platform, recording the execution of code statements, and automatically obtaining code coverage information after testing, displaying code coverage, and achieving automatic acquisition of code coverage.
It reduces the cost of obtaining code coverage, improves the automation of the code testing platform, reduces maintenance costs, and increases flexibility.
Smart Images

Figure CN2023141089_26092024_PF_FP
Abstract
Description
Method, device and storage medium for processing source code Technical Field
[0001] The present application relates to the field of computers, and in particular to a method, device, and storage medium for processing source code. Background Art
[0002] Code coverage is the percentage of executed code compared to the total code during service operation. It is an objective and effective metric for measuring the quality of a service's source code. After developing the service's source code, you can test it. During this testing process, you can obtain code coverage.
[0003] In related technologies, manual participation by technicians is required to obtain code coverage of source code. This manual participation requires the technicians to be aware of the code coverage acquisition process, which increases costs.
[0004] Summary of the Invention
[0005] This application provides a method, device, and storage medium for processing source code to automatically obtain code coverage and reduce costs. The technical solution is as follows:
[0006] In a first aspect, the present application provides a method for processing source code, which is applied to a code testing platform, and the code testing platform is used to test a first source code using a first test case. In the method, an instruction for starting code testing is received, and the instruction for starting code testing is used to instruct the code testing platform to start testing the first source code. Private variables are added to at least one first method included in the first source code, and the at least one first method is a method that is not executed in the first source code. The private variables in the first method are used to record the execution status of each code statement in the first method when the first method is executed. After the first source code is tested using the first test case, first code coverage information is obtained based on the private variables in the at least one first method, and the first code coverage information is used to describe the execution status of the code statements in the at least one first method. Based on the first code coverage information, a first code coverage result is displayed, and the first code coverage result includes the code coverage rate of the first source code.
[0007] Upon receiving an instruction to initiate code testing, testing of the first source code is initiated. After initiating testing of the first source code, a private variable is added to at least one unexecuted first method in the first source code. When each of the at least one first method is executed, the private variable in the first method is used to record the execution status of each code statement in the first method. After testing the first source code using the first test case, first code coverage information is obtained based on the private variables in the at least one first method. The first code coverage information describes the execution status of the code statements in the at least one first method. Based on the first code coverage information, the code coverage rate of the first source code is displayed. Because the private variable is added to the at least one unexecuted first method after initiating testing of the first source code, the modification of the instruction to initiate code testing, which is required in a startup instrumentation scenario, is avoided. After initiating testing of the first source code, the private variable is automatically added to the unexecuted methods in the first source code, and the user is unaware of the entire process of obtaining the first code coverage information. This enables automatic acquisition of code coverage, saves costs, reduces the cost of maintaining the code testing platform, and increases the flexibility of users in using the automated code testing platform.
[0008] In one possible implementation, the first source code also includes a second method, which is the method being executed when the private variable is added to the at least one first method. Thread stack frame information for the second method is obtained, and the thread stack frame information is used to record the execution status of each code statement in the second method. The executed code statements in the second method are determined based on the thread stack frame information, and the first code coverage information is further used to describe the execution status of the code statements in the second method. This enriches the first code coverage information and avoids omitting the code execution status of the second method.
[0009] In another possible implementation, the first code coverage information is further used to describe the execution status of each code statement in a first static code block. The first static code block is a static code block that has been executed in the first source code before the private variable is added to the at least one first method. Each code statement in the first static code block is executed. This enriches the first code coverage information and avoids omitting the code execution status of the first static code block.
[0010] In another possible implementation, the first code coverage information is further used to describe the execution status of each code statement in the constructor of the target class. The target class is a class including a constructor that has been fully executed in the first source code before the private variable is added to the at least one first method. Each code statement in the constructor of the target class is executed. This enriches the first code coverage information and avoids omitting the code execution status of the constructor of the target class.
[0011] In another possible implementation, the private variable of the first method includes an element corresponding to each code statement in the first method. An assignment statement corresponding to the i-th code statement in the first method is added, where i = 1, 2, 3, ..., and the assignment statement is used to set the value of the element corresponding to the i-th code statement to a target value when the i-th code statement is executed. The target value is used to indicate that the i-th code statement has been executed. In this way, the private variable records the execution status of the code statements in the first method through the assignment statements in the first method.
[0012] In another possible implementation, the first code coverage information includes identification information of code statements executed in the at least one first method. The order of each first method in the first source code and the identification information of the start code statement and the identification information of the end code statement in each first method are obtained. The values of each element included in the private variable of each first method are obtained. The first code coverage information is obtained based on the values of each element included in the private variable of each first method, the order of each first method, and the identification information of the start code statement and the identification information of the end code statement in each first method.
[0013] Since the at least one method is stored in disorder in the code testing platform, based on the order of each first method, the identification information of the starting code statement and the identification information of the ending code statement in each first method, the order of the at least one first method in the first source code can be restored, thereby improving the accuracy of the obtained first code coverage information.
[0014] In another possible embodiment, the code testing platform includes a first test device and a second test device, the first source code includes a first part and a second part, the first test device is used to test the first part using a first test case, and the second test device is used to test the second part using the first test case, and the first code coverage information is used to describe the execution of the code statements in the first part. A second private variable is added to at least one third method included in the first source code in the second test device, and the at least one third method is a method that is not executed in the first source code in the second test device. When the second test device completes testing the first source code using the first test case, second code coverage information is obtained based on the private variables in the third method included in the second part, and the second code coverage information is used to describe the execution of the code statements in the second part. Based on the first code coverage information and the second code coverage information, the overall code coverage information corresponding to the first source code is obtained. Based on the overall code coverage information, the first code coverage result is displayed.
[0015] In this way, multiple test devices can be used to test different parts of the first source code, and then code coverage information corresponding to the part of the source code tested by each test device can be obtained. Based on the code coverage information corresponding to each part of the source code, the overall code coverage information corresponding to the first source code can be obtained. This ensures that the first source code is tested in parallel using multiple test devices, thereby improving testing efficiency.
[0016] In another possible implementation, private variables are added to methods other than the at least one first method in the first source code. This ensures that private variables are added to each method in the first source code, and the execution status of code statements in each method is collected through the private variables in each method.
[0017] In another possible embodiment, the code coverage rate included in the first code coverage result is the code coverage rate when the first source code executes the first test case. The code testing platform is further used to test the first source code using the second test case after the first source code is tested using the first test case. After the first source code is tested using the second test case, third code coverage information is obtained based on the private variables in each method included in the first source code. The third code coverage information is used to describe the execution status of the code statements in the first source code. Based on the first code coverage information and the third code coverage information, a second code coverage result is displayed. The second code coverage result includes the code coverage rate when the first source code executes the first test case and the second test case.
[0018] Since one test case may not be able to execute every code statement of the first source code, code coverage information corresponding to each test case is obtained. Based on the code coverage information corresponding to each test case, the code coverage rate of the first source code can be accurately obtained.
[0019] In another possible implementation, change information is obtained, where the change information is used to describe the difference between the second source code and the first source code. The first source code and the second source code are two versions of the source code for the same service, and the version of the second source code is earlier than the version of the first source code. Code coverage information corresponding to the difference is obtained based on the change information and the first code coverage information. The code coverage information corresponding to the difference is used to describe the execution status of the code statements in the difference. Based on the code coverage information corresponding to the difference, a code coverage result for the difference is displayed. The code coverage result for the difference includes a code coverage rate for the difference.
[0020] The difference part is the new content in the first source code. The execution status of the code statements in the difference part may be the content that the user is interested in. Displaying the code coverage results of the difference part can meet the user's needs and enable the user to know the code coverage information of the new part in the new version of the source code.
[0021] In another possible implementation, at least one component included in the difference part is obtained. For each component, the code coverage information corresponding to the component is obtained based on the code coverage information corresponding to the difference part. The code coverage information corresponding to the component is used to describe the execution status of the code statements in the component. The code coverage result of the component is displayed based on the code coverage information corresponding to the component. The code coverage result of the component includes the code coverage rate of the component. Each component of the difference part may be content of interest to the user, and displaying the code coverage result of each component can meet the user's needs.
[0022] In another possible implementation, the at least one component includes one or more of the following: at least one branch in the difference portion, at least one method in the difference portion, or at least one class in the difference portion.
[0023] In a second aspect, the present application provides an apparatus for processing source code, for executing the method in the first aspect or any possible implementation of the first aspect. Specifically, the apparatus includes a unit for executing the method in the first aspect or any possible implementation of the first aspect.
[0024] In a third aspect, the present application provides a computing device cluster, the cluster comprising at least one computing device, each device in the at least one computing device comprising at least one processor and at least one memory, the at least one memory storing computer-readable instructions; the at least one processor executes the computer-readable instructions so that the cluster implements the method in the first aspect or any possible implementation of the first aspect.
[0025] In a fourth aspect, the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium, and the computer program is loaded by a processor to implement the method in the first aspect or any possible implementation of the first aspect.
[0026] In a fifth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program is loaded by a processor to execute the method in the first aspect or any possible implementation of the first aspect.
[0027] In a sixth aspect, the present application provides a chip comprising a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to call and run the computer instructions from the memory to execute the method in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] FIG1 is a schematic diagram of the structure of a code testing platform provided in an embodiment of the present application;
[0029] FIG2 is a schematic diagram of the structure of another code testing platform provided in an embodiment of the present application;
[0030] FIG3 is a flow chart of a method for processing source code provided in an embodiment of the present application;
[0031] FIG4 is a schematic diagram of a source code provided in an embodiment of the present application;
[0032] FIG5 is a schematic diagram of another source code provided in an embodiment of the present application;
[0033] FIG6 is a schematic diagram of the source code after adding private variables according to an embodiment of the present application;
[0034] FIG7 is a schematic diagram of an interface provided in an embodiment of the present application;
[0035] FIG8 is a schematic diagram of the structure of a device for processing source code provided in an embodiment of the present application;
[0036] FIG9 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0037] FIG10 is a schematic diagram of the structure of a cluster for processing source code provided in an embodiment of the present application;
[0038] FIG11 is a schematic structural diagram of another cluster for processing source code provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
[0040] Source code is a series of computer language instructions. This source code might be written in Java or Python, for example. After the source code is written, it needs to be tested to obtain at least one test metric, which can be used to measure the quality of the source code.
[0041] The at least one test metric includes code coverage. Code coverage refers to the ratio of executed code statements in the source code to the total code statements in the source code when the source code is executed. When testing the source code, code coverage information for the source code can be obtained. The code coverage information is used to describe the executed code statements in the source code. The number of executed code statements in the source code can be obtained through the code coverage information. Based on the number of code statements and the total number of code statements included in the source code, the code coverage of the source code can be calculated.
[0042] For example, code coverage information may include identification information of executed code statements in the source code. Counting the identification information of executed code statements in the source code can yield the number of executed code statements in the source code. The code coverage rate is obtained by counting the total number of code statements in the source code and calculating the ratio between the number of executed code statements and the total number of code statements.
[0043] Before testing the source code, the technician needs to manually modify the startup command used to start the test so that the startup command includes the storage path of the source code, the storage path of the code coverage tool, and configuration parameters, and then send the startup command to the test device. The test device loads the code coverage tool based on the storage path of the code coverage tool included in the startup command, and configures the code coverage tool based on the configuration parameters; then the source code is loaded into the memory of the test device based on the storage path of the source code. In the process of loading the source code, the code coverage tool adds a global static variable to the source code. The static variable includes an element corresponding to each code statement in the source code. When each code statement is loaded into the memory of the test device, the assignment statement corresponding to the code statement is added to the memory of the test device. For each code statement in the source code, the static variable includes an element corresponding to the code statement. If the code statement is executed, the assignment statement corresponding to the code statement uses the element to record that the code statement has been executed. In this way, after the source code is tested, the code coverage information of the source code can be obtained based on the elements included in the static variable.
[0044] While this method can obtain code coverage information for source code, it requires technicians to invasively modify the startup command, making it difficult to maintain. Technicians need to be highly aware of the code coverage tool's integration process, download it, and rely on parameters added to the startup command. Furthermore, the code for production and test environments must be differentiated, incurring some additional overhead.
[0045] 1 , an embodiment of the present application provides a code testing platform 100 , which includes a pipeline device 101 , a code coverage device 102 , a code repository 103 , and a testing environment 104 , wherein the testing environment 104 includes at least one testing device 1041 .
[0046] The pipeline device 101 communicates with the code coverage device 102 , the code repository 103 , and each test device 1041 in the test environment 104 , respectively.
[0047] Code repository 103 is used to store at least one source code, which is the source code of at least one service. Optionally, the source code stored in code repository 103 may be bytecode, etc. The at least one service may be a microservice, etc.
[0048] In some embodiments, the test device 1041 included in the test environment 105 may be a physical device (such as a server or terminal device), a virtual machine and / or a container, etc. The pipeline device 101 may be a single device or a cluster, the code coverage device 102 may be a single device or a cluster, and the code repository 103 may be a storage device or a storage cluster.
[0049] For ease of description, each source code in the at least one source code is referred to as a first source code. Pipeline device 101 includes a testing service for testing the first source code. Code coverage device 102 subscribes to the testing service on pipeline device 101. When pipeline device 101 tests the first source code using the testing service, code coverage device 102 is notified.
[0050] In some embodiments, the pipeline device 101 receives an instruction for starting a code test, where the instruction for starting a code test is used to instruct the code testing platform 100 to start testing a first source code. Based on the instruction for starting a code test, the pipeline device 101 obtains the first source code from the code repository 103 and loads the first source code into at least one test device 1041 in the test environment 105. When the at least one test device 1041 includes one test device 1041, the test device 1041 tests the entire first source code. When the at least one test device 1041 includes multiple test devices 1041, each test device 1041 tests a portion of the first source code.
[0051] Optionally, the pipeline device 101 loads the first source code into the memory of the at least one test device 1041. For each test device 1041 in the at least one test device 1041, when the first source code is loaded into the memory of the test device 1041, the test device 1041 executes the first source code.
[0052] After the first source code is loaded into the memory of the test device 1041, adding static variables, static methods, etc. to the first source code stored in the memory of the test device 1041 is prohibited. Typically, static variables are located in the main function of the first source code and are global variables that can be accessed by every function in the first source code. In other words, after the first source code is loaded into the memory of the test device 1041, adding global variables to the first source code stored in the memory of the test device 1041 is prohibited.
[0053] When initiating the test on the first source code, the pipeline device 101 will also send a test notification message to the code coverage device 102 . The test notification message is used to instruct to start testing the first source code on the at least one test device 1041 .
[0054] The code coverage device 102 receives the test notification message and sends a code coverage request to the at least one test device, where the code coverage request is used to request to obtain code coverage information of the first source code.
[0055] For ease of description, each test device 1041 in the at least one test device 1041 is referred to as a first test device. First test device 1041 receives a code coverage request and, based on the triggering of the code coverage request, adds a private variable to at least one first method included in a first source code stored in a memory of first test device 1041. The at least one first method is an unexecuted method in the first source code. The private variable in the first method is used to record the execution status of each code statement in the first method during execution of the first method.
[0056] After loading the first source code into the memory of the at least one test device 1041, the first test device 1041 can receive a first test case and test the first source code based on the first test case. After testing the first source code using the first test case, first code coverage information is obtained based on the private variables in the at least one first method. The first code coverage information is used to describe the code statements executed in the at least one first method. The first code coverage information is then sent to the code coverage device 102. The code coverage device 102 displays a first code coverage result based on the first code coverage information. The first code coverage result includes the code coverage rate of the first source code.
[0057] In some embodiments, a technician may configure at least one test case on pipeline device 101, where the at least one test case includes a first test case. Pipeline device 101 may send the first test case to the at least one test device 1041, causing the at least one test device 1041 to test the first source code using the first test case. After testing the first source code using the first test case, pipeline device 101 may further send a second test case to the at least one test device 1041, causing the at least one test device 1041 to test the first source code using the second test case. The second test case is a test case in the at least one test case other than the first test case.
[0058] In some embodiments, referring to FIG. 2 , the code testing platform 100 further includes a test management device 105 , which communicates with the pipeline device 101 and each test device 1041 in the test environment 104 .
[0059] After loading the first source code into at least one test device 1041 included in the test environment 104, the pipeline device 101 sends the at least one test case to the test management device 105. After receiving the at least one test case, the test management device 105 sends the first test case to the at least one test device 1041, so that the at least one test device 1041 tests the first source code using the first test case. After testing the first source code using the first test case, the test management device 105 may also send a second test case to the at least one test device 1041, so that the at least one test device 1041 tests the first source code using the second test case.
[0060] After the pipeline device 101 starts testing the first source code on the at least one test device 1041, the code coverage device 102 sends a code coverage request to the at least one test device 1041, requesting the at least one test device 1041 to obtain code coverage information for the first source code. This allows the code coverage information to be automatically obtained after the test of the first source code begins, eliminating the need to modify the startup command used to start the test. The technician is unaware of the process of obtaining the code coverage information, thus enabling automatic acquisition of the code coverage information and reducing labor costs.
[0061] 3 , an embodiment of the present application provides a method 300 for processing source code. The method 300 is applied to the code testing platform 100 shown in FIG. 1 or FIG. 2 , and the method 300 includes the following process.
[0062] Step 301: A pipeline device receives an instruction to start a test code and loads a first source code into at least one test device in a test environment, where the at least one test device includes a first test device.
[0063] The code repository stores the source code of at least one service. When a user needs to test the source code of at least one service in the code repository, the user triggers an instruction to start the test code to the pipeline device.
[0064] In some embodiments, the pipeline device may display a test start interface to the user, including a start button. The user may click the start button to trigger the pipeline device to execute the test start code. Alternatively, the user may input the test start code instruction on their corresponding terminal device, which then triggers the test start code instruction to the pipeline device.
[0065] The pipeline device receives the instruction to start the test code and obtains the source code of a service from the code warehouse. For the sake of convenience, the service is called the first service, and the source code of the service is called the first source code. The first source code is loaded into at least one test device included in the test environment.
[0066] For each test device of the at least one test device, when the first source code is loaded into the memory of each test device, each test device starts to execute the first source code.
[0067] In some embodiments, after testing the first source code, the pipeline device obtains a second source code from the code repository, where the second source code is the source code of a second service, which is a service other than the first service, and then tests the second source code according to the above process of testing the first source code.
[0068] In some embodiments, when the first source code is loaded into the memory of the first test device, the first test device also obtains an index file of the first source code, the index file including a first correspondence and a second correspondence, the first correspondence being used to store the correspondence between the identification information of each class in the first source code and the identification information of each method included in each class. The second correspondence is used to store the correspondence between the order of each method, the identification information of the starting code statement of each method, and the identification information of the ending code statement. Optionally, the identification information of the code statement may be content such as the line number of the code statement in the first source code. For any class in the first source code, the identification information of the class may include the fully qualified class name of the class, etc.
[0069] In some embodiments, each method included in any class in the first source code may be stored out of order in the memory of the first test device. That is, for each method included in any class in the first source code, the order in which the methods are stored in the memory of the first test device may be different from or the same as the actual order of the methods in the class.
[0070] For example, referring to a class in the first source code shown in FIG4 , which includes method 1, method 2, and method 3, after the first source code is loaded into the memory of the first test device, the storage order of method 1, method 2, and method 3 in the memory of the first test device may or may not be random. That is, the storage order of the three methods in the memory of the first test device may be method 3, method 2, method 1; or method 2, method 3, method 1; or method 1, method 3, method 2; or method 1, method 2, method 3, etc.
[0071] For example, as shown in FIG5 , assuming that after the first source code shown in FIG4 is loaded into the memory of the first test device, the storage order of the three methods in the memory of the first test device is method 2, method 3, and method 1.
[0072] In some embodiments, when the pipeline device starts testing the first source code, it also assigns a pipeline identifier to the first source code, obtains pipeline detail information of the first source code, and stores the pipeline identifier of the first source code and the pipeline detail information of the first source code in a corresponding relationship between the pipeline identifier and the pipeline detail information.
[0073] The pipeline details information of the first source code includes one or more of the following information:
[0074] The test environment type, the address of the at least one test device, the storage address of the first source code in the code repository, change information, or identification information of at least one test case, wherein the change information indicates the differences between the second source code and the first source code. The second source code and the first source code are two different versions of the first service, and the second source code is earlier than the first source code.
[0075] In some embodiments, in addition to a test environment, there is also a production environment. The test environment is used to test the first source code, and the production environment is used to run the first source code to provide the first service to the user.
[0076] In some embodiments, the at least one test case may be configured by a technician on a pipeline device.
[0077] In some embodiments, a first source code is obtained by modifying a second source code. The modification information includes a first commit point and a second commit point. The first commit point records the modification start operation and the content of the modification start operation, and the second commit point records the modification end operation and the content of the modification end operation. The difference portion can be obtained based on the first commit point and the second commit point. Alternatively, the modification information includes the starting position and ending position of the difference portion in the first source code.
[0078] In some embodiments, the pipeline device may further send the at least one test case to the test management device.
[0079] Step 302: The pipeline device sends a test notification message to the code coverage device, where the test notification message is used to instruct to start testing the first source code on the at least one test device.
[0080] The code coverage device has subscribed to the test service on the pipeline device in advance. When the pipeline device starts testing the first source code using the test service, it sends a test notification message to the code coverage device.
[0081] In some embodiments, the test notification message further includes a pipeline identifier corresponding to the first source code.
[0082] Step 303: The code coverage device receives the test notification message and sends a code coverage request to the at least one test device, where the code coverage request is used to request to obtain code coverage information of the first source code.
[0083] In step 303, the code coverage device receives the test notification message, and based on the pipeline identifier corresponding to the first source code included in the test notification message, obtains the pipeline detail information of the first source code from the correspondence between the pipeline identifier and the pipeline detail information included in the pipeline device.
[0084] The pipeline details of the first source code include an address of at least one test device deployed with the first source code in the test environment. The code coverage device sends a code coverage request to the at least one test device based on the address of the at least one test device.
[0085] In some embodiments, the pipeline detail information of the first source code includes identification information of at least one test case, and the code coverage request may also include identification information of the at least one test case. The code coverage request is used to request to obtain code coverage information corresponding to each test case in the at least one test case.
[0086] In some embodiments, the code coverage request also includes a code coverage unit, which is used to obtain code coverage information of the first source code. Optionally, the code coverage unit can automatically add private variables to each method of the first source code, and for each method, can add an assignment statement corresponding to each code statement included in the method. For an assignment statement corresponding to any code statement in the method, the assignment statement is used to record the execution status of the code statement in the private variable of the method when the code statement is executed.
[0087] In some embodiments, the code coverage unit may be a plug-in or program for obtaining code coverage information, etc. For example, the code coverage unit may be a local probe array strategy, etc.
[0088] In some embodiments, the pipeline details information of the first source code also includes the environment type of the test environment. The code coverage device determines whether the environment corresponding to the environment type is a test environment. If it is a test environment, it indicates that the pipeline platform is testing the first source code and sends a code coverage request to the at least one test device. If it is a production environment, it indicates that the pipeline platform uses the first source code to provide the first service to the user, and the code coverage platform does not need to send a code coverage request.
[0089] Because the code coverage platform can automatically identify whether the current environment is a test environment or a production environment, it can isolate the production environment from the test environment. Users do not need to be aware of the differences between the test environment and the production environment when starting a test. When testing is required, the pipeline platform sends a command to start the test code. After receiving this command, the pipeline platform loads the first source code into the test device in the test environment.
[0090] In some embodiments, the code coverage unit corresponding to the environment type may be pre-deployed in the at least one test device, so in step 303, the code coverage request may not include the code coverage unit corresponding to the environment type.
[0091] For example, the type of the at least one test device may be a physical device, a virtual machine, a container, or the like.
[0092] Step 304: The first test device receives the code coverage request, and based on the code coverage request, adds a private variable to at least one first method included in the first source code, where the at least one first method is a method that is not executed in the first source code, and the private variable in the first method is used to record the execution status of each code statement in the first method when executing the first method.
[0093] In step 304, after the pipeline device loads the first source code into the memory of the first testing device, the first testing device begins executing the first source code. After the pipeline device initiates testing of the first source code, it sends a test notification message to the code coverage device, which then sends a code coverage request to the at least one testing device. Therefore, when the first testing device receives the code coverage request, it has already executed a portion of the first source code.
[0094] In step 304, the first test device may add private variables to at least one unexecuted first method included in the first source code and to methods other than the at least one first method in the first source code. In other words, the first test device may add private variables to each method included in the first source code.
[0095] In some embodiments, for each method included in the first source code, in addition to adding a private variable to the method, an assignment statement corresponding to each code statement included in the method is also added to the method. For each code statement, the assignment statement corresponding to the code statement is used to record the execution status of the code statement in the private variable of the method.
[0096] In step 304, for each method in the first source code stored in the memory of the first test device (referred to as a target method for ease of explanation), steps 3041-3042 may be followed to add a private variable of the target method and to add an assignment statement corresponding to each code statement included in the target method. Optionally, the first test device performs the following steps 3041-3042 using a code coverage unit.
[0097] 3041: Declare the private variables of the target method before the first code statement of the target method. The private variables of the target method include elements corresponding to each code statement in the target method.
[0098] For each code statement in the target method, the element corresponding to the code statement in the private variable is used to record the execution status of the code statement, that is, the element corresponding to the code statement is used to record whether the code statement is executed.
[0099] In some embodiments, the declared private variables include each element having a default value, and the element corresponding to the code statement having a default value indicates that the code statement has not been executed.
[0100] In some embodiments, the number of elements included in the declared private variables is equal to the number of code statements included in the target method; or, the number of elements included in the declared private variables is equal to the number of code statements included in the first target class to which the target method belongs.
[0101] The data type of the target method's private variable can be an integer, a character, a Boolean, etc. The target method's private variable can be an array, a linked list, or a graph, etc.
[0102] The class in the first source code shown in Figure 5 includes Method 1, Method 2, and Method 3, totaling nine code statements. For Method 2 in the first source code, the private variable added to Method 2 is a Boolean array. As shown in Figure 6 , the length of the private variable Array is 9, meaning it contains nine elements. Method 2 includes two code statements, and two of the nine elements in the private variable Array correspond to the two code statements.
[0103] For method 3 in the first source code, the private variable added to method 3 is also a Boolean array Array. As shown in Figure 6, the length of the private variable Array is 9. Method 3 includes two code statements, and two of the nine elements in the private variable Array correspond to the two code statements.
[0104] For Method 1 in the first source code, the private variable added to Method 1 is also a Boolean array. As shown in FIG6 , the length of the private variable Array is 9. Method 1 includes five code statements, and five of the nine elements in the private variable Array correspond to the five code statements.
[0105] 3042: Add an assignment statement corresponding to the i-th code statement in the target method, where i = 1, 2, 3, .... The assignment statement is used to set the value of the element corresponding to the i-th code statement to the target value when the i-th code statement is executed. The target value is used to indicate that the i-th code statement is executed.
[0106] In some embodiments, an assignment statement is added after the i-th code statement in the target method, and the assignment statement is located between the i-th code statement and the (i+1)-th code statement.
[0107] In some embodiments, when the data type of the private variable of the target method is an integer, the default value and the target value are two integer values, for example, the default value is 0 and the target value is 1; or the default value is 1 and the target value is 0, etc. Or,
[0108] When the data type of the private variable of the target method is character type, the default value and target value are two characters, for example, the default value is a and the target value is b; or the default value is c and the target value is d, etc. Or,
[0109] When the data type of the private variable of the target method is Boolean, the default value and the target value are two Boolean values, for example, the default value is false and the target value is true; or, the default value is true and the target value is false, etc.
[0110] In some embodiments, the assignment statement is used to set the value of the j-th element of the private variable of the target method to the target value, where j is obtained based on the ith code statement, and the j-th element is the element corresponding to the ith code statement.
[0111] In some embodiments, the number of elements included in the private variables of the target method is equal to the number of code statements included in the target method, i=j, that is, the element corresponding to the i-th code statement in the target method is the i-th element of the private variable in the target method.
[0112] In some embodiments, the number of elements included in the private variables of the target method is equal to the number of code statements included in the first target class to which the target method belongs. Based on i, the order of the target method in the first target class, the identification information of the start code statement and the identification information of the end code statement of the target method, j is determined. j is the actual serial number of the i-th code statement in the target method in the first target class. That is, the i-th code statement in the target method is actually the j-th code statement in the first target class, and the element corresponding to the i-th code statement in the target method is the j-th element of the private variable in the target method.
[0113] In some embodiments, each method of the first target class is stored in the same storage area in the memory of the first test device, but the methods of the first target class are stored out of order in the storage area. The i-th code statement in the target method is actually the j-th code statement stored in the storage area, and the element corresponding to the i-th code statement in the target method is the j-th element of a private variable in the target method.
[0114] For example, referring to Figure 5 , the three methods included in the first target class are stored in the same storage area in the memory of the first test device. The three methods are stored in the order of Method 2, Method 3, and Method 1 in this storage area. Method 2 includes two code statements, as shown in Figure 6 . The first code statement is the first code statement stored in this storage area. After the first code statement, assignment statement 1 is added. Assignment statement 1 is used to set the value of the first element included in Method 2's private variable to the target value "true." The second code statement is the second code statement stored in this storage area. After the second code statement, assignment statement 2 is added. Assignment statement 2 is used to set the value of the second element included in Method 2's private variable to the target value "true."
[0115] Still referring to Figure 6 , Method 3 includes two code statements. The first code statement is the third code statement stored in the storage area. After the first code statement, assignment statement 3 is added. Assignment statement 3 is used to set the value of the third element of Method 3's private variable to the target value "true." The second code statement is the fourth code statement stored in the storage area. After the second code statement, assignment statement 4 is added. Assignment statement 4 is used to set the value of the fourth element of Method 3's private variable to the target value "true."
[0116] Also referring to Figure 6, Method 1 includes five code statements, the i-th code statement is the i+4-th code statement saved in the storage area, that is, j=i+4, i=1, 2, 3, 4, 5, and an assignment statement is added after the i-th code statement. The assignment statement is used to set the value of the i+4-th element included in the private variable of Method 1 to the target value "true".
[0117] For any code statement in the first source code, when the code statement is executed, the assignment statement following the code statement will also be executed.
[0118] In some embodiments, since the first test device immediately adds private variables to the at least one first method upon receiving the code coverage request, the time when the code coverage request is received is substantially the same as the time when the private variables are started to be added to the at least one first method.
[0119] In some embodiments, when the first test device receives a code coverage request (or adds a private variable to the at least one first method), the first test device is executing a second method in the first source code, obtains thread stack frame information of the second method, and the thread stack frame information is used to record the execution status of each code statement in the second method. The executed code statement in the second method is determined based on the thread stack frame information.
[0120] When executing the second method, the first test device records thread stack frame information for the second method. Optionally, the thread stack frame information includes identification information of code statements executed in the second method and / or identification information of code statements not executed in the second method. After the first test device completes executing the second method, the first test device obtains the thread stack frame information for the second method and determines the executed code statements in the second method based on the thread stack frame information.
[0121] In some embodiments, when the first test device receives a code coverage request (or adds a private variable to the at least one first method), the first test device has already executed one or more static code blocks in the first source code. For ease of explanation, the static code blocks that have been executed by the first test device are referred to as first static code blocks. When executing the first static code block, the first test device executes each code statement in the first static code block. Thus, when the first test device receives a code coverage request, it determines that each code statement in the first static code block has been executed.
[0122] In some embodiments, when the first test device receives a code coverage request (or adds a private variable to the at least one first method), the first test device has already executed one or more classes in the first source code. Some of the one or more classes may include a constructor, and some may include multiple constructors. For ease of explanation, the class including a constructor is referred to as the second target class. When executing the second target class, the first test device executes each code statement in the constructor included in the second target class. In this way, when the first test device receives the code coverage request, it determines that each code statement included in the constructor in the second target class is executed.
[0123] For a class including multiple constructors, the first test device may execute some of the constructors in the class when executing the class. Therefore, for the executed class including multiple constructors, the first test device cannot determine which constructors in the class are executed.
[0124] In some embodiments, after loading the first source code into the at least one test device, the pipeline device further sends the at least one test case to the test management device, which receives the at least one test case. The test management device can then schedule the at least one test device and send the first test case to the at least one test device. The at least one test device tests the first source code using the first test case, where the at least one test case includes the first test case.
[0125] In some embodiments, after the pipeline device loads the first source code into the at least one test device, it sends a first test case to the at least one test device. The at least one test device tests the first source code using the first test case. The at least one test case includes the first test case.
[0126] In the process of steps 301-304 described above, the code coverage device subscribes to the testing service on the pipeline device. When the pipeline device initiates testing of the first source code using this testing service, it notifies the code coverage device, which then sends a code coverage request to the at least one testing device. Upon receiving the code coverage request, the first testing device adds a private variable to the method included in the first source code. Optionally, this process takes a short time and may be completed before the first testing device receives the first test case. That is, the first testing device completes step 304 by the time it receives the first test case and uses it to test the first source code. Alternatively, the process may be completed after the first testing device receives the first test case, but because it takes a short time, the first testing device completes step 304 shortly after it begins testing the first source code using the first test case.
[0127] Step 305: After the first test device completes testing the first source code using the first test case, it obtains first code coverage information based on the private variables in the at least one first method, where the first code coverage information is used to describe the code statements executed in the at least one first method.
[0128] In step 305, the first test device determines the executed code statements and / or unexecuted code statements in each first method based on the values of each element included in the private variables in each first method, and obtains first code coverage information based on the executed code statements and / or unexecuted code statements in each first method.
[0129] For each first method, and for each code statement in the first method, the value of the element corresponding to the code statement is obtained from the private variable of the first method. If the value of the element corresponding to the code statement is the target value, it indicates that the code statement is executed; or, if the value of the element corresponding to the code statement is the default value, it indicates that the code statement is not executed.
[0130] In some embodiments, the first code coverage information includes identification information of executed code statements in the first source code and / or identification information of unexecuted code statements in the first source code.
[0131] In some embodiments, the number of elements included in the private variable of the first method is equal to the number of code statements included in the first method, and the element corresponding to the i-th code statement in the first method is the i-th element of the private variable in the first method.
[0132] In some embodiments, the number of elements included in the private variable of the first method is equal to the number of code statements included in the first target class to which the first method belongs. The actual serial number of the i-th code statement in the first method in the first target class is j. The i-th code statement in the first method is actually the j-th code statement in the first target class. The element corresponding to the i-th code statement in the first method is the j-th element of the private variable in the first method. At this time, the values of the elements included in the private variables of each first method are obtained; based on the values of the elements included in the private variables of each first method, the first code coverage information is obtained. Optionally, during implementation:
[0133] Based on the first correspondence in the index file and the identification information of the first target class, each first method in the first target class is obtained. Based on the values of each element included in the private variable of each first method in the first target class, code coverage information corresponding to the first target class is obtained. In the above manner, code coverage information corresponding to each category in the first source code is obtained, and the code coverage information corresponding to each category in the first source code is combined into first code coverage information.
[0134] In some embodiments, the number of elements included in the private variables of the first method is equal to the number of code statements included in the first target class to which the first method belongs. For the storage area in the memory of the first test device used to store each method included in the first target class, the i-th code statement of the first method is the j-th code statement stored in the storage area, and the element corresponding to the i-th code statement in the first method is the j-th element of the private variable in the first method. At this time, the values of the elements included in the private variables of each first method are obtained; based on the values of the elements included in the private variables of each first method, the order of each first method, the identification information of the starting code statement and the identification information of the ending code statement in each first method, the first code coverage information is obtained. Optionally, during implementation:
[0135] Based on the first correspondence in the index file and the identification information of the first target class, the identification information of each first method in the first target class is obtained. Based on the second correspondence in the index file and the identification information of each first method in the first target class, the order of each first method in the first target class and the identification information of the start code statement and the identification information of the end code statement of each first method in the first target class are obtained. Based on the values of the elements included in the private variables of each first method in the first target class, the order of each first method in the first target class, the identification information of the start code statement and the identification information of the end code statement in each first method in the first target class, the code coverage information corresponding to the first target class is obtained. In the above manner, the code coverage information corresponding to each category in the first source code is obtained, and the code coverage information corresponding to each category in the first source code is combined into the first code coverage information.
[0136] In some embodiments, the first code coverage information is further used to describe the code statements executed in the second method. And / or, the first code coverage information is further used to describe each code statement in the first static code block. And / or, the first code coverage information is further used to describe each code statement in the constructor of the second target class.
[0137] Step 306: The first test device sends first code coverage information to the code coverage device.
[0138] In some embodiments, the at least one test device includes a test device, which is a first test device. The first test device uses a first test case to test the entire first source code. The first code coverage information is the overall code coverage information corresponding to the first source code. The first code coverage information is also the overall code coverage information corresponding to the first test case.
[0139] In some embodiments, the at least one test device includes multiple test devices, each of the multiple test devices tests a portion of the first source code, that is, the first test device tests a portion of the first source code, and the first code coverage information is used to describe the code statements executed in the portion. Like the first test device, other test devices also obtain code coverage information corresponding to the portion of the content they test. For example, the second test device obtains second code coverage information, and the second code coverage information is used to describe the code statements executed in the portion of the content tested by the second test device, and sends the second code coverage information to the code coverage device. The first code coverage information and the second code coverage information are also code coverage information corresponding to the first test case.
[0140] In some embodiments, after testing the first source code using the first test case, the pipeline device may also send a second test case to the at least one test device, or the test management device may also send a second test case to the at least one test device, where the second test case is a test case other than the first test case in the at least one test case.
[0141] That is, upon receiving the second test case, the first test device uses the second test case to test the first source code, i.e., executes the first source code using the second test case. After completing the testing of the first source code using the second test case, the first test device obtains third code coverage information based on the private variables in each method included in the first source code. The third code coverage information describes the executed code statements in the first source code, and transmits the third code coverage information to the code coverage device.
[0142] Step 307: The code coverage device receives the first code coverage information, and displays a first code coverage result based on the first code coverage information. The first code coverage result includes a code coverage rate of the first source code.
[0143] If the at least one test device includes multiple test devices, a first test device tests a portion of the first source code, and the first code coverage information describes the code statements executed in the portion. The code coverage device receives the code coverage information sent by the multiple test devices and, based on the code coverage information sent by the multiple test devices, obtains overall code coverage information corresponding to the first source code. If the at least one test device includes one test device, and the one test device is the first test device, the first test device tests the entire first source code, and the first code coverage information sent by the first test device is overall code coverage information corresponding to the first source code.
[0144] The code coverage device displays a first code coverage result based on the overall code coverage information, where the first code coverage result includes a code coverage rate of the first source code.
[0145] As shown in Figure 7, after the pipeline platform completes testing the first source code on the at least one test device for the remaining source code in the code repository, it retrieves the second source code from the remaining source code in the code repository, loads the second source code into the at least one test device, and then tests the second source code using the at least one test device. This allows the source code in the code repository to be tested one by one, forming a pipeline testing model.
[0146] In some embodiments, the code coverage device further obtains code coverage information corresponding to a difference between the second source code and the first source code based on the change information and the overall code coverage information, where the first source code and the second source code are source codes of two versions of the first service, and the version of the second source code is earlier than the version of the first source code. Based on the code coverage information corresponding to the difference, a code coverage result for the difference is displayed, where the code coverage result for the difference includes a code coverage rate for the difference.
[0147] The change information is included in the pipeline details information of the first source code. The pipeline details information of the first source code also includes the storage address of the first source code in the code repository. Thus, the code coverage device retrieves the first source code from the code repository based on the storage address of the first source code. Based on the change information and the first source code, the device retrieves identification information of the start code statement and the end code statement of the difference portion.
[0148] Based on the overall code coverage information corresponding to the first source code and the identification information of the start code statement and the identification information of the end code statement in the difference portion, code coverage information corresponding to the difference portion between the second source code and the first source code is obtained. Based on the code coverage information corresponding to the difference portion, a code coverage result for the difference portion is displayed, where the code coverage result for the difference portion includes a code coverage rate for the difference portion.
[0149] In some embodiments, the code coverage device may display code coverage information corresponding to the difference between the second source code and the first source code, and / or overall code coverage information corresponding to the first source code.
[0150] In some embodiments, the code coverage device obtains the difference portion based on the change information and the first source code. The device obtains at least one component included in the difference portion. The device obtains code coverage information corresponding to each component based on the code coverage information corresponding to the difference portion. The code coverage information corresponding to the component is used to describe the code statements executed in the component. The device displays a code coverage result for each component based on the code coverage information corresponding to the component. The code coverage result for the component includes the code coverage rate of the component.
[0151] Optionally, an abstract syntax tree (AST) of the difference portion is generated based on the difference portion, and at least one component included in the difference portion is obtained based on the AST of the difference portion.
[0152] The at least one component includes one or more of the following: at least one branch in the difference portion, at least one method in the difference portion, or at least one class in the difference portion.
[0153] In some embodiments, the code coverage device may display code coverage information corresponding to each component.
[0154] In some embodiments, the code coverage device obtains at least one component included in the first source code, obtains code coverage information corresponding to each component included in the first source code based on the overall code coverage information, and displays a code coverage result for each component included in the first source code based on the code coverage information corresponding to each component included in the first source code.
[0155] In some embodiments, the overall code coverage information corresponding to the first source code is the overall code coverage information corresponding to the first test case. The at least one test device also sends the code coverage information corresponding to the second test case to the code coverage device. In other words, the code coverage device continues to obtain the overall code coverage information corresponding to the second test case. The code coverage device can obtain overall code coverage information corresponding to different test cases.
[0156] In some embodiments, when the code coverage information includes identification information of at least one test case, the at least one test device sends code coverage information corresponding to each test case in the at least one test case to the code coverage device based on the identification information of each test case. Based on the code coverage information corresponding to each test case, a second code coverage result is displayed, where the second code coverage result includes the code coverage rate when the first source code executes each test case.
[0157] In some embodiments, the code coverage information may be displayed at the granularity of a test case, that is, the overall code coverage information corresponding to different test cases may be displayed.
[0158] The first source code is the source code of the first service. The overall code coverage information corresponding to the first source code can also be referred to as the overall code coverage information corresponding to the first service.
[0159] The code repository may also include source code for other services, and the overall code coverage information corresponding to other services can be obtained through the process of steps 301-307 above.
[0160] The multiple services in the code repository can be divided into at least one service group, each of which includes one or more services. For each service group, after obtaining the overall code coverage information corresponding to each service in the service group, the overall code coverage information corresponding to the service group is obtained based on the overall code coverage information corresponding to each service in the service group. The code coverage rate corresponding to the service group is displayed based on the overall code coverage information corresponding to the service group. Optionally, the overall code coverage information corresponding to the service group can also be displayed.
[0161] The services in the at least one service group may belong to a cloud service. Optionally, each service in the at least one service group is a microservice in the cloud service. Based on the overall code coverage information corresponding to each service group in the cloud service, the overall code coverage information corresponding to the cloud service is obtained. Based on the overall code coverage information corresponding to the cloud service, the code coverage rate corresponding to the cloud service is displayed. Optionally, the overall code coverage information corresponding to the cloud service can be displayed.
[0162] The code coverage device uses different granularities to display code coverage or code coverage information, which can meet the user's display needs for different granularities.
[0163] In an embodiment of the present application, after the pipeline device loads the first source code into the memory of the first test device, the first test device receives a code coverage request from the code coverage device. Based on the code coverage request, a private variable is added to a method included in the first source code. The private variable includes an element corresponding to each code statement in the method. For each code statement in the method, an assignment statement is added after the code statement. The assignment statement is used to set the value of the element corresponding to the code statement to a target value when the code statement is executed. The target value is used to indicate that the code statement has been executed. After testing the first source code, first code coverage information can be obtained based on the private variables of each method in the first source code. In this way, variables and assignment statements can be added to the first source code after the first source code has been launched on the first test device, eliminating the need to add variables and assignment statements while loading the first source code to the first test device. This eliminates the need to modify the command that launches the test of the first source code, and the user is unaware of the code coverage information acquisition process, achieving automatic code coverage information acquisition. This reduces labor costs, reduces the cost of maintaining the code testing platform, and increases the flexibility of users in using the automated code testing platform.
[0164] Referring to FIG8 , an embodiment of the present application provides an apparatus 800 for processing source code. The apparatus 800 is deployed on the code testing platform 100 shown in FIG1 or FIG2 , or on the code testing platform applied to the method 300 shown in FIG3 . The apparatus 800 is used to test a first source code using a first test case, and the apparatus 800 includes:
[0165] The receiving unit 801 is configured to receive an instruction for starting a code test, where the instruction for starting a code test is used to instruct the apparatus 800 to start a test on a first source code;
[0166] Processing unit 802 is configured to add a private variable to at least one first method included in the first source code, where the at least one first method is an unexecuted method in the first source code, and the private variable in the first method is used to record the execution status of each code statement in the first method during execution of the first method;
[0167] The processing unit 802 is further configured to obtain first code coverage information based on the private variables in the at least one first method after testing the first source code using the first test case, where the first code coverage information is used to describe execution status of code statements in the at least one first method;
[0168] The processing unit 802 is further configured to display a first code coverage result based on the first code coverage information, where the first code coverage result includes a code coverage rate of the first source code.
[0169] Optionally, the detailed implementation process of the receiving unit 801 receiving the instruction for the boot code test can be found in the relevant content of step 301 of the method 300 shown in FIG3 , and will not be described in detail here.
[0170] Optionally, the detailed implementation process of the processing unit 802 adding a private variable to at least one first method included in the first source code refers to the relevant content of step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0171] Optionally, for a detailed implementation process of the processing unit 802 obtaining the first code coverage information based on the private variables in the at least one first method, please refer to the relevant content of step 305 of the method 300 shown in Figure 3, which will not be described in detail here.
[0172] Optionally, for a detailed implementation process of the processing unit 802 obtaining the first code coverage information based on the private variables in the at least one first method, please refer to the relevant content of step 307 of the method 300 shown in Figure 3, which will not be described in detail here.
[0173] Optionally, the first source code further includes a second method, where the second method is a method being executed when a private variable is added to the at least one first method. The processing unit 802 is further configured to:
[0174] Obtain thread stack frame information of the second method, where the thread stack frame information is used to record the execution status of each code statement in the second method;
[0175] The executed code statements in the second method are determined based on the thread stack frame information, and the first code coverage information is further used to describe the execution status of the code statements in the second method.
[0176] Optionally, the detailed implementation process of the processing unit 802 obtaining the thread stack frame information of the second method refers to the relevant content of step 3042 of the method 300 shown in FIG3 , which will not be described in detail here.
[0177] Optionally, the detailed implementation process of the processing unit 802 determining the code statement to be executed in the second method based on the thread stack frame information can be found in the relevant content of step 3042 of the method 300 shown in FIG3 , which will not be described in detail here.
[0178] Optionally, the first code coverage information is also used to describe the execution status of each code statement in the first static code block, where the first static code block is a static code block that has been executed in the first source code before private variables are added in the at least one first method, and each code statement in the first static code block is executed.
[0179] Optionally, the first code coverage information is also used to describe the execution status of each code statement in the constructor of the target class, where the target class is a class including a constructor that has been executed in the first source code before private variables are added to the at least one first method, and each code statement in the constructor of the target class is executed.
[0180] Optionally, the private variables of the first method include an element corresponding to each code statement in the first method. The processing unit 802 is further configured to:
[0181] Add an assignment statement corresponding to the i-th code statement in the first method, i = 1, 2, 3, ..., the assignment statement is used to set the value of the element corresponding to the i-th code statement to the target value when the i-th code statement is executed, and the target value is used to indicate that the i-th code statement is executed.
[0182] Optionally, the detailed implementation process of the processing unit 802 adding an assignment statement corresponding to the i-th code statement in the first method can be found in the relevant content of step 3042 of the method 300 shown in FIG3 , which will not be described in detail here.
[0183] Optionally, the first code coverage information includes identification information of at least one code statement executed in the first method. The processing unit 802 is configured to:
[0184] Obtaining the order of each first method in the first source code and identification information of a start code statement and identification information of an end code statement in each first method;
[0185] Get the value of each element included in the private variable of each first method;
[0186] First code coverage information is obtained based on the values of the elements included in the private variables of each first method, the order of each first method, and the identification information of the start code statement and the identification information of the end code statement in each first method.
[0187] Optionally, the detailed implementation process of the processing unit 802 obtaining the order of each first method in the first source code and the identification information of the starting code statement and the identification information of the ending code statement in each first method can be found in the relevant content of step 305 of the method 300 shown in Figure 3, which will not be described in detail here.
[0188] Optionally, the detailed implementation process of the processing unit 802 obtaining the values of each element included in the private variable of each first method can be found in the relevant content of step 305 of the method 300 shown in FIG3 , which will not be described in detail here.
[0189] Optionally, the detailed implementation process of the processing unit 802 obtaining the first code coverage information refers to the relevant content of step 305 of the method 300 shown in Figure 3, which will not be described in detail here.
[0190] Optionally, the apparatus 800 further includes a first test device and a second test device, the first source code includes a first part and a second part, the first test device is used to test the first part using a first test case, and the second test device is used to test the second part using the first test case, the first code coverage information is used to describe execution status of code statements in the first part, and the processing unit 802 is further used to:
[0191] adding a second private variable in at least one third method included in the first source code in the second test device, where the at least one third method is a method that is not executed in the first source code in the second test device;
[0192] When the second test device completes testing the first source code using the first test case, second code coverage information is obtained based on the private variables in the third method included in the second part, where the second code coverage information is used to describe execution status of code statements in the second part;
[0193] Obtaining overall code coverage information corresponding to the first source code based on the first code coverage information and the second code coverage information;
[0194] Based on the overall code coverage information, a first code coverage result is displayed.
[0195] Optionally, the detailed implementation process of the processing unit 802 adding the second private variable to at least one third method included in the first source code in the second test device can be found in the relevant content of step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0196] Optionally, the detailed implementation process of the processing unit 802 obtaining the second code coverage information refers to the relevant content of step 306 of the method 300 shown in Figure 3, which will not be described in detail here.
[0197] Optionally, the detailed implementation process of the processing unit 802 obtaining the overall code coverage information corresponding to the first source code refers to the relevant content of step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0198] Optionally, the detailed implementation process of the processing unit 802 displaying the first code coverage result can be found in the relevant content of step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0199] Optionally, the processing unit 802 is further configured to add a private variable to a method other than the at least one first method in the first source code.
[0200] Optionally, the code coverage rate included in the first code coverage result is the code coverage rate when the first source code executes the first test case. The apparatus 800 is further configured to test the first source code using a second test case after testing the first source code using the first test case. The processing unit 802 is further configured to:
[0201] After the first source code is tested using the second test case, third code coverage information is obtained based on private variables in each method included in the first source code, where the third code coverage information is used to describe execution status of code statements in the first source code;
[0202] Based on the first code coverage information and the third code coverage information, a second code coverage result is displayed, where the second code coverage result includes code coverage when the first source code executes the first test case and the second test case.
[0203] Optionally, the detailed implementation process of the processing unit 802 obtaining the third code coverage information refers to the relevant content of step 307 of the method 300 shown in Figure 3, which is not described in detail here.
[0204] Optionally, the detailed implementation process of the processing unit 802 displaying the second code coverage result can be found in the relevant content of step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0205] Optionally, the processing unit 802 is further configured to:
[0206] Obtaining change information, where the change information is used to describe differences between a second source code and a first source code, where the first source code and the second source code are two versions of source code for the same service, and the version of the second source code is earlier than the version of the first source code;
[0207] Acquire code coverage information corresponding to the difference portion based on the change information and the first code coverage information, where the code coverage information corresponding to the difference portion is used to describe execution status of code statements in the difference portion;
[0208] The code coverage result of the difference part is displayed based on the code coverage information corresponding to the difference part, and the code coverage result of the difference part includes the code coverage rate of the difference part.
[0209] Optionally, the detailed implementation process of the processing unit 802 obtaining the change information refers to the relevant content of step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0210] Optionally, the detailed implementation process of the processing unit 802 obtaining the code coverage information corresponding to the difference part can be found in the relevant content of step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0211] Optionally, the detailed implementation process of the processing unit 802 displaying the code coverage result of the difference part can be found in the relevant content of step 307 of the method 300 shown in Figure 3, which will not be described in detail here.
[0212] Optionally, the processing unit 802 is further configured to:
[0213] obtaining at least one component included in the difference portion;
[0214] For each component, obtaining code coverage information corresponding to the component based on the code coverage information corresponding to the difference part, where the code coverage information corresponding to the component is used to describe the execution status of the code statements in the component;
[0215] The code coverage result of the component is displayed based on the code coverage information corresponding to the component, where the code coverage result of the component includes the code coverage rate of the component.
[0216] Optionally, the detailed implementation process of the processing unit 802 obtaining at least one component included in the difference part can be found in the relevant content of step 307 of the method 300 shown in FIG3 , and will not be described in detail here.
[0217] Optionally, the detailed implementation process of the processing unit 802 obtaining the code coverage information corresponding to the component can be found in the relevant content of step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0218] Optionally, the detailed implementation process of the processing unit 802 displaying the code coverage result of the component can be found in the relevant content of step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0219] Optionally, the at least one component includes one or more of the following: at least one branch in the difference portion, at least one method in the difference portion, or at least one class in the difference portion.
[0220] The processing unit 802 and the receiving unit 801 can be implemented by software or hardware. For example, the implementation of the processing unit 802 is described below using the processing unit 802 as an example. Similarly, the implementation of the receiving unit 801 can refer to the implementation of the processing unit 802.
[0221] As an example of a software functional unit, the processing unit 802 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the processing unit 802 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.
[0222] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.
[0223] As an example of a hardware functional unit, the processing unit 802 may include at least one computing device, such as a server. Alternatively, the processing unit 802 may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0224] The multiple computing devices included in processing unit 802 can be distributed in the same region or in different regions. The multiple computing devices included in processing unit 802 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in processing unit 802 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.
[0225] It should be noted that, in other embodiments, the processing unit 802 can be used to execute any step of the method provided in any of the above embodiments, and the receiving unit 801 can be used to execute any receiving step of the method provided in any of the above embodiments. The steps that the processing unit 802 and the receiving unit 801 are responsible for implementing can be specified as needed. By having the processing unit 802 and the receiving unit 801 respectively implement different steps of the method provided in any of the above embodiments, the full functionality of the apparatus 800 for processing source code can be achieved.
[0226] In an embodiment of the present application, when the receiving unit receives an instruction to start code testing, the processing unit starts testing the first source code. After starting the test of the first source code, the processing unit adds a private variable to at least one first method that is not executed in the first source code. When the first source code is tested using the first test case, the processing unit obtains first code coverage information based on the private variables in the at least one first method, and displays the code coverage rate of the first source code based on the first code coverage information. Since the processing unit adds private variables to the at least one first method that is not executed only after starting the test of the first source code, there is no need to modify the instruction to start code testing. After starting the test of the first source code, private variables are automatically added to the unexecuted method in the first source code, and the user does not perceive the entire process of obtaining the first code coverage information. This achieves automatic acquisition of code coverage, saves costs, reduces the cost of maintaining the code testing platform, and increases the flexibility of users in using the automated code testing platform.
[0227] 9 , an embodiment of the present application provides a computing device 900. For example, the computing device 900 may be the device in the code testing platform 100 shown in FIG. 1 or 2 , or the computing device in the code testing platform to which the method 300 shown in FIG. 3 is applied.
[0228] As shown in Figure 9, computing device 900 includes a bus 902, a processor 904, a memory 906, and a communication interface 908. Processor 904, memory 906, and communication interface 908 communicate with each other via bus 902. Computing device 900 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 900.
[0229] Bus 902 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG9 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 904 may include a path for transmitting information between various components of computing device 900 (e.g., memory 906, processor 904, and communication interface 908).
[0230] The processor 904 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0231] The memory 906 may include volatile memory, such as random access memory (RAM). The processor 904 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0232] Referring to FIG9 , the memory 906 stores executable program code, and the processor 904 executes the executable program code to respectively implement the functions of the receiving unit 801 and the processing unit 802 in the apparatus 800 shown in FIG8 , thereby implementing the method provided by any of the above embodiments. In other words, the memory 906 stores instructions for executing the method provided by any of the above embodiments. Alternatively,
[0233] The communication interface 908 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 900 and other devices or a communication network.
[0234] Embodiments of the present application also provide a source code processing cluster. The source code processing cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0235] As shown in Figure 10, the source code processing cluster includes at least one computing device 900. The memory 906 of one or more computing devices 900 in the source code processing cluster may store the same instructions for executing the method provided in any of the above embodiments.
[0236] In some possible implementations, the memory 906 of one or more computing devices 900 in the source code processing cluster may also store partial instructions for executing the above-described method for processing source code. In other words, a combination of one or more computing devices 900 can collectively execute instructions for executing the method provided in any of the above-described embodiments.
[0237] In some possible implementations, one or more computing devices in a cluster processing source code can be connected via a network. The network can be a wide area network (WAN) or a local area network (LAN), among others. FIG. 11 illustrates a possible implementation. As shown in FIG. 11 , two computing devices 900A and 900B are connected via a network. Specifically, each computing device is connected to the network via a communication interface within the computing device.
[0238] In this type of possible implementation, the memory 906 in the computing device 900A stores instructions for executing the functions of the processing unit 802 in the embodiment shown in Figure 8. Simultaneously, the memory 906 in the computing device 900B stores instructions for executing the functions of the receiving unit 801 in the embodiment shown in Figure 8.
[0239] It should be understood that the functionality of the computing device 900A shown in FIG11 may also be implemented by multiple computing devices 900. Similarly, the functionality of the computing device 900B may also be implemented by multiple computing devices 900.
[0240] Embodiments of the present application also provide another source code processing cluster. The connection relationship between the computing devices in this data processing cluster can be similar to the connection method of the source code processing cluster described in Figure 11. The difference is that the memory 906 of one or more computing devices 900 in this source code processing cluster can store the same instructions for executing the method provided in any of the above embodiments.
[0241] In some possible implementations, the memory 906 of one or more computing devices 900 in the source code processing cluster may also store partial instructions for executing the method provided in any of the above embodiments. In other words, a combination of one or more computing devices 900 can jointly execute instructions for executing the method provided in any of the above embodiments.
[0242] The present application also provides a computer program product comprising instructions. The computer program product may be software or a program product comprising instructions that can be run on a computing device or stored on any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the method provided in any of the above embodiments.
[0243] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the method provided in any of the above embodiments.
[0244] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0245] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for processing source code, characterized in that: The method is applied to a code testing platform, the code testing platform is used to test a first source code using a first test case, and the method includes: receiving an instruction for starting a code test, wherein the instruction for starting a code test is used to instruct the code testing platform to start a test on the first source code; adding a private variable to at least one first method included in the first source code, wherein the at least one first method is a method that is not executed in the first source code, and the private variable in the first method is used to record the execution status of each code statement in the first method when the first method is executed; After the first source code is tested using the first test case, first code coverage information is obtained based on the private variables in the at least one first method, where the first code coverage information is used to describe the execution status of code statements in the at least one first method; Based on the first code coverage information, a first code coverage result is displayed, where the first code coverage result includes a code coverage rate of the first source code.
2. The method according to claim 1, characterized in that The first source code further includes a second method, which is a method being executed when the private variable is added in the at least one first method, and the method further includes: Obtaining thread stack frame information of the second method, where the thread stack frame information is used to record the execution status of each code statement in the second method; The code statements executed in the second method are determined based on the thread stack frame information, and the first code coverage information is also used to describe the execution status of the code statements in the second method.
3. The method according to claim 1 or 2, characterized in that The first code coverage information is also used to describe the execution status of each code statement in the first static code block, where the first static code block is a static code block that has been executed in the first source code before the private variable is added in the at least one first method, and each code statement in the first static code block is executed.
4. The method according to any one of claims 1 to 3, characterized in that: The first code coverage information is also used to describe the execution status of each code statement in the constructor of the target class, where the target class is a class including a constructor that has been executed in the first source code before the private variable is added to the at least one first method, and each code statement in the constructor of the target class is executed.
5. The method according to any one of claims 1 to 4, characterized in that: The private variables of the first method include elements corresponding to each code statement in the first method, and after adding private variables to at least one first method included in the first source code, the method further includes: Add an assignment statement corresponding to the i-th code statement in the first method, i=1, 2, 3, ..., the assignment statement is used to set the value of the element corresponding to the i-th code statement to a target value when the i-th code statement is executed, and the target value is used to indicate that the i-th code statement is executed.
6. The method according to any one of claims 1 to 5, characterized in that: The first code coverage information includes identification information of code statements executed in the at least one first method, and the method further includes: Acquire the order of each first method in the first source code and identification information of a start code statement and identification information of an end code statement in each first method; The obtaining first code coverage information based on the private variables in the at least one first method includes: Obtaining the value of each element included in the private variable of each first method; The first code coverage information is obtained based on the values of each element included in the private variable of each first method, the order of each first method, and the identification information of the start code statement and the identification information of the end code statement in each first method.
7. The method according to any one of claims 1 to 6, characterized in that: The code testing platform includes a first testing device and a second testing device, the first source code includes a first part and a second part, the first testing device is used to test the first part using the first test case, the second testing device is used to test the second part using the first test case, the first code coverage information is used to describe the execution status of the code statements in the first part, and the method further includes: adding a second private variable to at least one third method included in the first source code in the second test device, wherein the at least one a third method which is a method not executed in the first source code in the second test device; When the second test device completes testing the first source code using the first test case, obtaining second code coverage information based on private variables in a third method included in the second part, wherein the second code coverage information is used to describe execution conditions of code statements in the second part; The displaying of the first code coverage result based on the first code coverage information includes: Acquire overall code coverage information corresponding to the first source code based on the first code coverage information and the second code coverage information; Based on the overall code coverage information, the first code coverage result is displayed.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: A private variable is added to a method other than the at least one first method in the first source code.
9. The method according to claim 8, characterized in that The code coverage rate included in the first code coverage result is the code coverage rate when the first source code executes the first test case, the code testing platform is further used to test the first source code using a second test case after the first source code is tested using the first test case, and the method further includes: When the first source code is tested using the second test case, third code coverage information is obtained based on private variables in each method included in the first source code, where the third code coverage information is used to describe execution status of code statements in the first source code; Based on the first code coverage information and the third code coverage information, a second code coverage result is displayed, where the second code coverage result includes the code coverage rate when the first source code executes the first test case and the second test case.
10. The method according to any one of claims 1 to 9, characterized in that: The method further comprises: Acquire change information, where the change information is used to describe a difference between a second source code and the first source code, where the first source code and the second source code are two versions of source code for the same service, and a version of the second source code is earlier than a version of the first source code; Acquire code coverage information corresponding to the difference part based on the change information and the first code coverage information, where the code coverage information corresponding to the difference part is used to describe the execution status of the code statements in the difference part; The code coverage result of the difference part is displayed based on the code coverage information corresponding to the difference part, and the code coverage result of the difference part includes the code coverage rate of the difference part.
11. The method according to claim 10, characterized in that The method further comprises: Acquire at least one component included in the difference portion; For each component, based on the code coverage information corresponding to the difference part, the code coverage information corresponding to the component is obtained, where the code coverage information corresponding to the component is used to describe the execution status of the code statements in the component; The code coverage result of the component is displayed based on the code coverage information corresponding to the component, and the code coverage result of the component includes the code coverage rate of the component.
12. The method according to claim 11, characterized in that The at least one component includes one or more of the following: at least one branch in the difference portion, at least one method in the difference portion, or at least one class in the difference portion.
13. A device for processing source code, characterized in that: The device is used to test a first source code using a first test case, and the device includes: a receiving unit, configured to receive an instruction for starting a code test, wherein the instruction for starting a code test is used to instruct the device to start a test on the first source code; a processing unit, configured to add a private variable in at least one first method included in the first source code, wherein the at least one first method is a method that is not executed in the first source code, and the private variable in the first method is used to record the execution status of each code statement in the first method when the first method is executed; The processing unit is further configured to obtain first code coverage information based on the private variables in the at least one first method when the first source code is tested using the first test case, wherein the first code coverage information is used to describe the execution status of code statements in the at least one first method; The processing unit is further configured to display a first code coverage result based on the first code coverage information, where the first code coverage result includes a code coverage rate of the first source code.
14. The device according to claim 13, characterized in that The first source code further includes a second method, which is a method being executed when the private variable is added in the at least one first method, and the processing unit is further configured to: Obtaining thread stack frame information of the second method, where the thread stack frame information is used to record the execution status of each code statement in the second method; The code statements executed in the second method are determined based on the thread stack frame information, and the first code coverage information is also used to describe the execution status of the code statements in the second method.
15. The device according to claim 13 or 14, characterized in that The first code coverage information is also used to describe the execution status of each code statement in the first static code block, where the first static code block is a static code block that has been executed in the first source code before the private variable is added in the at least one first method, and each code statement in the first static code block is executed.
16. The device according to any one of claims 13 to 15, characterized in that The first code coverage information is also used to describe the execution status of each code statement in the constructor of the target class, where the target class is a class including a constructor that has been executed in the first source code before the private variable is added to the at least one first method, and each code statement in the constructor of the target class is executed.
17. The device according to any one of claims 13 to 16, characterized in that: The private variables of the first method include elements corresponding to each code statement in the first method, and the processing unit is further used for: Add an assignment statement corresponding to the i-th code statement in the first method, i=1, 2, 3, ..., the assignment statement is used to set the value of the element corresponding to the i-th code statement to a target value when the i-th code statement is executed, and the target value is used to indicate that the i-th code statement is executed.
18. The device according to any one of claims 13 to 17, characterized in that: The first code coverage information includes identification information of code statements executed in the at least one first method, and the processing unit is configured to: Acquire the order of each first method in the first source code and identification information of a start code statement and identification information of an end code statement in each first method; Obtaining the value of each element included in the private variable of each first method; The first code coverage information is obtained based on the values of each element included in the private variable of each first method, the order of each first method, and the identification information of the start code statement and the identification information of the end code statement in each first method.
19. The device according to any one of claims 13 to 18, characterized in that: The apparatus further includes a first test device and a second test device, the first source code includes a first part and a second part, the first test device is used to test the first part using the first test case, the second test device is used to test the second part using the first test case, the first code coverage information is used to describe the execution status of the code statements in the first part, and the processing unit is further used to: adding a second private variable in at least one third method included in the first source code in the second test device, wherein the at least one third method is a method that is not executed in the first source code in the second test device; When the second test device completes testing the first source code using the first test case, obtaining second code coverage information based on private variables in a third method included in the second part, wherein the second code coverage information is used to describe execution conditions of code statements in the second part; Acquire overall code coverage information corresponding to the first source code based on the first code coverage information and the second code coverage information; Based on the overall code coverage information, the first code coverage result is displayed.
20. The device according to any one of claims 13 to 19, characterized in that The processing unit is further configured to add private variables to methods other than the at least one first method in the first source code.
21. The device according to claim 20, characterized in that The code coverage rate included in the first code coverage result is the code coverage rate when the first source code executes the first test case, the device is further used to test the first source code using a second test case after testing the first source code using the first test case, and the processing unit is further used to: After the first source code is tested using the second test case, based on the private variables in each method included in the first source code Acquire third code coverage information, where the third code coverage information is used to describe execution status of code statements in the first source code; Based on the first code coverage information and the third code coverage information, a second code coverage result is displayed, where the second code coverage result includes the code coverage rate when the first source code executes the first test case and the second test case.
22. The device according to any one of claims 13 to 21, characterized in that The processing unit is further used for: Acquire change information, where the change information is used to describe a difference between a second source code and the first source code, where the first source code and the second source code are two versions of source code for the same service, and a version of the second source code is earlier than a version of the first source code; Acquire code coverage information corresponding to the difference part based on the change information and the first code coverage information, where the code coverage information corresponding to the difference part is used to describe the execution status of the code statements in the difference part; The code coverage result of the difference part is displayed based on the code coverage information corresponding to the difference part, and the code coverage result of the difference part includes the code coverage rate of the difference part.
23. The device according to claim 22, characterized in that The processing unit is further used for: Acquire at least one component included in the difference portion; For each component, based on the code coverage information corresponding to the difference part, the code coverage information corresponding to the component is obtained, where the code coverage information corresponding to the component is used to describe the execution status of the code statements in the component; The code coverage result of the component is displayed based on the code coverage information corresponding to the component, and the code coverage result of the component includes the code coverage rate of the component.
24. The device according to claim 23, characterized in that The at least one component includes one or more of the following: at least one branch in the difference portion, at least one method in the difference portion, or at least one class in the difference portion.
25. A computing device cluster, characterized in that: The cluster includes at least one computing device, each of the at least one computing device includes at least one processor and at least one memory, and the at least one memory stores computer-readable instructions; the at least one processor executes the computer-readable instructions so that the cluster executes the method according to any one of claims 1 to 12.
26. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
27. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Method and device for obtaining code coverage information
CN104199773A
Test method and device based on code coverage rate
CN110196801A
Test method and device
CN113360377A
Software Visualization Using Code Coverage Information
US20130298110A1
