Software key function identification method, equipment, medium and product

By extracting test cases from the software user manual and constructing a corrected method call diagram, calculating the structural entropy index to identify the key functions of the software, solve the problem of low accuracy of the key function recognition in the existing technology, and improved the understanding of the software's understanding. Sex and maintenance efficiency.

CN119377092AActive Publication Date: 2025-01-28ZHEJIANG GONGSHANG UNIVERSITY
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411909261.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-01-28
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

The prior art has low accuracy in identifying software key functions, resulting in poor comprehensibility and low maintenance efficiency, especially in the absence of software log information.

Method used

By extract test cases from the software user manual, run these test cases to determine the operating trajectory of the software, abstract the call relationship between functions and build a method call diagram, correct the border value in the diagram, calculate the structural entropy indicator to evaluate the function of the function to evaluate the function of the function. Important, eventually identify key functions of software.

Benefits of technology

The accuracy of the software's key function has been improved, the understanding of the software's understanding and maintenance efficiency is enhanced, and it can work effectively without log information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377092A_ABST
    Figure CN119377092A_ABST
Patent Text Reader

Abstract

The invention discloses a software key function identification method and device, a medium and a product, and relates to the technical field of computers, the method comprises the following steps: extracting a plurality of test cases of to-be-tested software according to a user manual of the to-be-tested software; running to-be-tested software according to the plurality of test cases, and determining a running track of the to-be-tested software; on the basis of the running track, abstracting a calling relation between functions in the running process of the to-be-tested software into a method calling graph; correcting the method calling graph by utilizing the moving track, and determining a corrected method calling graph; according to the corrected method call graph, calculating a structure entropy index value of a function corresponding to each node in the corrected method call graph as an importance value of the function corresponding to the node; and based on the importance value of the function corresponding to each node and a preset threshold value, identifying the software key function in the to-be-tested software. Accurate identification of software key functions is realized, and understanding and effective maintenance of to-be-tested software are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, medium and product for identifying key software functions. Background Art

[0002] An effective way to understand large software systems is to start with the core elements of the software (such as packages, classes, functions, attributes, etc.), gradually expand to other related elements, and finally grasp the overall structure. Existing research has tried many methods to identify these core elements. However, there are still the following shortcomings.

[0003] (1) Static analysis mainly extracts the calling relationships between functions during software operation from the software source code, but the calling relationships between functions extracted by static analysis are inaccurate.

[0004] (2) Existing dynamic analysis mainly focuses on the identification of key classes and key packages, but lacks the identification of key software functions, resulting in poor software understandability and low maintenance efficiency.

[0005] (3) Existing dynamic analysis technology relies on log information collected during the daily operation of the software to parse software functions and the relationship between functions from the logs. For some software that lacks log information, existing dynamic analysis technology cannot be used, which leads to low accuracy in identifying key software functions.

[0006] (4) The existing static analysis and dynamic analysis do not take into account the impact of the importance of functions used in software operation, and the existing indicators for evaluating the importance of functions used in software operation are not accurate enough, which leads to low accuracy in identifying key software functions.

[0007] Based on the above shortcomings, how to effectively identify the key functions of the software based on dynamic analysis and indicators of the importance of functions during software operation to improve the comprehensibility and maintainability of the software has important theoretical and practical significance. Summary of the invention

[0008] The purpose of this application is to provide a method, device, medium and product for identifying software key functions, which can solve the problem of poor software understandability and low maintenance efficiency caused by low accuracy in identifying software key functions.

[0009] To achieve the above objectives, this application provides the following solutions.

[0010] In a first aspect, the present application provides a method for identifying key software functions, the method comprising: extracting multiple test cases of the software to be tested according to the user manual of the software to be tested; running the software to be tested according to the multiple test cases to determine the running trajectory of the software to be tested; based on the running trajectory, abstracting the calling relationship between functions during the running of the software to be tested into a method call graph; the calling relationship between the functions represents the calling relationship between nodes in the method call graph, and the calling relationship between the functions is determined based on dynamic analysis; based on the running trajectory and the method call graph, determining a revised method call graph; based on the revised method call graph, constructing a structural entropy index, and calculating the structural entropy index value of the function corresponding to each node in the revised method call graph as the importance value of the function corresponding to the node; based on the importance value of the function corresponding to each node and a preset threshold, determining the key function of the software to be tested.

[0011] In a second aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for identifying key software functions described above.

[0012] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for identifying key software functions described above.

[0013] In a fourth aspect, the present application provides a computer program product, including a computer program, which implements the above-mentioned method for identifying key software functions when executed by a processor.

[0014] According to the specific embodiments provided in this application, this application discloses the following technical effects.

[0015] The present application provides a method, device, medium and product for identifying key functions of software. First, in the present application, test cases extracted from the user manual are used for the operation of the software to be tested, which provides a new idea for extracting the operation track of the software to be tested. Compared with the dynamic analysis method based on the operation log of the software to be tested, the method of obtaining the operation track based on the user manual in the present application is more general and can be used to obtain the operation track of more software to be tested. Then, based on the operation track, the calling relationship between functions in the operation process of the software to be tested is abstracted into a method call graph, and the calling relationship between functions is determined based on dynamic analysis. Therefore, compared with static analysis, the calling relationship between functions determined by dynamic analysis in the present application is more accurate and can more truly reflect the interaction relationship between functions in the operation of the software, thereby improving the accuracy of identifying key functions of the software.

[0016] Furthermore, according to the modified method call graph, a structural entropy index is constructed, and the structural entropy index can accurately evaluate the importance of the function. It can be seen that by calculating the structural entropy index value of the function corresponding to each node in the modified method call graph, the importance of the function corresponding to the node can be accurately identified, which makes up for the problem of low accuracy in identifying key functions of the software under test due to failure to take into account the influence of the importance of the functions used in the operation of the software under test in the existing static analysis and dynamic analysis. Furthermore, based on the accurately identified key functions of the software, the understanding and effective maintenance of the software under test can be improved, providing technical support for the development of high-trust software under test. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 A flowchart of a method for identifying key software functions provided in an embodiment of the present application.

[0019] Figure 2 A method call graph of a method for identifying key software functions provided in an embodiment of the present application.

[0020] Figure 3 This is an execution mode diagram of a method for identifying key software functions provided in an embodiment of the present application.

[0021] Figure 4 A modified method call graph of a method for identifying key software functions provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0023] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0024] like Figure 1 As shown, the present application provides a method for identifying key software functions, including steps 101 to 106.

[0025] Step 101: extract multiple test cases of the software to be tested according to the user manual of the software to be tested.

[0026] In some embodiments, step 101 specifically includes: splitting sentences in the user manual based on the Stanford Parser tool to determine the core elements of each sentence; the core elements include key dependencies between subjects, verbs, adjectives and objects; based on the core elements of each sentence, constructing a dependency tree of the sentence, and extracting operation information in the dependency tree; the operation information includes the verb, the subject and the object; and generating the multiple test cases according to each of the operation information.

[0027] The extracted verbs, subjects, objects and other operation information are used as a test case structure, and the parsing results are output as a structured text file. Each line in the file includes: operation behavior (operation verb), operation object (noun) and related description information. In other words, the text information in the user manual of the software to be tested is parsed to extract the relevant verb-object structure to generate test cases.

[0028] For example, some information from the following user manual is used as follows: After launching the application, the user will see three buttons:Addition Button, Subtraction Button, and FiveAddition Button. First, the user can click the Addition Button to perform an operation that increments the current value by 1. Next, the user can click the Subtraction Button to perform an operation that decrements the current value by 1. Finally, the user can click the FiveAddition Button to perform an operation that increments the current value by 5. Some information in the user manual shows that there are three buttons on the software interface, namely, the Addition button, the Subtraction button, and the FiveAddition button. When the user clicks the Addition button, the number will increase by 1; when the user clicks the Subtraction button, the number will decrease by 1; and when the user clicks the FiveAddition button, the number will increase by 5. This user manual information is parsed using the Stanford Parser tool. First, the part of speech is marked for each clause word by word, such as "NN" for common nouns, "VB" for verbs, and "VBG" for the present participle form of verbs. Secondly, the core elements such as subject, object, and verb in the sentence structure and their mutual relationships are clarified. Here, we mainly focus on key dependencies such as "nsubj" (subject), "dobj" (direct object), and "amod" (adjective modifier). "User" is the subject of this sentence, indicating the person who performs the action; "click" is the main verb of the sentence, indicating the action performed; "Addition Button" is the direct object of "click", indicating the object clicked by the user. Finally, the extracted subject ("user"), operation verb-operation object pair ("click"-"Addition Button") and other operation information are used as a test case structure and output to a text file. Part of the information in the above user manual is parsed, and the extracted test case information is as follows: 1;1:user2:launch%VBG|application%NN;3: 2;1:user2:click%VB|Addition Button%NN;perform%VB|operation%NN;3:that|increment;by|1; 3;1:user2:click%VB|Subtraction Button%NN;perform%VB|operation%NN;3:by|1; 4;1:user2:click%VB|FiveAddition Button%NN;perform%VB|operation%NN;3:that|increment;by|5; From the above extracted results, we can see that: each line consists of three parts. The first part represents the subject role that performs the action, the second part represents the operation verb-operation object pair, and the third part records a detailed description of the object or target. This application mainly focuses on the second part and uses it as a test case. There are 4 test cases obtained from the above extracted results. The first one allows the user to run the application, the second one allows the user to click the "Addition" button, the third one allows the user to click the "Subtraction" button, and the fourth one allows the user to click the "FiveAddition" button.

[0029] Step 102: Run the software to be tested according to the multiple test cases to determine the running track of the software to be tested.

[0030] In some embodiments, step 102 specifically includes: developing a script for collecting software running trajectories according to the AspectJ framework; embedding the script into the source code of the software to be tested, running the multiple test cases, and determining the running trajectory of the software to be tested.

[0031] Among them, a script for collecting software running traces is developed based on the AspectJ framework and embedded into the source code of the software, so as to realize real-time monitoring of the software runtime behavior (such as monitoring method calls, message passing and resource usage, etc.). According to the test cases generated in step 101, the software is operated, and the running traces are tracked, captured and recorded using the tools developed in step 102, and the running traces are saved in a log file in .dat format.

[0032] Exemplarily, the Java software source code is as follows: public class App { public static void main(String[] args) { System.out.println( "Hello World!" ); App app = new App(); / / Simulate user clicking the addition button app.onAddClick(5); / / Simulate user clicking the subtraction button app.onSubClick(5); / / Simulate the user clicking the plus 5 button app.onAddFiveClick(10); } private void onAddClick(int a) { int result = add(a); System.out.println("Result: " + result); } private void onSubClick(int a) { a = add(a); a = sub(a); int result = sub(a); System.out.println("Result: " + result); } public void onAddFiveClick(int a) { int result = a; for (int i = 0; i<5; i++) { result = add(result); } System.out.println("Final Result after adding 5: " + result); onAddClick(a); } private int add(int a) { return a + 1; } private int sub(int a) { return a - 1; } } Furthermore, according to the test case obtained in step 101, the software interface is operated accordingly, and the Java software source code uses manual calling methods to replace actual interface operations such as clicking buttons. According to the Java software source code, after running the software, the main function is executed first, and then the user clicks the "Addition" button, the onAddClick function is called once, and the add function is called once through the onAddClick function; next, the user clicks the "Subtraction" button, the onSubClick function is executed once, and the add function is called once and the sub function is called twice through the onSubClick function; next, the user clicks the "FiveAddition" button, the onAddFiveClick function is executed once, and the add function is called 5 times and the onAddClick function is called once through the onAddFiveClick function, and then the add function is called once through the onAddClick function. After all the test cases are executed, the final running trajectory is as follows: $1;1728751817229372200;public org.example.App. <init> (); <no-session-id>;6233544834234187777;1728751817229145900;1728751817229156700;DESKTOP-0JCC7QM;1;1 $1;1728751817230262900;private int org.example.App.add(int); <no-session-id>;6233544834234187777;1728751817230250200;1728751817230257700;DESKTOP-0JCC7QM;3;2 $1;1728751817230366500;private void org.example.App.onAddClick(int); <no-session-id>;6233544834234187777;1728751817230223700;1728751817230363800;DESKTOP-0JCC7QM;2;1 $1;1728751817230406100;private int org.example.App.add(int); <no-session-id>;6233544834234187777;1728751817230400000;1728751817230404000;DESKTOP-0JCC7QM;5;2 $1;1728751817230439600;private int org.example.App.sub(int); <no-session-id>;6233544834234187777;1728751817230430800;1728751817230437600;DESKTOP-0JCC7QM;6;2 $1;1728751817230470600;private int org.example.App.sub(int); <no-session-id>;6233544834234187777;1728751817230457400;1728751817230461500;DESKTOP-0JCC7QM;7;2 $1;1728751817230531600;private void org.example.App.onSubClick(int); <no-session-id>;6233544834234187777;1728751817230392400;1728751817230527900;DESKTOP-0JCC7QM;4;1 $1;1728751817230573700;private int org.example.App.add(int); <no-session-id>;6233544834234187777;1728751817230568800;1728751817230571900;DESKTOP-0JCC7QM;9;2 $1;1728751817230591800;private int org.example.App.add(int); <no-session-id>;6233544834234187777;1728751817230581000;1728751817230589600;DESKTOP-0JCC7QM;10;2 $1;1728751817230605400;private int org.example.App.add(int); <no-session-id>;6233544834234187777;1728751817230601500;1728751817230604200;DESKTOP-0JCC7QM;11;2 $1;1728751817230617500;private int org.example.App.add(int); <no-session-id>;6233544834234187777;1728751817230613000;1728751817230616500;DESKTOP-0JCC7QM;12;2 $1;1728751817230627600;private int org.example.App.add(int); <no-session-id>;6233544834234187777;1728751817230622300;1728751817230625800;DESKTOP-0JCC7QM;13;2 $1;1728751817230707900;private int org.example.App.add(int); <no-session-id>;6233544834234187777;1728751817230702500;1728751817230705600;DESKTOP-0JCC7QM;15;3 $1;1728751817230749300;private void org.example.App.onAddClick(int); <no-session-id>;6233544834234187777;1728751817230697300;1728751817230747500;DESKTOP-0JCC7QM;14;2 $1;1728751817230756400;public void org.example.App.onAddFiveClick(int); <no-session-id>;6233544834234187777;1728751817230563100;1728751817230755200;DESKTOP-0JCC7QM;8;1 $1;1728751817230760800;public static void org.example.App.main(java.lang.String[]); <no-session-id>;6233544834234187777;1728751817228521400;1728751817230759800;DESKTOP-0JCC7QM;0;0 Each line corresponds to a record, and each record represents a function call. Each record consists of ten fields, separated by semicolons ";". Here we mainly focus on the third value indicating the called class and function, the ninth value is the execution order index (eoi), and the tenth value indicates the stack depth (ess).

[0033] For example, $1 indicates the type of monitoring record, and 172875181722937220 indicates the difference between the current moment and the preset historical moment, and converts the difference into time in nanoseconds. Among them, such information in the running tracks such as 623354483423418777 and 172875181722914590 is time information, which will not be explained here one by one.

[0034] Step 103: Based on the running trajectory, the calling relationship between functions in the running process of the software to be tested is abstracted into a method call graph; the calling relationship between functions represents the calling relationship between functions corresponding to the nodes at both ends of the directed edges in the method call graph, and the calling relationship between functions is determined based on dynamic analysis.

[0035] In some embodiments, the method call graph of step 103 includes a set of nodes and a set of directed edges; the set of nodes is a set of functions actually executed when the software to be tested is running; the directed edge indicates that the function corresponding to the node at one end of the directed edge calls the function corresponding to the node at the other end of the directed edge; each directed edge is assigned an edge weight; the edge weight represents the total number of times the calling relationship between the functions corresponding to the nodes at both ends of the directed edge occurs when the multiple test cases are running.

[0036] Among them, the functions, the calling relationships between functions, and the number of calls between functions in step 103 are the functions actually executed during the execution of the test case, the calls between functions actually generated, and the number of calls between functions actually generated. It is a dynamic analysis (information can only be collected during the software operation process), rather than a static analysis based on source code (information obtained by analyzing the source code without running the software). At the same time, there is a huge difference between this application and the analysis method based on the software operation log. The method based on the operation log collects information during the daily software operation process, reflecting the user's usage preferences, while this application is based on the operation manual and collects the functions that need to be executed to implement all the functions of the software, the calls between functions, and the number of calls between functions.

[0037] In actual applications, the call relationship information between functions obtained by analyzing the running trajectory is as follows: public static void org.example.App.main(java.lang.String[])###publicorg.example.App. <init>() public static void org.example.App.main(java.lang.String[])###privatevoid org.example.App.onAddClick(int) private void org.example.App.onAddClick(int)###private intorg.example.App.add(int) public static void org.example.App.main(java.lang.String[])###privatevoid org.example.App.onSubClick(int) private void org.example.App.onSubClick(int)###private intorg.example.App.add(int) private void org.example.App.onSubClick(int)###private intorg.example.App.sub(int) private void org.example.App.onSubClick(int)###private intorg.example.App.sub(int) public static void org.example.App.main(java.lang.String[])###publicvoid org.example.App.onAddFiveClick(int) public void org.example.App.onAddFiveClick(int)###private intorg.example.App.add(int) public void org.example.App.onAddFiveClick(int)###private intorg.example.App.add(int) public void org.example.App.onAddFiveClick(int)###private intorg.example.App.add(int) public void org.example.App.onAddFiveClick(int)###private intorg.example.App.add(int) public void org.example.App.onAddFiveClick(int)###private intorg.example.App.add(int) public void org.example.App.onAddFiveClick(int)###private voidorg.example.App.onAddClick(int) private void org.example.App.onAddClick(int)###private intorg.example.App.add(int) From the calling relationship between the above functions, we can see that each row means that the former function calls the latter function once. Then, the calling relationship is abstracted as Figure 2 The method call graph MCG shown is N , L ).in, , N Represents the set of functions that are actually executed when the software is running; L ={(main, onAddClick), (onAddClick, add), (main,onSubClick), (onSubClick, add), (onSubClick, sub), (main, onAddFiveClick),(onAddFiveClick, add), (onAddFiveClick, onAddClick)}, L Represents a set of calling relationships between functions (i.e., a set of directed edges), where the former calls the latter.

[0038] Step 104: modify the method call graph using the running trajectory to determine a modified method call graph.

[0039] The modified method call graph is represented by UMCG. N and L Same as MCG. The main difference is that UMCG fixes the edge weights in MCG.

[0040] In some embodiments, step 104 specifically includes steps 201 to 203 .

[0041] Step 201: According to the running track corresponding to any test case, determine the subgraph corresponding to the test case; and use the subgraph as the execution mode of the test case.

[0042] Step 202: For any directed edge in the execution mode, determine the old edge weight of the directed edge, and count the number of co-occurrences of the calling relationship between the functions corresponding to the nodes at both ends of the directed edge in the execution mode of each test case.

[0043] Step 203: Determine the new edge weights of the directed edges according to the co-occurrence counts and the old edge weights; and determine the revised method call graph according to the new edge weights corresponding to each directed edge.

[0044] Among them, MCG is constructed by executing the test case in step 101. Therefore, the functions and calling relationships between functions obtained when executing a specific test case will constitute a subgraph of MCG. This application regards the subgraph of MCG corresponding to the execution of a test case as the execution mode corresponding to this test case.

[0045] Furthermore, the co-occurrence times of the functions corresponding to the nodes at both ends of each directed edge in MCG in all execution modes are counted, and the co-occurrence times are added to the edge weight of this edge as the new edge weight, that is, the new edge weight = old edge weight + co-occurrence times. It is worth noting that the old edge weight refers to the total number of calls of the directed edge in all execution modes, and the co-occurrence times refers to the number of execution modes in which the directed edge appears.

[0046] Specifically, the call relationship obtained by executing each test case corresponds to a subgraph of MCG, that is, an execution mode. According to the call relationship between functions corresponding to each test case, three execution modes are obtained, such as Figure 3 As shown in Figure 1, the number of times the calling relationship between functions in the execution mode appears is used as the edge weight. Next, the edge weight is modified according to the execution mode, and the number of co-occurrences of the functions at both ends of each directed edge in all execution modes is counted, and the number of co-occurrences is accumulated to the edge weight of this edge as the new edge weight. Figure 3 The onAddClick function calls the add function in both execution mode 1 and execution mode 3, so the co-occurrence count of (onAddClick, add) is 2, and the modified edge weight of (onAddClick, add) is 2+2=4. (main, onAddClick) only appears in execution mode 1, so the co-occurrence count of (main, onAddClick) is 1, and the modified edge weight of (main, onAddClick) is 1+1=2. The modification process of other edge weights is similar. The modified UMCG graph is shown in Figure 4 For the convenience of subsequent description, all nodes will be labeled with letters from A to F.

[0047] In some embodiments, step 203 specifically includes: accumulating the number of co-occurrences and the old edge weight to obtain a new edge weight of the directed edge.

[0048] Step 105: construct a structural entropy index according to the modified method call graph, and calculate the structural entropy index value of the function corresponding to each node in the modified method call graph as the importance value of the function corresponding to the node.

[0049] In some embodiments, step 105 specifically includes steps 301 to 303 .

[0050] Step 301: Call any directed edge in the modified method graph , calculate the relative importance value of the directed edge; ;in, For directed edges the relative importance of and are all nodes in the modified method call graph; For Node The nodes on the incoming edge correspond to the set of functions; the directed edges in the modified method call graph The edge weight of The edge in the modified method call graph The edge weight of for Midpoint Any node on the incoming edge corresponds to a function; is the set of nodes in the modified method call graph.

[0051] Step 302: Calculate the node according to the relative importance value The entropy of . ;in, For Node Entropy of For directed edges The relative importance value of The natural logarithm of .

[0052] Step 303: According to the node Entropy calculation node The structural entropy index value of ;in, For Node The structural entropy index value of Is a node The set of functions corresponding to the nodes on the outgoing edges; for Any node in the corresponding function; is the directed edge in the modified method call graph The edge weight of is the directed edge in the modified method call graph The edge weight of for Any node in the corresponding function; For Node The entropy of .

[0053] Among them, all parameters are dimensionless and have no units.

[0054] In practical applications, the UMCG calculation of any node based on step 104 is The structural entropy index value , and use it as a node The importance value of the corresponding function. The structural entropy The calculation of includes the following steps.

[0055] Step 1: Calculate all directed edges in UMCG< j , i >The relative importance of ,Right now: ; like Figure 4 As shown, all nodes in the modified UMCG graph are labeled with letters A to F.

[0056] Specifically, Figure 4 The weights of all edges in are: , , , , , , , .

[0057] Step 2: Based on the results obtained in step 1 , compute nodes Entropy e i ,Right now ;therefore, Figure 4 The entropy of all nodes in is: , , , , , .

[0058] Step 3: Based on the nodes obtained in step 2 Entropy Compute Node The structural entropy ,Right now: ;therefore, Figure 4 The structural entropy of all nodes in is: , , , , , .

[0059] Step 106: Based on the importance value of the function corresponding to each node and a preset threshold, identify the key software functions in the software to be tested.

[0060] Specifically, based on the structural entropy index values ​​of all nodes obtained in step 105 (i.e., the importance values ​​of the functions corresponding to each node), the importance values ​​of the functions corresponding to each node are arranged in descending order to obtain a sorting result. The functions in the sorting result that are less than a preset threshold are obtained as the identified software key functions. The preset threshold may be: the top 15% of the functions.

[0061] Exemplarily, the ranking result is (E: 4.85) > (C: 2.27) > (F: 1.6) > (B=D: 1.33). Figure 4 There are 6 functions in total, and the top 15% are taken, that is, 6×15%=0.9, which is rounded to 1. Therefore, the function add corresponding to the top 1 node E in the sorting result is taken as the key function of the software.

[0062] The present application discloses a method for identifying key methods of software based on dynamic analysis and structural entropy, comprising the following steps: extracting test cases for running software from the user manual of the software; running the software developed in Java language according to the test cases to obtain the execution trajectory of the software; abstracting the calling relationship between functions during the software runtime into a method call graph according to the execution trajectory; analyzing the calling relationship between functions according to the running trajectory, and then correcting the method call graph; constructing a structural entropy measurement index, and calculating the structural entropy of the function corresponding to the node based on the corrected method call graph; measuring the importance of the function with structural entropy, and considering the functions ranked in the top 15% (the recognized threshold in the field) in the ranking result of the importance value of the function as key functions. In the present application, the software is run using test cases extracted from the user manual, which provides a new idea for extracting the running trajectory of the software. Compared with the dynamic analysis method based on the software running log, the strategy used in the present application is more general and can be used to obtain the running trajectory of more software. In addition, the present application corrects the method call graph by execution mode mining, and then calculates the importance of the function. Compared with the dynamic analysis method directly based on the software running log and the method call graph, the present application can further consider the impact of the execution mode corresponding to the software running test case on the importance of the function. This application makes up for the deficiencies of existing static and dynamic analysis technologies in identifying software key functions, which in turn leads to problems with the accuracy of identifying software key functions. It is of great significance for improving the efficiency of code understanding and maintenance, and provides technical support for the development of high-trust software.

[0063] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the above method is implemented when the processor executes the computer program.

[0064] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the above method when executed by a processor.

[0065] In an exemplary embodiment, a computer program product is provided, including a computer program, which implements the above method when executed by a processor.

[0066] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0067] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive memory (ReRdM), magnetic random access memory (MRdM), ferroelectric random access memory (FRdM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RdM) or external cache memory, etc. By way of illustration and not limitation, RdM may be in various forms, such as static random access memory (SRdM) or dynamic random access memory (DRdM).

[0068] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0069] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0070] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.< / init> < / init>

Claims

1. A method for identifying key software functions, characterized in that: The method for identifying the key software functions includes: Extract multiple test cases of the software to be tested according to the user manual of the software to be tested; Running the software to be tested according to the multiple test cases to determine the running track of the software to be tested; Based on the running track, the calling relationship between functions in the running process of the software to be tested is abstracted into a method call graph; the calling relationship between functions represents the calling relationship between functions corresponding to the nodes at both ends of the directed edge in the method call graph, and the calling relationship between functions is determined based on dynamic analysis; Correcting the method call graph using the running trajectory to determine a corrected method call graph; According to the modified method call graph, a structural entropy index is constructed, and the structural entropy index value of the function corresponding to each node in the modified method call graph is calculated as the importance value of the function corresponding to the node; Based on the importance value of the function corresponding to each node and a preset threshold, the key software functions in the software to be tested are identified.

2. The method for identifying software key functions according to claim 1, characterized in that: According to the user manual of the software to be tested, extract multiple test cases of the software to be tested, including: Sentences in the user manual are split based on the Stanford Parser tool to determine the core elements of each sentence; the core elements include key dependencies between subjects, verbs, adjectives, and objects; Based on the core elements of each sentence, a dependency tree of the sentence is constructed, and operation information in the dependency tree is extracted; the operation information includes the verb, the subject, and the object; The multiple test cases are generated according to each of the operation information.

3. The method for identifying key software functions according to claim 1, characterized in that: Running the software to be tested according to the multiple test cases to determine the running track of the software to be tested specifically includes: Develop scripts to collect software running traces based on the AspectJ framework; The script is embedded into the source code of the software to be tested, and the multiple test cases are run to determine the running track of the software to be tested.

4. The method for identifying software key functions according to claim 1, characterized in that: The method call graph includes a set of nodes and a set of directed edges; The set of nodes is a set of functions actually executed when the software to be tested is running; The directed edge indicates that the function corresponding to the node at one end of the directed edge calls the function corresponding to the node at the other end of the directed edge; Each directed edge is assigned an edge weight; The edge weight represents the total number of times the calling relationship between the functions corresponding to the nodes at both ends of the directed edge occurs when the multiple test cases are run.

5. The method for identifying software key functions according to claim 4, characterized in that: Correcting the method call graph using the running trajectory to determine a corrected method call graph specifically includes: According to the running track corresponding to any test case, determine the subgraph corresponding to the test case; Using the subgraph as the execution mode of the test case; For any directed edge in the execution mode, determine the old edge weight of the directed edge, and count the number of co-occurrences of the calling relationship between the functions corresponding to the nodes at both ends of the directed edge in the execution mode of each test case; Determining a new edge weight of the directed edge according to the co-occurrence count and the old edge weight; The modified method call graph is determined according to the new edge weight corresponding to each directed edge.

6. The method for identifying software key functions according to claim 5, characterized in that: Determining a new edge weight of the directed edge according to the number of co-occurrences and the old edge weight specifically includes: The co-occurrence count is added to the old edge weight to obtain a new edge weight of the directed edge.

7. The method for identifying software key functions according to claim 1, characterized in that: Calculating the structural entropy index value of the function corresponding to each node in the modified method call graph as the importance value of the function corresponding to the node specifically includes: Call any directed edge in the modified method graph , calculate the relative importance value of the directed edge; ;in, For directed edges the relative importance of and are all nodes in the modified method call graph; For Node The nodes on the incoming edge correspond to the set of functions; the directed edges in the modified method call graph The edge weight of The edge in the modified method call graph The edge weight of for Midpoint Any node on the incoming edge corresponds to a function; is the set of nodes in the modified method call graph; Calculate the node according to the relative importance value Entropy of ;in, For Node Entropy of For directed edges The relative importance value of The natural logarithm of According to the node Entropy calculation node The structural entropy index value of ;in, For Node The structural entropy index value of Is a node The set of functions corresponding to the nodes on the outgoing edges; for Any node in the corresponding function; is the directed edge in the modified method call graph The edge weight of is the directed edge in the modified method call graph The edge weight of for Any node in the corresponding function; For Node The entropy of .

8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for identifying key software functions according to any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for identifying a key software function described in any one of claims 1 to 7 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for identifying a key software function described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Software reliability measurement method based on software network structure characteristics

    CN109828925A

  • A software key function identification method based on g-kernel decomposition

    CN109918129A

  • Effective test case reuse method and device for software fuzz testing

    CN116383092A

  • Software testing method and device, equipment and storage medium

    CN117632694A

  • Software fuzzy test method, device and equipment capable of intelligently configuring parameters

    CN118468290A