A method for automatically generating software function coupling matrix
By establishing the correspondence between functions and interfaces in software development and testing, analyzing interface call logs, and generating functional coupling matrix and priority, the problem of insufficient functional coupling analysis is solved, and the efficiency of software development and testing is improved.
Patent Information
- Application Number
- CN202111050572.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-08
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2041-09-08
AI Technical Summary
During software development and testing, insufficient functional coupling analysis leads to waste of manpower, and many coupling points are not used in practical applications.
By establishing the correspondence between software functions and function points and code interfaces, and recording the interface call relationship when the software is running, analyzing the log to obtain the call relationship and occurrence probability between interfaces, and finally, the functional coupling matrix is automatically generated through the mapping relationship between interfaces and functions.
A true functional coupling matrix and coupling priority are generated to guide software development and testing, reduce labor waste, and improve development and testing efficiency.
Smart Images

Figure CN113918205B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer software development, and in particular, relates to a method for automatically generating a software function coupling matrix. Background Art
[0002] In software development and testing scenarios, there are a large number of problems caused by insufficient functional coupling analysis, and a large amount of manpower is often required to solve functional coupling problems at work, while these coupling points are basically not used in actual applications, resulting in a waste of software development and testing manpower. Summary of the invention
[0003] In view of the above defects and needs of the prior art, the present invention provides a method for automatically generating a software coupling matrix. The present invention establishes a corresponding relationship between software functions and function points and code interfaces, and records the calling relationship between software interfaces when the software is running, and obtains the calling relationship and occurrence probability between interfaces by analyzing the log. Then, the function coupling matrix is automatically generated through the mapping relationship between the interface and the function, function point and sub-function point.
[0004] The specific implementation contents of the present invention are as follows:
[0005] The invention proposes a method for automatically generating a software function coupling matrix, which is used for solving the coupling relationship and coupling probability of the real coupling in the function operation process of the software product, generating a coupling matrix and giving the coupling priority of the coupling point to guide the subsequent software product development and testing; the method first establishes the corresponding relationship between the software product function and function point and the code interface, and records the calling relationship between the software code interface in a log when the software is running; then, the calling relationship between the code interface and the corresponding occurrence probability are obtained by analyzing the log; finally, the function coupling matrix is automatically generated after the coupling priority is set according to the size of the occurrence probability through the mapping relationship between the code interface and the function, function point and sub-function point, and the function coupling matrix and the corresponding coupling priority are used to guide the subsequent software product development and testing.
[0006] In order to better implement the present invention, the following steps are further specifically included:
[0007] Step 1: Divide the software product into multiple levels of functions, function points and sub-function points, and establish a corresponding multi-level function catalog;
[0008] Step 2: Establish a correspondence table between the multi-level functions of the software product and the code interface, and indicate the test points of the code interface in the code interface;
[0009] Step 3: Record the interface call relationship in the log during the use of the software product;
[0010] Step 4: Analyze the logs to find out the calling relationships between code interfaces and the corresponding occurrence probabilities;
[0011] Step 5: Through the mapping relationship between the code interface and the function, function point and sub-function point, the coupling priority is set according to the probability of occurrence and the function coupling matrix is automatically generated;
[0012] Step 6: Use the functional coupling matrix and corresponding coupling priorities to guide subsequent software product development and testing.
[0013] In order to better implement the present invention, further, the specific operation of step 3 is:
[0014] Step 3.1: Define transaction types according to the functional characteristics of the software, including configuration transactions, state migration transactions, and business forwarding transactions;
[0015] Step 3.2: Enable the logging function corresponding to the code interface. When the software product detects the start of a transaction of the corresponding type, log the transaction. The log records the code interface called during the execution of the corresponding transaction and the parameters for calling the code interface.
[0016] In order to better implement the present invention, further, in the step 3.2, for the configuration transaction, it is necessary to record the configured code interface and the object of the code interface operation, record the current mark of the operation object, and generate a new mark after the operation and record it in the log; at the same time, record the call tree between all code interfaces in the current configuration transaction.
[0017] In order to better implement the present invention, further, in the step 3.2, for the state migration transaction, when a change in the state of an object is detected, it is necessary to record the object whose state occurs, the reason for the state migration and the code interface associated with the reason for the state migration.
[0018] In order to better implement the present invention, further, in the step 3.2, for the forwarding transaction, the forwarding transaction is divided into forwarding transactions of multiple different scenarios, the nodes experienced by different forwarding transactions in the device are recorded, and the code interfaces corresponding to the experienced nodes are recorded.
[0019] In order to better implement the present invention, further, the forwarding transaction is divided into Ethernet forwarding transaction, IP forwarding transaction, IPv4 forwarding transaction, IPv6 forwarding transaction, IP4in6 forwarding transaction, tcp forwarding transaction and udp forwarding transaction.
[0020] In order to better implement the present invention, further, the log is used to perform the following analysis operations:
[0021] Operation 1: Determine whether coupling occurs between transactions based on the objects operated in the transaction and the tags of the objects. If coupling occurs, a coupling relationship between the transactions can be generated.
[0022] Operation 2: The association relationship between coupling interfaces between different transactions can be generated based on the association relationship between transactions, and the association depth and association times can be calculated;
[0023] Operation 3: During the R&D process, logs of problems found need to be uploaded to the problem ticket database. The tool can obtain the number, severity, and occurrence time of transaction problems based on the logs recorded in the problem ticket database.
[0024] In order to better implement the present invention, further, in step 5, a research and development question library is set, and a corresponding transaction weight ratio is set; then different initial weights are set for different transaction types, and then the initial weights are superimposed with the transaction weight ratio to obtain the final weight. The higher the final weight, the higher the coupling priority.
[0025] In order to better implement the present invention, further, the calculation method of the transaction weight ratio is as follows: automatically collect the number and severity of problems caused by code interface coupling corresponding to various types of transactions in the R&D problem library, and the software defect rate DI values corresponding to different severities are different; the transaction weight ratio of the transaction with more problems is greater; the R&D problem library weight of the transaction with a higher software defect rate DI value is greater;
[0026] And set the association depth and association coefficient; the association depth is the calling level between code interfaces, the larger the calling level, the lower the coupling priority; the association times is the number of associations in the log, the larger the association times, the higher the coupling priority;
[0027] Then the priority coefficient is obtained. The calculation method of the coupling priority coefficient is as follows:
[0028] Priority coefficient = initial weight * transaction weight ratio – association depth * ratio + association times * ratio;
[0029] Set the corresponding coupling priority according to the obtained priority coefficient:
[0030] Priority coefficient > 100 means coupling priority 1;
[0031] The priority coefficient between 50 and 100 is coupling priority 2;
[0032] The priority coefficient is between 10 and 50, which is coupling priority 3;
[0033] The priority coefficient is between 0 and 10, which is coupling priority 4;
[0034] And keep it on record.
[0035] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0036] (1) Guide the software development process as a reference for inter-functional coupling processing, and process the relationship between coupling points according to priority to reduce inter-functional coupling problems. At the same time, provide a priority reference for solving functional coupling problems to avoid investing manpower in solving unimportant coupling points.
[0037] (2) Provide guidance for the design of use cases for software testing and improve the accuracy of use case design.
[0038] (3) Guide the formulation of software testing strategies and accurately assess the scope of impact of code changes when the code is changed. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a schematic diagram of a multi-level functional directory;
[0040] Figure 2 It is a table diagram of the interface correspondence;
[0041] Figure 3 This is a schematic diagram of the coupling matrix structure. DETAILED DESCRIPTION
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be understood that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments, and therefore should not be regarded as limiting the scope of protection. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technical personnel in this field without making creative work are within the scope of protection of the present invention.
[0043] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "disposed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0044] Embodiment 1:
[0045] This embodiment proposes a method for automatically generating a software function coupling matrix, which is used to solve the coupling relationship and coupling probability of the real coupling during the function operation of the software product, generate a coupling matrix and give the coupling priority of the coupling point to guide the subsequent software product development and testing; the method first establishes the corresponding relationship between the software product function and function point and the code interface, and records the call relationship between the software code interface in the log when the software is running; then, the call relationship between the code interface and the corresponding occurrence probability is obtained by analyzing the log; finally, through the mapping relationship between the code interface and the function, function point and sub-function point, the coupling priority is set according to the size of the occurrence probability, and the function coupling matrix is automatically generated, and the function coupling matrix and the corresponding coupling priority are used to guide the subsequent software product development and testing.
[0046] Working principle: The prior art generates a software function coupling matrix through human experience analysis or code analysis. However, the matrix is subjective or inaccurate, which will result in the inability to focus on the most important functional coupling in subsequent work. This leads to a waste of manpower on the development and testing of unimportant functional coupling. The present invention provides a method for automatically generating a software coupling matrix, and solves the coupling relationship and coupling probability of the actual coupling during the function operation process, generates a coupling matrix and gives the priority of the coupling points to guide subsequent product development and testing. Establish a corresponding relationship between software functions and function points and code interfaces, and record the call relationship between software interfaces when the software is running. The call relationship and occurrence probability between interfaces are obtained by analyzing the logs. Then, the function coupling matrix is automatically generated through the mapping relationship between the interface and the function, function point and sub-function point. The key point is to obtain the true and correct coupling relationship of the function through the interface call relationship that actually occurs during the software operation. Providing accurate guidance in the subsequent development and testing process, the coupling matrix can be used to guide software joint debugging, problem solving, test case design and test strategy formulation, which can greatly reduce the problems introduced in software development due to the lack of coupling analysis, as well as the coupling capacitance with low coupling probability caused by inaccurate coupling analysis, and provide accurate test design and test strategy reference for software testing, avoiding wasting testing manpower on unimportant coupling points.
[0047] Embodiment 2:
[0048] This embodiment is based on the above embodiment 1. Figure 1 , Figure 2 , Figure 3 As shown, in order to better implement the present invention, further, the following steps are specifically included:
[0049] Step 1: Divide the software product into multiple levels of functions, function points and sub-function points, and establish a corresponding multi-level function catalog;
[0050] Step 2: Establish a correspondence table between the multi-level functions of the software product and the code interface, and indicate the test points of the code interface in the code interface;
[0051] Step 3: Record the interface call relationship in the log during the use of the software product;
[0052] Step 4: Analyze the logs to find out the calling relationships between code interfaces and the corresponding occurrence probabilities;
[0053] Step 5: Through the mapping relationship between the code interface and the function, function point and sub-function point, the coupling priority is set according to the probability of occurrence and the function coupling matrix is automatically generated;
[0054] Step 6: Use the functional coupling matrix and corresponding coupling priorities to guide subsequent software product development and testing.
[0055] The other parts of this embodiment are the same as those of the above-mentioned embodiment 1, and thus will not be described in detail.
[0056] Embodiment 3:
[0057] In this embodiment, based on any one of the above embodiments 1-2, in order to better implement the present invention, further, the specific operation of step 3 is:
[0058] Step 3.1: Define transaction types according to the functional characteristics of the software, including configuration transactions, state migration transactions, and business forwarding transactions;
[0059] Step 3.2: Enable the logging function corresponding to the code interface. When the software product detects the start of a transaction of the corresponding type, log the transaction. The log records the code interface called during the execution of the corresponding transaction and the parameters for calling the code interface.
[0060] The other parts of this embodiment are the same as any of the above embodiments 1-2, so they are not repeated here.
[0061] Embodiment 4:
[0062] This embodiment is based on any one of the above embodiments 1-3, and in order to better realize the present invention, further, in the step 3.2, for the configuration transaction, it is necessary to record the configured code interface and the object of the code interface operation, and record the current mark of the operation object, and generate a new mark after the operation and record it in the log; at the same time, record the call tree between all code interfaces in the current configuration transaction.
[0063] In order to better implement the present invention, further, in the step 3.2, for the state migration transaction, when a change in the state of an object is detected, it is necessary to record the object whose state occurs, the reason for the state migration and the code interface associated with the reason for the state migration.
[0064] In order to better implement the present invention, further, in the step 3.2, for the forwarding transaction, the forwarding transaction is divided into forwarding transactions of multiple different scenarios, the nodes experienced by different forwarding transactions in the device are recorded, and the code interfaces corresponding to the experienced nodes are recorded.
[0065] In order to better implement the present invention, further, the forwarding transaction is divided into Ethernet forwarding transaction, IP forwarding transaction, IPv4 forwarding transaction, IPv6 forwarding transaction, IP4in6 forwarding transaction, tcp forwarding transaction and udp forwarding transaction.
[0066] The other parts of this embodiment are the same as any one of the above embodiments 1-3, so they are not repeated here.
[0067] Embodiment 5:
[0068] This embodiment is based on any one of the above embodiments 1-4, and in order to better implement the present invention, further uses the log to perform the following analysis operations:
[0069] Operation 1: Determine whether coupling occurs between transactions based on the objects operated in the transaction and the tags of the objects. If coupling occurs, a coupling relationship between the transactions can be generated.
[0070] Operation 2: The association relationship between coupling interfaces between different transactions can be generated based on the association relationship between transactions, and the association depth and association times can be calculated;
[0071] Operation 3: During the R&D process, logs of problems found need to be uploaded to the problem ticket database. The tool can obtain the number, severity, and occurrence time of transaction problems based on the logs recorded in the problem ticket database.
[0072] In order to better implement the present invention, further, in step 5, a research and development question library is set, and a corresponding transaction weight ratio is set; then different initial weights are set for different transaction types, and then the initial weights are superimposed with the transaction weight ratio to obtain the final weight. The higher the final weight, the higher the coupling priority.
[0073] In order to better implement the present invention, further, the calculation method of the transaction weight ratio is as follows: automatically collect the number and severity of problems caused by code interface coupling corresponding to various types of transactions in the R&D problem library, and the software defect rate DI values corresponding to different severities are different; the transaction weight ratio of the transaction with more problems is greater; the R&D problem library weight of the transaction with a higher software defect rate DI value is greater;
[0074] And set the association depth and association coefficient; the association depth is the calling level between code interfaces, the larger the calling level, the lower the coupling priority; the association times is the number of associations in the log, the larger the association times, the higher the coupling priority;
[0075] Then the priority coefficient is obtained. The calculation method of the coupling priority coefficient is as follows:
[0076] Priority coefficient = initial weight * transaction weight ratio – association depth * ratio + association times * ratio;
[0077] At the same time, it is set that the transaction with a recent problem has a higher coupling priority, and the transaction with a distant problem has a lower coupling priority;
[0078] Set the corresponding coupling priority according to the obtained priority coefficient:
[0079] Priority coefficient > 100 means coupling priority 1;
[0080] The priority coefficient between 50 and 100 is coupling priority 2;
[0081] The priority coefficient is between 10 and 50, which is coupling priority 3;
[0082] The priority coefficient is between 0 and 10, which is coupling priority 4;
[0083] And keep it on record.
[0084] The other parts of this embodiment are the same as any one of the above embodiments 1-4, so they are not repeated here.
[0085] The above is only a preferred embodiment of the present invention, and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment according to the technical essence of the present invention shall fall within the protection scope of the present invention. Figure 1 , Figure 2 , Figure 3 These are screenshots of actual computer pages used only for demonstration purposes and will not affect the substance of the solution.
Claims
1. A method for automatically generating a software function coupling matrix, which is used to solve the coupling relationship and coupling probability of the real coupling during the function operation of the software product, generate a coupling matrix and give the coupling priority of the coupling point to guide the subsequent software product development and testing; characterized in that: The specific steps include: Step 1: Divide the software product into multiple levels of functions, function points and sub-function points, and establish a corresponding multi-level function catalog; Step 2: Establish a correspondence table between the multi-level functions of the software product and the code interface, and indicate the test points of the code interface in the code interface; Step 3: Record the interface call relationship in the log during the use of the software product; Step 4: Analyze the logs to find out the calling relationships between code interfaces and the corresponding occurrence probabilities; Step 5: Through the mapping relationship between the code interface and the function, function point and sub-function point, the coupling priority is set according to the probability of occurrence and the function coupling matrix is automatically generated; Step 6: Use the functional coupling matrix and corresponding coupling priorities to guide the subsequent software product development and testing; The specific operations of step 3 are: Step 3.1: Define transaction types according to the functional characteristics of the software, including configuration transactions, state migration transactions, and business forwarding transactions; Step 3.2: Enable the logging function corresponding to the code interface. When the software product detects the start of a transaction of the corresponding type, the transaction is logged. The log records the code interface called during the execution of the corresponding transaction and the parameters for calling the code interface. In step 3.2, for the configuration transaction, it is necessary to record the configured code interface and the object operated by the code interface, record the current mark of the operation object, and generate a new mark after the operation and record it in the log; at the same time, record the call tree between all code interfaces in the current configuration transaction; In the step 3.2, for the state migration transaction, when a state change of an object is detected, it is necessary to record the object whose state has occurred, the reason for the state migration, and the code interface associated with the reason for the state migration; In the step 3.2, for the forwarding transaction, the forwarding transaction is divided into forwarding transactions of multiple different scenarios, the nodes experienced by different forwarding transactions in the device are recorded, and the code interfaces corresponding to the experienced nodes are recorded; Use the logs to perform the following analysis: Operation 1: Determine whether there is coupling between transactions based on the objects operated in the transaction and the tags of the objects. If there is coupling, generate a coupling relationship between the transactions. Operation 2: Generate the association relationship between the coupling interfaces between different transactions based on the association relationship between the transactions, and calculate the association depth and association times; Operation 3: During the R&D process, logs of problems found need to be uploaded to the problem ticket database. The tool obtains the number, severity, and occurrence time of transaction problems based on the logs recorded in the problem ticket database.
2. A method for automatically generating a software function coupling matrix according to claim 1, characterized in that: The forwarding transaction is divided into Ethernet forwarding transaction, IP forwarding transaction, IPv4 forwarding transaction, IPv6 forwarding transaction, IP4in6 forwarding transaction, tcp forwarding transaction and udp forwarding transaction.
3. A method for automatically generating a software function coupling matrix according to claim 1, characterized in that: In step 5, a research and development problem library is set, and a corresponding transaction weight ratio is set; then different initial weights are set for different transaction types, and then the initial weights are superimposed with the transaction weight ratio to obtain the final weight. The higher the final weight, the higher the coupling priority.
4. A method for automatically generating a software function coupling matrix as claimed in claim 3, characterized in that: The calculation method of the transaction weight ratio is: automatically collect the number and severity of problems caused by code interface coupling corresponding to various types of transactions in the R&D problem library, and different severities correspond to different software defect rate DI values; The transaction weight ratio of a transaction with more issues is larger; The higher the software defect rate DI value, the greater the weight of the R&D problem library of the transaction; And set the association depth and association coefficient; the association depth is the calling level between code interfaces, the larger the calling level, the lower the coupling priority; the association times is the number of associations in the log, the larger the association times, the higher the coupling priority; Then the priority coefficient is obtained. The calculation method of the coupling priority coefficient is as follows: Priority coefficient = initial weight * transaction weight ratio – association depth * ratio + association times * ratio; Set the corresponding coupling priority according to the obtained priority coefficient: Priority coefficient > 100 means coupling priority 1; The priority coefficient between 50 and 100 is coupling priority 2; The priority coefficient is between 10 and 50, which is coupling priority 3; The priority coefficient is between 0 and 10, which is coupling priority 4; And keep it on record.
Citation Information
Patent Citations
Matrix-model-based software testing method
CN104346278A
Automatic data coupling and control coupling analysis method
CN107703923A