A multi-channel parallel software automated testing method
The multi-path parallel software automation testing method constructs a directed software execution network to optimize path selection and minimize interference, enhancing testing efficiency and accuracy by prioritizing important paths and reducing redundant tests.
Patent Information
- Application Number
- CN202410147489.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-01
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-02-01
AI Technical Summary
Traditional serial automated testing methods for software are inefficient when handling large-scale test cases, and multi-channel parallel testing often results in inaccurate test results due to interference between multiple test tasks.
A multi-path parallel software automation testing method that constructs a directed software execution network based on calling relationships, uses a deep traversal algorithm to extract execution paths, calculates node support and key influence, and generates sampling probabilities to avoid redundant testing.
Improves software testing efficiency and accuracy by minimizing interference and optimizing the execution of multiple test paths, ensuring higher probability for important paths and reducing redundant tests.
Smart Images

Figure CN118193359B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software automation testing, and in particular to a multi-path parallel software automation testing method. Background Art
[0002] With the continuous expansion of software scale and the increase of complexity, traditional manual testing methods can no longer meet the needs of software quality assurance. As an efficient and reliable testing method, automated testing has become an important link in the software development process. However, the traditional serial automated testing method has the problem of low efficiency when processing large-scale test cases. In order to improve the efficiency and coverage of automated testing, multi-channel parallel software automated testing methods have emerged. Multi-channel parallel testing can execute multiple test tasks at the same time, greatly shorten the test time, and improve the test efficiency. However, in multi-channel parallel testing, multiple test tasks may interfere with each other, resulting in inaccurate test results. In view of this problem, the present invention proposes a multi-channel parallel software automated testing method, which realizes interference-free software testing by performing path independence analysis, thereby improving software testing efficiency and accuracy. Summary of the invention
[0003] In view of this, the present invention provides a multi-path parallel software automation testing method, the purpose of which is to: 1) extract the calling relationship between the calling functions from the execution logic of the calling functions in the software execution process, take the calling functions in the software execution process as nodes, and construct a directed software execution network that characterizes the execution order of the calling functions based on the calling relationship between the calling functions, and calculate the support of the node based on the number of predecessor nodes and the successor node data of the node in the software execution network, wherein the higher the support, the greater the probability that the node is the initial execution function, and the more software execution paths that can be extracted, and then convert the software execution network into multiple groups of software execution paths; 2) combine the support of the node and the frequency of occurrence in the software execution path to calculate the key influence of the node, evaluate the importance of the software execution path, obtain the importance of each group of software execution paths, and convert the importance of the software execution path into a sampling probability, wherein the higher the importance, the higher the frequency of being called by different software execution paths in the software execution path, and the lower the corresponding sampling probability, thereby avoiding multiple tests on the same calling function, and combining the probability of parallel execution of any multiple groups of software execution paths to realize multi-path parallel software automation testing.
[0004] To achieve the above object, the present invention provides a multi-channel parallel software automated testing method, comprising the following steps:
[0005] S1: Take the calling functions in the software execution process as nodes, extract the calling relationships between the calling functions from the execution logic of the calling functions in the software execution process, build a software execution network, and use the deep traversal algorithm to convert the software execution network into multiple groups of software execution paths, where the path nodes in the software execution path are calling functions;
[0006] S2: Calculate the key influence of nodes in the software execution network to obtain the key influence of each node;
[0007] S3: Substitute the key influence of each node in the software execution network into the corresponding path node in the software execution path, evaluate the importance of the software execution path, and obtain the importance of each group of software execution paths;
[0008] S4: Based on the importance of the software execution paths, generate sampling probabilities for each group of software execution paths, and perform test execution on multiple parallel software execution paths according to the sampling probabilities.
[0009] As a further improvement method of the present invention:
[0010] Optionally, in step S1, the calling functions in the software execution process are used as nodes, and the calling relationships between the calling functions are extracted from the execution logic of the calling functions in the software execution process, including:
[0011] The functions that are called during the software execution process are extracted as the calling functions during the software execution process. The calling functions during the software execution process are taken as nodes. The calling relationships between the calling functions are extracted from the execution logic of the calling functions during the software execution process. Based on the calling relationships between the calling functions, the software execution network is constructed. The calling relationship extraction process between the calling functions is as follows:
[0012] If the function execution result of one set of calling functions is the input of the next set of calling functions, it means that there is an execution logic between the two sets of calling functions, and the order of the two sets of calling functions in the execution logic is used as the calling relationship between the two sets of calling functions.
[0013] Optionally, in step S1, constructing a software execution network based on the calling relationship between the calling functions includes:
[0014] The calling functions in the software execution process are taken as nodes, and the software execution network is constructed based on the calling relationship between the calling functions. The representation of the software execution network is:
[0015] G=(E,V)
[0016] E={e n |n∈[1,N]}
[0017] V={v(n,i)|n∈[1,N],i∈[1,N],i≠n}
[0018] in:
[0019] G represents the representation of the software execution network, E represents the set of nodes in the software execution network, and V represents the set of node relationships in the software execution network;
[0020] e n represents the nth node in the software execution network, corresponding to the nth group of calling functions, and N represents the total number of nodes in the software execution network;
[0021] v(n,i) represents the node e in the software execution network n With node e i The calling relationship between the corresponding calling functions;
[0022] v(n,i)={-1,0,1}, v(n,i)=1 represents node e n For node e i The predecessor node, that is, node e n The function execution result of the corresponding calling function is node e i The input of the corresponding calling function is represented by node e in the software execution network. n Point to node e i ; v(n,i)=0 means node e n With node e i There is no calling relationship between the corresponding calling functions. In the software execution network, node e n With node e i There is no pointing relationship; v(n,i) = -1 means node e n For node e i The successor node, that is, node e i The function execution result of the corresponding calling function is node e n The input of the corresponding calling function is represented by node e in the software execution network. i Point to node e n ;
[0023] A deep traversal algorithm is used to convert the software execution network into multiple sets of software execution paths.
[0024] Optionally, in step S1, a deep traversal algorithm is used to convert the software execution network into multiple groups of software execution paths, including:
[0025] The deep traversal algorithm is used to convert the software execution network into multiple sets of software execution paths, where the traversal process of the software execution path is:
[0026] S11: Calculate the total number of predecessor nodes and successor nodes of each node in the software execution network, where node e n The total number of predecessor nodes is x n , the total number of successor nodes is y n ;
[0027] S12: Calculate the support of each node in the software execution network, where node e n The support calculation formula is:
[0028]
[0029] in:
[0030] E n Represents node e n support level;
[0031] Indicates the preset successor node number threshold;
[0032] exp(·) represents an exponential function with a natural constant as the base;
[0033] S13: sorting the nodes in the software execution network in descending order of support;
[0034] S14: Select nodes in sequence as current path nodes according to the sorting results;
[0035] S15: adding the current path node to the current software execution path as a path node, wherein the current software execution path is initially empty;
[0036] S16: If the current path node has a successor node, and the successor node does not exist in the current software execution path, the successor node is used as the current path node, and the process returns to step S15; otherwise, the current software execution path is extracted, and the process returns to the previous current path node to reselect a different subsequent node and extract the software execution path for backtracking until the node selected in step S14 is backtracked, and the process returns to step S14 to select the next node in the sorting as the current path node;
[0037] S17: Repeat steps S14-S16 to obtain multiple groups of software execution paths, and perform software execution path coverage, wherein the software execution path coverage rule is: if the lengths of two groups of software execution paths differ by one node, namely, u and u+1 nodes respectively, and the first u nodes of the two groups of software execution paths are the same, then the longer software execution path is used to cover the other group of software execution paths;
[0038] The software execution path set is:
[0039] {L k|k∈[1,K]}
[0040] L k =(L k (1),L k (2),...,L k (j),...,L k (num k ))
[0041] in:
[0042] L k represents the kth group of software execution paths obtained by conversion;
[0043] L k (1),L k (2),...,L k (j),...,L k (num k ) represents the software execution path L k The path node sequence in L k (j) represents the software execution path L k The kth path node in , num k Indicates the software execution path L k The total number of path nodes in .
[0044] Optionally, performing key influence calculation on nodes in the software execution network in step S2 includes:
[0045] The key influence calculation is performed on the nodes in the software execution network, where the node e n The key influence calculation formula is:
[0046]
[0047] in:
[0048] value n Represents node e n Calculation results of key influences;
[0049] count(e n ) indicates that there is a node e in the K group of software execution paths. n The number of software execution paths.
[0050] Optionally, in step S3, the key influence of each node in the software execution network is substituted into the software execution path, and the importance of the software execution path is evaluated to obtain the importance of each group of software execution paths, including:
[0051] Substitute the key influence of each node in the software execution network into the software execution path to obtain the key influence of each path node in the software execution path, evaluate the importance of the software execution path, and obtain the importance of each group of software execution paths, where the software execution path L k The importance assessment formula is:
[0052]
[0053] in:
[0054] R k Indicates the software execution path L k The importance of.
[0055] Optionally, in step S4, generating a sampling probability of each group of software execution paths based on the importance of the software execution paths includes:
[0056] Based on the importance of the software execution path, the sampling probability of each group of software execution paths is generated, and the test execution of multiple parallel software execution paths is performed according to the sampling probability, where the software execution path L k The sampling probability generation formula is:
[0057]
[0058] in:
[0059] p k Indicates the software execution path L k The sampling probability of .
[0060] Optionally, the test execution of multiple parallel software execution paths according to the sampling probability in step S4 includes:
[0061] The test execution of multiple parallel software execution paths is performed according to the sampling probability, and the test execution process is as follows:
[0062] S41: sorting the software execution paths in descending order of sampling probability;
[0063] S42: Selecting software execution paths from the sorting results in sequence as the software execution paths to be currently executed;
[0064] S43: Calculate the probability that the unexecuted software execution path and the currently executed software execution path are executed in parallel, where the software execution path L k and software execution path L s The probability calculation formula for parallel execution is:
[0065]
[0066] in:
[0067] Indicates the software execution path L k and software execution path L s The probability of parallel execution;
[0068] α represents the adjustment parameter, and α is set to 0.2;
[0069] p s Indicates the software execution path L s The sampling probability of , where s∈[1,K], s≠k;
[0070] S44: Based on the probability of parallel execution, select M groups of unexecuted software execution paths and the current software execution path to be executed for multi-path parallel execution, obtain software test results of parallel execution of multiple groups of software execution paths, and return to step S42.
[0071] In order to solve the above problem, the present invention provides an electronic device, the electronic device comprising:
[0072] A memory storing at least one instruction;
[0073] Communication interface, enabling electronic equipment to communicate; and
[0074] The processor executes the instructions stored in the memory to implement the multi-path parallel software automated testing method described above.
[0075] In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one instruction is stored. The at least one instruction is executed by a processor in an electronic device to implement the above-mentioned multi-path parallel software automation testing method.
[0076] Compared with the prior art, the present invention proposes a multi-path parallel software automated testing method, which has the following advantages:
[0077] First, this scheme proposes a method for constructing a software execution network and a method for extracting software execution paths. The calling functions in the software execution process are taken as nodes, and the software execution network is constructed based on the calling relationship between the calling functions. The representation of the software execution network is:
[0078] G=(E,V)
[0079] E={e n |n∈[1,N]}
[0080] V={v(n,i)|n∈[1,N],i∈[1,N],i≠n}
[0081] Where: G represents the representation of the software execution network, E represents the set of nodes in the software execution network, and V represents the set of node relationships in the software execution network; e n represents the nth node in the software execution network, corresponding to the nth group of calling functions, N represents the total number of nodes in the software execution network; v(n,i) represents the node e in the software execution network n With node e i The calling relationship between the corresponding calling functions; v(n,i) = {-1, 0, 1}, v(n,i) = 1 represents node e n For node e i The predecessor node, that is, node e n The function execution result of the corresponding calling function is node e i The input of the corresponding calling function is represented by node e in the software execution network. n Point to node e i ; v(n,i)=0 means node e n With node e i There is no calling relationship between the corresponding calling functions. In the software execution network, node e n With node e i There is no pointing relationship; v(n,i) = -1 means node e n For node e i The successor node, that is, node e i The function execution result of the corresponding calling function is node e n The input of the corresponding calling function is represented by node e in the software execution network. i Point to node e n ; The software execution network is converted into multiple sets of software execution paths using a deep traversal algorithm, where the traversal process of the software execution path is as follows: calculate the total number of predecessor nodes and successor nodes of each node in the software execution network, where node e n The total number of predecessor nodes is x n , the total number of successor nodes is y n ; Calculate the support of each node in the software execution network, where node e n The support calculation formula is:
[0082]
[0083] Where: E n Represents node e n support level; represents the preset successor node number threshold; exp(·) represents an exponential function with a natural constant as the base; the nodes in the software execution network are sorted in descending order of support; the nodes are selected as the current path nodes in turn according to the sorting results; the current path node is added to the current software execution path as a path node, where the current software execution path is initially empty; if the current path node has a successor node, and the successor node does not exist in the current software execution path, then the successor node is used as the current path node, otherwise the current software execution path is extracted, and the previous current path node is returned to reselect a different subsequent node and extract the software execution path for backtracking until the selected initial node is backtracked, then the next node in the sorting is selected as the current path node; repeat the steps to obtain multiple groups of software execution paths, and cover the software execution paths, where the covering rule of the software execution paths is: if the lengths of the two groups of software execution paths differ by one node, namely u and u+1 nodes respectively, and the first u nodes of the two groups of software execution paths are the same, then the longer software execution path is used to cover the other group of software execution paths; a set of software execution paths is formed:
[0084] {L k |k∈[1,K]}
[0085] L k =(L k (1),L k (2),...,L k (j),...,L k (num k ))
[0086] Where: L k represents the kth group of software execution paths obtained by conversion; L k (1),L k (2),...,L k (j),...,L k (num k ) represents the software execution path L k The path node sequence in L k (j) represents the software execution path L k The kth path node in , num k Indicates the software execution path L kThe total number of path nodes in the software execution process. This scheme extracts the calling relationship between calling functions from the execution logic of calling functions in the software execution process, takes the calling functions in the software execution process as nodes, and constructs a directed software execution network that represents the execution order of calling functions based on the calling relationship between calling functions. The support of the node is calculated based on the number of predecessor nodes and successor node data of the node in the software execution network. The higher the support, the greater the probability that the node is the initial execution function, and the more software execution paths that can be extracted, thereby converting the software execution network into multiple groups of software execution paths.
[0087] At the same time, this scheme proposes a software execution path importance assessment and parallel test design method, which substitutes the key influence of each node in the software execution network into the software execution path, obtains the key influence of each path node in the software execution path, evaluates the importance of the software execution path, and obtains the importance of each group of software execution paths, where the software execution path L k The importance assessment formula is:
[0088]
[0089] Where: R k Indicates the software execution path L k Based on the importance of the software execution path, the sampling probability of each group of software execution paths is generated, and the test execution of multiple parallel software execution paths is performed according to the sampling probability, where the software execution path L k The sampling probability generation formula is:
[0090]
[0091] Where: p k Indicates the software execution path L k The test execution of multiple parallel software execution paths is performed according to the sampling probability, wherein the test execution process is as follows: sorting the software execution paths in descending order according to the sampling probability; selecting the software execution paths from the sorting results in turn as the current software execution paths to be executed; calculating the probability of the unexecuted software execution paths being executed in parallel with the current software execution paths to be executed, wherein the software execution paths L k and software execution path L s The probability calculation formula for parallel execution is:
[0092]
[0093] in: Indicates the software execution path L k and software execution path L sThe probability of parallel execution; α represents the adjustment parameter, and α is set to 0.2; p s Indicates the software execution path L s , where s∈[1,K], s≠k; based on the probability of parallel execution, select M groups of unexecuted software execution paths and the current software execution path to be executed for multi-path parallel execution, and obtain the software test results of multiple groups of software execution paths in parallel. This scheme combines the support of the node and the frequency of occurrence in the software execution path to calculate the key influence of the node, evaluates the importance of the software execution path, obtains the importance of each group of software execution paths, and converts the importance of the software execution path into a sampling probability. The higher the importance, the higher the frequency of the software execution path being called by different software execution paths, and the lower the corresponding sampling probability, avoiding multiple tests on the same calling function, and combining the probability of parallel execution of any multiple groups of software execution paths to realize multi-path parallel software automated testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] Figure 1 A flowchart of a multi-channel parallel software automation testing method provided by an embodiment of the present invention;
[0095] Figure 2 A schematic diagram of the structure of an electronic device for implementing a multi-path parallel software automated testing method provided by an embodiment of the present invention.
[0096] In the figure: 1 electronic device, 10 processor, 11 memory, 12 program, 13 communication interface.
[0097] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0098] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0099] The embodiment of the present application provides a multi-channel parallel software automation testing method. The execution subject of the multi-channel parallel software automation testing method includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the multi-channel parallel software automation testing method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0100] Embodiment 1:
[0101] S1: The calling functions in the software execution process are taken as nodes, and the calling relationships between the calling functions are extracted from the execution logic of the calling functions in the software execution process to construct a software execution network. The deep traversal algorithm is used to convert the software execution network into multiple groups of software execution paths, where the path nodes in the software execution paths are the calling functions.
[0102] In the step S1, the calling functions in the software execution process are used as nodes, and the calling relationships between the calling functions are extracted from the execution logic of the calling functions in the software execution process, including:
[0103] The functions that are called during the software execution process are extracted as the calling functions during the software execution process. The calling functions during the software execution process are taken as nodes. The calling relationships between the calling functions are extracted from the execution logic of the calling functions during the software execution process. Based on the calling relationships between the calling functions, the software execution network is constructed. The calling relationship extraction process between the calling functions is as follows:
[0104] If the function execution result of one set of calling functions is the input of the next set of calling functions, it means that there is an execution logic between the two sets of calling functions, and the order of the two sets of calling functions in the execution logic is used as the calling relationship between the two sets of calling functions.
[0105] In the step S1, a software execution network is constructed based on the calling relationship between the calling functions, including:
[0106] The calling functions in the software execution process are taken as nodes, and the software execution network is constructed based on the calling relationship between the calling functions. The representation of the software execution network is:
[0107] G=(E,V)
[0108] E={e n |n∈[1,N]}
[0109] V={v(n,i)|n∈[1,N],i∈[1,N],i≠n}
[0110] in:
[0111] G represents the representation of the software execution network, E represents the set of nodes in the software execution network, and V represents the set of node relationships in the software execution network;
[0112] e n represents the nth node in the software execution network, corresponding to the nth group of calling functions, and N represents the total number of nodes in the software execution network;
[0113] v(n,i) represents the node e in the software execution network n With node e iThe calling relationship between the corresponding calling functions;
[0114] v(n,i)={-1,0,1}, v(n,i)=1 represents node e n For node e i The predecessor node, that is, node e n The function execution result of the corresponding calling function is node e i The input of the corresponding calling function is represented by node e in the software execution network. n Point to node e i ; v(n,i)=0 means node e n With node e i There is no calling relationship between the corresponding calling functions. In the software execution network, node e n With node e i There is no pointing relationship; v(n,i) = -1 means node e n For node e i The successor node, that is, node e i The function execution result of the corresponding calling function is node e n The input of the corresponding calling function is represented by node e in the software execution network. i Point to node e n ;
[0115] A deep traversal algorithm is used to convert the software execution network into multiple sets of software execution paths.
[0116] In the step S1, a deep traversal algorithm is used to convert the software execution network into multiple groups of software execution paths, including:
[0117] The deep traversal algorithm is used to convert the software execution network into multiple sets of software execution paths, where the traversal process of the software execution path is:
[0118] S11: Calculate the total number of predecessor nodes and successor nodes of each node in the software execution network, where node e n The total number of predecessor nodes is x n , the total number of successor nodes is y n ;
[0119] S12: Calculate the support of each node in the software execution network, where node e n The support calculation formula is:
[0120]
[0121] in:
[0122] E n Represents node e n support level;
[0123] Indicates the preset successor node number threshold;
[0124] exp(·) represents an exponential function with a natural constant as the base;
[0125] S13: sorting the nodes in the software execution network in descending order of support;
[0126] S14: Select nodes in sequence as current path nodes according to the sorting results;
[0127] S15: adding the current path node to the current software execution path as a path node, wherein the current software execution path is initially empty;
[0128] S16: If the current path node has a successor node, and the successor node does not exist in the current software execution path, the successor node is used as the current path node, and the process returns to step S15; otherwise, the current software execution path is extracted, and the process returns to the previous current path node to reselect a different subsequent node and extract the software execution path for backtracking until the node selected in step S14 is backtracked, and the process returns to step S14 to select the next node in the sorting as the current path node;
[0129] S17: Repeat steps S14-S16 to obtain multiple groups of software execution paths, and perform software execution path coverage, wherein the software execution path coverage rule is: if the lengths of two groups of software execution paths differ by one node, namely, u and u+1 nodes respectively, and the first u nodes of the two groups of software execution paths are the same, then the longer software execution path is used to cover the other group of software execution paths;
[0130] The software execution path set is:
[0131] {L k |k∈[1,K]}
[0132] L k =(L k (1),L k (2),...,L k (j),...,L k (num k ))
[0133] in:
[0134] L k represents the kth group of software execution paths obtained by conversion;
[0135] L k (1),L k (2),...,L k (j),...,Lk (num k ) represents the software execution path L k The path node sequence in L k (j) represents the software execution path L k The kth path node in , num k Indicates the software execution path L k The total number of path nodes in .
[0136] S2: Calculate the key influence of the nodes in the software execution network to obtain the key influence of each node.
[0137] In step S2, key influence calculation is performed on nodes in the software execution network, including:
[0138] The key influence calculation is performed on the nodes in the software execution network, where the node e n The key influence calculation formula is:
[0139]
[0140] in:
[0141] value n Represents node e n Calculation results of key influences;
[0142] count(e n ) indicates that there is a node e in the K group of software execution paths. n The number of software execution paths.
[0143] S3: Substitute the key influence of each node in the software execution network into the corresponding path node in the software execution path, evaluate the importance of the software execution path, and obtain the importance of each group of software execution paths.
[0144] In the step S3, the key influence of each node in the software execution network is substituted into the software execution path, and the importance of the software execution path is evaluated to obtain the importance of each group of software execution paths, including:
[0145] Substitute the key influence of each node in the software execution network into the software execution path to obtain the key influence of each path node in the software execution path, evaluate the importance of the software execution path, and obtain the importance of each group of software execution paths, where the software execution path L k The importance assessment formula is:
[0146]
[0147] in:
[0148] R k Indicates the software execution path L k The importance of.
[0149] S4: Based on the importance of the software execution paths, generate sampling probabilities for each group of software execution paths, and perform test execution on multiple parallel software execution paths according to the sampling probabilities.
[0150] In step S4, based on the importance of the software execution paths, the sampling probability of each group of software execution paths is generated, including:
[0151] Based on the importance of the software execution path, the sampling probability of each group of software execution paths is generated, and the test execution of multiple parallel software execution paths is performed according to the sampling probability, where the software execution path L k The sampling probability generation formula is:
[0152]
[0153] in:
[0154] p k Indicates the software execution path L k The sampling probability of .
[0155] In the step S4, the test execution of multiple parallel software execution paths is performed according to the sampling probability, including:
[0156] The test execution of multiple parallel software execution paths is performed according to the sampling probability, and the test execution process is as follows:
[0157] S41: sorting the software execution paths in descending order of sampling probability;
[0158] S42: Selecting software execution paths from the sorting results in sequence as the software execution paths to be currently executed;
[0159] S43: Calculate the probability that the unexecuted software execution path and the currently executed software execution path are executed in parallel, where the software execution path L k and software execution path L s The probability calculation formula for parallel execution is:
[0160]
[0161] in:
[0162] Indicates the software execution path L k and software execution path L s The probability of parallel execution;
[0163] α represents the adjustment parameter, and α is set to 0.2;
[0164] p s Indicates the software execution path L s The sampling probability of , where s∈[1,K], s≠k;
[0165] S44: Based on the probability of parallel execution, select M groups of unexecuted software execution paths and the current software execution path to be executed for multi-path parallel execution, obtain software test results of parallel execution of multiple groups of software execution paths, and return to step S42.
[0166] Embodiment 2:
[0167] like Figure 2 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a multi-channel parallel software automation testing method provided by an embodiment of the present invention.
[0168] The electronic device 1 may include a processor 10 , a memory 11 , a communication interface 13 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as a program 12 .
[0169] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. The memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 may be used not only to store application software and various types of data installed in the electronic device 1, such as the code of the program 12, etc., but also to temporarily store data that has been output or is to be output.
[0170] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (such as programs 12 for implementing multi-channel parallel software automated testing) and calls data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
[0171] The communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices, and to achieve connection and communication between internal components of the electronic device.
[0172] The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0173] Figure 2 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 2 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0174] For example, although not shown, the electronic device 1 may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, etc. The electronic device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0175] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0176] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0177] The program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0178] The calling functions in the software execution process are taken as nodes, and the calling relationships between the calling functions are extracted from the execution logic of the calling functions in the software execution process to construct a software execution network. The software execution network is converted into multiple groups of software execution paths using a deep traversal algorithm, where the path nodes in the software execution paths are calling functions.
[0179] Calculate the key influence of nodes in the software execution network to obtain the key influence of each node;
[0180] Substitute the key influence of each node in the software execution network into the corresponding path node in the software execution path, evaluate the importance of the software execution path, and obtain the importance of each group of software execution paths;
[0181] Based on the importance of the software execution paths, a sampling probability of each group of software execution paths is generated, and the test execution of multiple parallel software execution paths is performed according to the sampling probability.
[0182] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to Figure 1 to Figure 2 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0183] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0184] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0185] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A multi-channel parallel software automated testing method, characterized in that: The method comprises: S1: Take the calling functions in the software execution process as nodes, extract the calling relationships between the calling functions from the execution logic of the calling functions in the software execution process, build a software execution network, and use the deep traversal algorithm to convert the software execution network into multiple groups of software execution paths, where the path nodes in the software execution path are calling functions; S2: Calculate the key influence of nodes in the software execution network to obtain the key influence of each node; Node e n The key influence calculation formula is: in: E n Represents node e n support level; value n Represents node e n Calculation results of key influences; count(e n ) indicates that there is a node e in the K group of software execution paths. n The number of software execution paths; The node e n The support calculation formula is: in: x n Indicates the total number of predecessor nodes; y n Represents the total number of successor nodes; N represents the total number of nodes in the software execution network; Indicates the preset successor node number threshold; exp(·) represents an exponential function with a natural constant as the base; S3: Substitute the key influence of each node in the software execution network into the corresponding path node in the software execution path, evaluate the importance of the software execution path, and obtain the importance of each group of software execution paths; The importance evaluation formula of the software execution path Lk is: in: R k Indicates the software execution path L k The importance of S4: Based on the importance of the software execution paths, generate sampling probabilities for each group of software execution paths, and perform test execution of multiple parallel software execution paths according to the sampling probabilities; The sampling probability generation formula of the software execution path Lk is: in: p k represents the sampling probability of the software execution path Lk; The test execution of multiple parallel software execution paths is performed according to the sampling probability, and the test execution process is as follows: S41: sorting the software execution paths in descending order of sampling probability; S42: Selecting software execution paths from the sorting results in sequence as the software execution paths to be currently executed; S43: Calculate the probability that the unexecuted software execution path and the currently executed software execution path are executed in parallel, where the software execution path L k and software execution path L s The probability calculation formula for parallel execution is: in: Indicates the software execution path L k and software execution path L s The probability of parallel execution; α represents the adjustment parameter, and α is set to 0.2; p s Indicates the software execution path L s The sampling probability of , where s∈[1,K], s≠k; S44: Based on the probability of parallel execution, select M groups of unexecuted software execution paths and the current software execution path to be executed for multi-path parallel execution, obtain software test results of parallel execution of multiple groups of software execution paths, and return to step S42.
2. A multi-channel parallel software automated testing method as claimed in claim 1, characterized in that: In the step S1, the calling functions in the software execution process are used as nodes, and the calling relationships between the calling functions are extracted from the execution logic of the calling functions in the software execution process, including: The functions that are called during the software execution process are extracted as the calling functions during the software execution process. The calling functions during the software execution process are taken as nodes. The calling relationships between the calling functions are extracted from the execution logic of the calling functions during the software execution process. Based on the calling relationships between the calling functions, the software execution network is constructed. The calling relationship extraction process between the calling functions is as follows: If the function execution result of one set of calling functions is the input of the next set of calling functions, it means that there is an execution logic between the two sets of calling functions, and the order of the two sets of calling functions in the execution logic is used as the calling relationship between the two sets of calling functions.
3. A multi-channel parallel software automated testing method as claimed in claim 2, characterized in that: The software execution network is constructed based on the calling relationship between the calling functions, including: The calling functions in the software execution process are taken as nodes, and the software execution network is constructed based on the calling relationship between the calling functions. The representation of the software execution network is: G=(E,V) And={and n |n∈[1,N]} V={v(n,i)|n∈[1,N],i∈[1,N],i≠n} in: G represents the representation of the software execution network, E represents the set of nodes in the software execution network, and V represents the set of node relationships in the software execution network; e n represents the nth node in the software execution network, corresponding to the nth group of calling functions, and N represents the total number of nodes in the software execution network; v(n, i) represents the node e in the software execution network n With node e i The calling relationship between the corresponding calling functions; v(n, i) = {-1, 0, 1}, v(n, i) = 1 represents node e n For node e i The predecessor node of node e, v(n, i) = 0 means node e n With node e i The corresponding calling function does not have a calling relationship, v(n, i) = -1 means that node e n For node e i The successor node of A deep traversal algorithm is used to convert the software execution network into multiple sets of software execution paths.
4. A multi-channel parallel software automated testing method as claimed in claim 3, characterized in that: In the step S1, a deep traversal algorithm is used to convert the software execution network into multiple groups of software execution paths, including: The deep traversal algorithm is used to convert the software execution network into multiple sets of software execution paths, where the traversal process of the software execution path is: S11: Calculate the total number of predecessor nodes and successor nodes of each node in the software execution network, where node e n The total number of predecessor nodes is x n , the total number of successor nodes is y n ; S12: Calculate the support of each node in the software execution network; S13: sorting the nodes in the software execution network in descending order of support; S14: Select nodes as current path nodes in sequence according to the sorting results; S15: adding the current path node to the current software execution path as a path node, wherein the current software execution path is initially empty; S16: If the current path node has a successor node, and the successor node does not exist in the current software execution path, the successor node is used as the current path node, and the process returns to step S15; otherwise, the current software execution path is extracted, and the process returns to the previous current path node to reselect a different subsequent node and extract the software execution path for backtracking until the node selected in step S14 is backtracked, and the process returns to step S14 to select the next node in the sorting as the current path node; S17: Repeat steps S14-S16 to obtain multiple sets of software execution paths, and perform software execution path coverage; The software execution path set is: {L k |k∈[1,K]} 50 k =(L k (1), L k (2),...,L k (j),...,L k (whether k )) in: L k represents the kth group of software execution paths obtained by conversion; L k (1), L k (2), ..., L k (j), ..., L k (num k ) represents the software execution path L k The path node sequence in L k (j) represents the software execution path L k The jth path node in , num k Indicates the software execution path L k The total number of path nodes in .
Citation Information
Cited By
One-to-thirty-two wireless product comprehensive testing device
CN121604008A
