Software test strategy matching method and device and computer program product

By constructing a test factor decision tree and a strategy forest, the software testing process is optimized, solving the problem that traditional testing methods cannot provide targeted strategies in the early stages of a project. This enables the discovery of problems and timely adjustments during the development phase, improving testing efficiency and quality.

CN120804738APending Publication Date: 2025-10-17中国邮政储蓄银行股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511147772.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Traditional software testing methods cannot provide targeted test strategy combinations in the early stages of a project, resulting in the need for patching later in the software testing process, which affects product quality and user experience.

Method used

By constructing a test factor decision tree and a strategy forest, test strategies are determined based on historical test samples and test factors, and the test process is optimized to identify problems and make timely adjustments during the development phase.

Benefits of technology

In the software development process, by determining the test factor tree model in advance, targeted testing can be carried out before problems occur, avoiding the impact of later patches on product quality and user experience, and improving testing efficiency and quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804738A_ABST
    Figure CN120804738A_ABST
Patent Text Reader

Abstract

The invention provides a software test strategy matching method and device and a computer program product. The method comprises the steps of obtaining a plurality of to-be-selected test strategies; determining a test factor corresponding to each to-be-selected test strategy according to a historical test sample, wherein the historical test sample comprises a value of each test factor and an execution command of each to-be-selected test strategy; constructing a test factor decision tree of each to-be-selected test strategy according to the historical test samples and the test factors, wherein the test factor decision trees are in one-to-one correspondence with the to-be-selected test strategies; obtaining a test factor of to-be-tested software to obtain a target test factor; taking a target test factor with the minimum sequence number in each test factor decision tree as a root node to obtain a test factor tree model of each to-be-selected test strategy; and determining whether to execute the corresponding to-be-selected test strategy according to each test factor tree model. The problem that the overall quality of a product and the user experience are influenced by patching after software testing in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software testing, in particular to a software testing strategy matching method and device, a computer readable storage medium and a computer program product. BACKGROUND

[0002] In the wave of deep transformation of retail business, various software as the core bridge connecting online users not only bears the main responsibility of customer service, but also becomes the forefront of product innovation. However, facing the rapid acceleration of product update iteration speed and the wide application of agile development mode, the traditional single function test method has been unable to meet the needs, and it is difficult to guarantee the high quality and efficient delivery of products. In particular, "tense construction period" forces the project timeline to be constantly compressed, leaving less and less time for the testing process; "compatibility problems frequently occur" requires testing to cover a wider range of devices and operating systems to ensure seamless integration with user environment; "high user experience requirements" have raised the testing standards to an unprecedented level, and any minor flaw may affect user satisfaction. In the face of these severe challenges, the traditional function test mode has been unable to shoulder the responsibility alone, and it is urgent for us to re-examine and optimize the software testing strategy.

[0003] Currently, our testing process relies heavily on traditional function testing methods, without analyzing the preconditions that affect testing and the testing strategies that should be used with scientific methods.

[0004] Often, new testing strategies such as automated testing, compatibility testing, and security testing are added temporarily during the testing process to address emerging problems. More regrettable is that user experience testing is often placed at the end of the testing cycle, or even after the initial delivery of the product, which results in problems being discovered that can only be addressed through emergency patching, seriously affecting the overall quality of the product and user experience. This passive process obviously cannot provide a targeted combination of testing strategies for testing managers based on the specific needs of different projects at the beginning of the project, and cannot pre-configure all necessary testing methods, reasonably plan and allocate testing time and human resources. SUMMARY

[0005] The main purpose of the present application is to provide a software testing strategy matching method, device, computer readable storage medium and computer program product, to at least solve the problem of patching affecting the overall quality and user experience of the product after software testing in the prior art.

[0006] In order to achieve the above object, according to one aspect of the present application, a software test strategy matching method is provided, comprising: obtaining a plurality of candidate test strategies, the candidate test strategies including compatibility test, performance test, security test, contract test, precision test, user experience test, product level test and automation test; determining test factors corresponding to each of the candidate test strategies according to historical test samples, the test factors being variables affecting test processes and test results of the candidate test strategies, the historical test samples including values of each of the test factors and execution commands of each of the candidate test strategies, the execution commands including executing the candidate test strategies and not executing the candidate test strategies; constructing test factor decision trees of each of the candidate test strategies according to the historical test samples and the test factors, the test factor decision trees corresponding to the candidate test strategies one by one; obtaining the test factors of a software to be tested to obtain target test factors; taking the target test factors with the smallest layer order numbers in each of the test factor decision trees as root nodes to obtain test factor tree models of each of the candidate test strategies; and determining whether to execute the corresponding candidate test strategies according to each of the test factor tree models.

[0007] Optionally, determining whether to execute the corresponding candidate test strategies according to each of the test factor tree models comprises: grouping the test factor decision trees of all the candidate test strategies into a strategy forest; calculating values of loss functions of each of the test factor tree models after being added into the strategy forest respectively to obtain a plurality of loss function values, the loss function being used to calculate a difference between an actual test efficiency and an expected test efficiency of the strategy forest; adding the test factor tree model with the smallest loss function value into the strategy forest to obtain an optimized strategy forest; and determining the candidate test strategy corresponding to the test factor tree model added by the optimized strategy forest to be executed.

[0008] Optionally, determining the candidate test strategy corresponding to the test factor tree model added by the optimized strategy forest to be executed, the method further comprises: calculating values of the loss functions of the remaining test factor tree models after being added into the optimized strategy forest respectively to obtain a plurality of optimized loss function values, the optimized loss function being used to calculate a difference between an actual test efficiency and an expected test efficiency of the optimized strategy forest; adding the test factor tree model with the smallest optimized loss function value into the optimized strategy forest to obtain a second optimized strategy forest; and determining the candidate test strategy corresponding to the test factor tree model added by the second optimized strategy forest to be the next executed candidate test strategy.

[0009] Optionally, the loss function values of the test factor tree models added to the strategy forest are calculated respectively to obtain a plurality of loss function values, including: calculating the expected test efficiency corresponding to a plurality of historical test samples; a first calculation step, calculating the value of the loss function of a target test factor tree model added to the strategy forest according to a plurality of expected test efficiencies, to obtain a plurality of sub-loss function values, the target test factor tree model being any one of the test factor tree models; a second calculation step, calculating the sum of a plurality of sub-loss function values to obtain the loss function value corresponding to the target test factor tree model; repeating the first calculation step and the second calculation step at least once in turn until the loss function values corresponding to all test factor tree models are obtained.

[0010] Optionally, a test factor decision tree of each of the candidate test strategies is constructed according to the historical test samples and the test factors, including: calculating the importance of each of the test factors corresponding to the candidate test strategy according to the historical test samples to obtain a plurality of first importance, the importance being used to represent the influence degree of the test factor on whether the candidate test strategy is executed; determining the test factor with the largest first importance as a root node, and setting the classification condition of the root node to divide the historical test samples into two categories to obtain two current historical test sample sets; in the case that the execution commands corresponding to the current historical test sample sets are all the same, determining the child node corresponding to the current historical test sample as a leaf node; in the case that any two of the execution commands corresponding to the current historical test sample sets are different, calculating the importance of the test factors other than the root node according to the current historical test samples to obtain second importance, determining the test factor with the largest second importance as the child node corresponding to the current historical test sample set, and setting the classification condition of the child node corresponding to the current historical test sample set to divide the current historical test samples into two categories to obtain two next-level historical test sample sets; establishing the child nodes corresponding to the two next-level historical test sample sets until the execution commands corresponding to all next-level historical test sample sets are all the same, and determining the child nodes corresponding to all next-level historical test sample sets as leaf nodes.

[0011] Optionally, the importance of each of the test factors corresponding to the candidate test strategy is calculated according to the historical test samples to obtain a plurality of first importance, including: an acquisition step, acquiring the value of a target test factor in the historical test samples to obtain a plurality of values of the target test factor, the target test factor being any one of the test factors corresponding to the candidate test strategy; a third calculation step, calculating the ratio of the number of historical test samples corresponding to each value to the total number of historical test samples to obtain the weight of each value; a fourth calculation step, calculating the importance of each of the test factors corresponding to the candidate test strategy according to the weight of each value. calculating an entropy of each of the values, H(X) is the entropy of the values, X is the values, p i is a probability of the historical test sample corresponding to each of the values corresponding to the execution command being the i-th kind, n is a number of kinds of the execution command; a fifth calculation step, weighting and averaging the entropy of each of the values by using a weight of each of the values to obtain a weighted average entropy of the target test factor; a sixth calculation step, calculating a difference value between an initial entropy value and the weighted average entropy of the target test factor to obtain an information gain of the target test factor, taking the information gain of the test factor as a first importance of the target test factor, the initial entropy value is an entropy of the execution command of the historical test sample; sequentially repeating the acquisition step, the third calculation step, the fourth calculation step, the fifth calculation step and the sixth calculation step at least once until all the first importance is obtained.

[0012] Optionally, the test factor of the software to be tested is acquired to obtain a target test factor, comprising: acquiring the test factor of the software to be tested at different stages of the software to be tested respectively to obtain the target test factor of each stage, the stages comprising a development stage, a test stage and an online stage.

[0013] According to another aspect of the present application, a software test strategy matching device is provided, comprising: a first acquisition unit, configured to acquire a plurality of candidate test strategies, the candidate test strategies comprising compatibility test, performance test, security test, contract test, precision test, user experience test, product level test and automation test; a first determination unit, configured to determine a test factor corresponding to each of the candidate test strategies according to a historical test sample, the test factor being a variable affecting a test process and a test result of the candidate test strategy, the historical test sample comprising a value of each of the test factors and an execution command of each of the candidate test strategies, the execution command comprising executing the candidate test strategy and not executing the candidate test strategy; a construction unit, configured to construct a test factor decision tree of each of the candidate test strategies according to the historical test sample and the test factor, the test factor decision tree corresponding to the candidate test strategy one by one; a second acquisition unit, configured to acquire the test factor of the software to be tested to obtain a target test factor; a selection unit, configured to take the target test factor with the smallest layer sequence number in each of the test factor decision trees as a root node to obtain a test factor tree model of each of the candidate test strategies; a second determination unit, configured to determine whether to execute the corresponding candidate test strategy according to each of the test factor tree models.

[0014] According to still another aspect of the present application, a computer readable storage medium is provided, which comprises a stored program, wherein the computer readable storage medium controls a device where the computer readable storage medium is located to perform any of the methods when the program is run.

[0015] According to still another aspect of the present application, a computer program product is provided, which comprises a computer program, wherein the computer program is executed by a processor to implement any of the methods.

[0016] According to the technical solution of the present application, the matching method of the software testing strategy, the conventional testing method of the software is obtained as the selected testing strategy, the testing factors corresponding to the selected testing strategy are summarized according to the historical testing sample of the selected testing strategy, for example, the testing factors of the product-level testing include the terminal type, the testing factor decision tree of each selected testing strategy is constructed by selecting each testing factor as each layer node of the decision tree according to the historical testing sample, the testing factor selected by the relevant personnel for the software to be tested is obtained as the target testing factor, that is, the current important testing factor, the target testing factor with the smallest layer number in each testing factor decision tree is taken as the root node, the testing factor tree model of each selected testing strategy is obtained, that is, the testing factor tree model customized for the target testing factor of the software to be tested, and whether the corresponding selected testing strategy is executed is determined through the testing factor tree model. This method can select the current important testing factor at any stage of the software to be tested, so as to determine whether the selected testing strategy is executed, and the problem development stage is tested, so that the corresponding selected testing strategy does not need to be executed after the development is completed and the problem appears, and the overall quality and user experience of the product are affected by the patch. The problem that the overall quality and user experience of the product are affected by the patch in the prior art is solved. BRIEF DESCRIPTION OF DRAWINGS

[0017] Figure 1 A hardware structure block diagram of a mobile terminal for implementing a matching method of a software testing strategy according to an embodiment of the present application is shown;

[0018] Figure 2 A flowchart of a matching method of a software testing strategy according to an embodiment of the present application is shown;

[0019] Figure 3 A curve diagram of H(X) according to an embodiment of the present application is shown;

[0020] Figure 4 A schematic diagram of a testing factor decision tree of a compatibility test according to an embodiment of the present application is shown;

[0021] Figure 5 A structure block diagram of a matching device of a software testing strategy according to an embodiment of the present application is shown.

[0022] In the above drawings, reference numerals:

[0023] 102, processor; 104, memory; 106, transmission device; 108, input and output device. DETAILED DESCRIPTION

[0024] It should be noted that the embodiments and features in the present application can be combined with each other without conflict. The technical solutions in the embodiments of the present application will be described in detail below with reference to the drawings and in combination with the embodiments.

[0025] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0026] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units need not be limited to those clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0027] For the convenience of description, the following describes some nouns or terms related to the embodiments of the present application:

[0028] Test factor: refers to the key variable or condition that affects the test process and result, which can be technical, such as architecture type, system component, etc.; it can also be related to business, such as the nature and importance of demand; it can also be related to the test process itself, such as test stage, engineering type, duration and personnel skills, etc.

[0029] Decision tree: a tree structure-based machine learning algorithm that classifies sample data into different leaf nodes through a series of conditional judgments (i.e. internal nodes), thereby achieving the classification task. In the decision tree, each internal node represents a test on a feature attribute, each branch represents a test result, and each leaf node represents a class or output value.

[0030] As introduced in the background technology, in the prior art, patching after software testing affects the overall quality of the product and user experience. To solve this technical problem, the embodiments of the present application provide a software testing strategy matching method, device, computer-readable storage medium, and computer program product.

[0031] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.

[0032] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a mobile terminal according to a software testing strategy matching method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0033] The memory 104 can be used to store computer programs, such as software programs of application software and modules, such as a computer program corresponding to the matching method of the software testing strategy in the embodiments of the present application. The processor 102 can execute various functional applications and data processing, i.e., implement the above method, by running the computer program stored in the memory 104. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, which can be connected to the mobile terminal through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The specific examples of the above network can include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet in a wireless manner.

[0034] In the embodiments, a matching method of a software testing strategy running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0035] Figure 2 is a flowchart of the matching method of the software testing strategy according to the embodiments of the present application. As shown in Figure 2 , the method includes the following steps:

[0036] In step S201, a plurality of candidate testing strategies are acquired. The candidate testing strategies include compatibility testing, performance testing, security testing, contract testing, precision testing, user experience testing, product level testing, and automation testing.

[0037] Specifically, each test factor (defined as feature x) involved in each test strategy in the collection project is collected according to whether the test factor is involved in the test method (defined as target y). The test factor (x) is divided into six categories: architecture factor, system factor, technology factor, requirement factor, test factor, and personnel factor. The test method (y) includes compatibility test, performance test, security test, contract test, precision test, user experience test, product level test, automation test, internationalization and localization test.

[0038] In step S202, the test factors corresponding to each of the candidate test strategies are determined according to historical test samples, the test factors are variables affecting the test process and test results of the candidate test strategies, the historical test samples include values of the test factors and execution commands of the candidate test strategies, and the execution commands include execution of the candidate test strategies and non-execution of the candidate test strategies.

[0039] Specifically, according to the actual project data, the large category factors are further divided, as shown in Table 1, and the historical test samples include values of the test factors and execution commands of the candidate test strategies, so that the test factors corresponding to the candidate test strategies can be summarized.

[0040] Table 1

[0041]

[0042]

[0043] In step S203, the test factor decision tree of each of the candidate test strategies is constructed according to the historical test samples and the test factors, and the test factor decision tree corresponds to the candidate test strategies one by one.

[0044] Specifically, each test strategy corresponds to a decision tree, and the nodes of the decision tree represent the test factors and the branches represent the values of the test factors.

[0045] In step S204, the test factors of the software to be tested are obtained, and the target test factors are obtained.

[0046] Specifically, the test manager inputs the test factors of the software to be tested, which are the target test factors.

[0047] In step S205, the target test factors with the smallest layer sequence number in each of the test factor decision trees are taken as root nodes, and the test factor tree models of each of the candidate test strategies are obtained.

[0048] Specifically, according to the position of the target test factor in the test factor decision tree of each candidate test strategy, the target test factor with the smallest layer number is selected as the root node, and the test factor tree model of each candidate test strategy is obtained, that is, the target test factor closest to the root node of the test factor decision tree is determined as the root node of the test factor tree model.

[0049] In step S206, it is determined whether to execute the corresponding candidate test strategy according to each test factor tree model.

[0050] Specifically, if the test factor tree model can be added to the decision forest, indicating that the overall test efficiency can be improved, the candidate test strategy corresponding to the test factor tree model is executed, otherwise the candidate test strategy corresponding to the test factor tree model is not executed.

[0051] The matching method of the software test strategy can obtain the conventional test method of the software as a candidate test strategy, and can induce the test factor corresponding to the candidate test strategy according to the historical test sample of the candidate test strategy. For example, the test factor of product-level testing includes terminal type, each test factor is selected as each layer node of the decision tree according to the historical test sample to construct the test factor decision tree of each candidate test strategy, the test factor selected by the relevant personnel for the software to be tested is obtained as the target test factor, that is, the current important test factor, the target test factor with the smallest layer number in each test factor decision tree is taken as the root node, and the test factor tree model of each candidate test strategy is obtained, that is, the test factor tree model customized for the target test factor of the software to be tested. Whether to execute the corresponding candidate test strategy can be determined through the test factor tree model. This method can select the current important test factor at any stage of the software to be tested, so as to determine whether to execute the candidate test strategy, and solve the problem in the development stage, so that the corresponding candidate test strategy does not need to be executed after the development is completed. The overall quality and user experience of the product are affected by the patch, which solves the problem that the overall quality and user experience of the product are affected by the patch in the prior art. In addition, this method can refine complex test requirements into a series of independent test factors. Through the combination of these factors and the decision tree algorithm, the test manager can flexibly combine these test factors according to the specific requirements of the project, and quickly build the most suitable test strategy for the current situation.

[0052] In order to improve the test efficiency, in an optional implementation, the step S206 includes:

[0053] In step S2061, the test factor decision trees of all candidate test strategies are combined into a strategy forest.

[0054] Step S2062, respectively calculate the numerical value of the loss function of each of the above test factor tree model after adding the above strategy forest, obtain a plurality of loss function values, the above loss function is used to calculate the difference between the actual test efficiency and the expected test efficiency of the above strategy forest;

[0055] Step S2063, add the test factor tree model with the minimum loss function value to the above strategy forest to obtain an optimized strategy forest;

[0056] Step S2064, determine the above test strategy corresponding to the test factor tree model added by the above optimized strategy forest.

[0057] In the above embodiment, the test factor decision tree of all the above test strategies is composed into a strategy forest, and the selected test factor tree model is added to the strategy forest for calculation to obtain a loss function value. The minimum loss function value indicates that the actual test efficiency and the expected test efficiency of the test factor tree model are closest to each other, and the effect of improving the efficiency is evaluated. This process ensures that the combination of test methods in the strategy forest can effectively improve the test efficiency.

[0058] In order to select the test strategy, in an optional embodiment, the above step S2064 comprises:

[0059] Step S20641, respectively calculate the numerical value of the loss function of each of the above test factor tree model after adding the above strategy forest, obtain a plurality of loss function values, the above loss function is used to calculate the difference between the actual test efficiency and the expected test efficiency of the above strategy forest;

[0060] Step S20642, add the test factor tree model with the minimum loss function value to the above strategy forest to obtain an optimized strategy forest;

[0061] Step S20643, determine the above test strategy corresponding to the test factor tree model added by the above optimized strategy forest.

[0062] In the above embodiment, the above steps are repeated to obtain the next executed test strategy, and the strategy forest is gradually iterated and optimized. Of course, not all test strategies are executed. By setting the iteration round m, m test strategies can be selected for execution, as shown in Table 2. In Table 2, the formula of the loss function L(y i ,F m-1 (x i )+h(x i )) is L(y i ,F m-1 (x i )+h(xi )) = 1 / 2(y i - (F m-1 (x i ) + h(x i )) 2 , y i represents the expected test efficiency, which is usually determined in the following ways: (1) based on historical data or benchmark strategy: y i is the actual test efficiency of the historical optimal strategy, for example, in test case optimization, y i may be the execution time, coverage or defect detection rate of the test case under the optimal strategy. (2) based on artificial labeling or expert experience: set the expected target value by the test expert (such as “test coverage should be ≥ 90%”). (3) based on theoretical optimal value: y i may be a theoretical optimal value (such as the shortest test time, maximum coverage, etc.).

[0063] Table 2

[0064]

[0065]

[0066] In order to ensure the accuracy of the test efficiency evaluation, in an optional implementation, the above step S2062 comprises:

[0067] Step S20621, calculate the expected test efficiency corresponding to a plurality of historical test samples;

[0068] Step S20622, first calculation step, according to a plurality of the expected test efficiency, calculate the value of the loss function of the target test factor tree model after adding the strategy forest, obtain a plurality of sub-loss function values, the target test factor tree model is any one of the test factor tree model;

[0069] Step S20623, second calculation step, calculate the sum of a plurality of the sub-loss function values, obtain the loss function value corresponding to the target test factor tree model;

[0070] Step S20624, repeat the first calculation step and the second calculation step at least once in turn, until the loss function values corresponding to all the test factor tree models are obtained.

[0071] In the above embodiment, each historical test sample corresponding to the to-be-selected test strategy corresponds to an expected test efficiency, and a plurality of expected test efficiencies correspond to a plurality of loss function values, i.e., a plurality of sub-loss function values. The sum of the plurality of sub-loss function values is calculated as the loss function value corresponding to the target test factor tree model, so as to avoid inaccurate efficiency evaluation caused by a single historical test sample and improve the accuracy of test efficiency evaluation.

[0072] To construct the test factor decision tree, in an optional embodiment, the step S203 includes:

[0073] In step S2031, the importance of each test factor corresponding to the to-be-selected test strategy is calculated according to the historical test sample, and a plurality of first importance is obtained. The importance is used to represent the influence degree of the test factor on whether the to-be-selected test strategy is executed.

[0074] In step S2032, the test factor with the largest first importance is determined as the root node, and the classification condition of the root node is set to divide the historical test sample into two categories, and two current historical test sample sets are obtained.

[0075] In step S2033, in the case that the execution commands corresponding to the current historical test sample sets are all the same, the child node corresponding to the current historical test sample is determined as a leaf node.

[0076] In step S2034, in the case that any two of the execution commands corresponding to the current historical test sample sets are different, the importance of the test factor other than the root node is calculated according to the current historical test sample, and a second importance is obtained. The test factor with the largest second importance is determined as the child node corresponding to the current historical test sample set, and the classification condition of the child node corresponding to the current historical test sample set is set to divide the current historical test sample into two categories, and two next-level historical test sample sets are obtained.

[0077] In step S2035, the child node corresponding to the two next-level historical test sample sets is established, until the execution commands corresponding to all the next-level historical test sample sets are all the same, and the child node corresponding to all the next-level historical test sample sets is determined as a leaf node.

[0078] In the above embodiments, the branch node of the decision tree is generated based on the principle of maximum information gain, and the specific steps are as follows: root node selection, selecting the test factor with the maximum information entropy (H(X)) as the root node. For example, if the entropy value of the "test phase" is the maximum, it is selected as the root node. Branch node generation, split condition: dividing the samples according to the value of the test factor. For example, if the root node is "test phase ≤ 0.5" (such as "requirement review phase"), the branches can be "yes" or "no". Recursive splitting: for each subset of the branch, the information gain of the remaining test factors is repeatedly calculated, and the factor with the maximum entropy value is selected as the next layer node. Termination condition: when the node purity reaches a threshold (such as all samples belong to the same class) or cannot be further split, the node becomes a leaf node, and is marked as the final test strategy. When p = 0 or p = 1, H(p) = 0, and the random variable has no uncertainty, when p = 0.5, H(p) = 1, and the uncertainty of the random variable is the largest, such as Figure 3shown. For example, assume we have collected the following test data from historical projects for building a decision tree for compatibility testing, test factors (features x): client refactoring (whether refactoring is needed for the client, taking the value True / False), test phase (phase number: 0 = requirement review, 1 = development phase, 2 = testing phase), device type (iOS, Android, HarmonyOS), target y: whether compatibility testing is needed (Yes / No). The dataset is shown in Table 3. Root node selection: the criterion is the test factor with the largest information gain. The entropy value of each factor needs to be calculated respectively. Distribution of target variable y: Yes (3 times), No (1 time); total sample size = 4, initial entropy value: H(y) = -(3 / 4log2(3 / 4) + 1 / 4log2(1 / 4)) = 0.811, candidate factor entropy value calculation, client refactoring (True / False): True branch: 2 samples (y = Yes: 2, No: 0) -> entropy = 0, False branch: 2 samples (y = Yes: 1, No: 1) -> entropy = 1, weighted average entropy: H(client refactoring) = -(2 / 4*0 + 2 / 4*1) = 0.5, information gain: Gain = H(y) - H(client refactoring) = 0.811 - 0.5 = 0.311, similarly: H(test phase) = 0, Gain = 0.811, H(device type) = 0.5, Gain = 0.311, the information gain of test phase is the largest (0.811), so it is selected as the root node. Branch node generation: condition division of True and False, after the root node "test phase", the branches need to be divided according to its value. Assume we divide the test phase into two categories: condition: test phase <= 1.5 (i.e. stages 0 and 1 are True, stage 2 is False). This is a threshold set according to actual business requirements or data distribution, as shown in Table 4. True branch (test phase <= 1.5): entropy value calculation: H(True) = -(2 / 3log2(2 / 3) + 1 / 3log2(1 / 3)) = 0.918, further split is needed, select the next test factor. False branch (test phase > 1.5): entropy value = 0 (all samples are Yes), no further split is needed, become a leaf node. Sub-node selection: client refactoring as the next split node, in the True branch, the remaining candidate factors are client refactoring and device type.The information gain of each of them needs to be calculated, and the client modification (True / False) is True. The branch: 1 sample (y=Yes:2)→entropy=0, the False branch: 2 samples (y=No:1)→entropy=0, the weighted average entropy: H (client modification) =-(1 / 3*0+2 / 3*0)=0, the information gain: Gain=0.918-0=0.918, the client modification gain is equal to the device type gain, the client modification or the device type is selected as the sub-node, and the entropy value=0, each branch becomes a leaf node, and the node selection is completed. In a specific example, a test factor decision tree of a compatibility test is shown in FIG. 1. Figure 4 As shown in FIG. 1, entropy (information entropy): represents the impurity of the current node, and is used to measure the degree of confusion of the sample categories. Entropy=0: all samples in the node belong to the same class (completely pure). Entropy close to 1: the sample category distribution is uniform (highly impure). samples (sample number): the total number of samples contained in the current node; value (category distribution): a list indicating the number of samples of each category in the current node; class (predicted category): the classification result of the current node; client modification≤0.5, test stage≤0.5, etc. are feature split conditions, which represent that the samples are divided according to the threshold value of a certain feature. The leaf node (such as the node with entropy=0.0) represents the final classification result, and does not need to be further split.

[0079] Table 3

[0080] Item Number Client Refit Test Phase Device Type Compatibility Test (y) 1 True 0 iOS Yes 2 False 1 Android No 3 True 0 HarmonyOS Yes 4 False 2 Android Yes

[0081] Table 4

[0082] Branch Condition Sample Distribution y = Yes Y = No Test Phase < 1.5 Projects 1, 2, 3 2 1 Test Phase > 1.5 Project 4 1 0

[0083] To calculate the first importance, in an optional implementation, the step S2031 includes:

[0084] In step S20311, a step of acquiring the value of the target test factor in the historical test sample is performed, and a plurality of values of the target test factor are obtained, the target test factor being any one of the test factors corresponding to the test strategy to be selected;

[0085] In step S20312, a third calculation step of calculating the ratio of the number of the historical test sample corresponding to each value to the total number of the historical test sample is performed, and the weight of each value is obtained;

[0086] In step S20313, a fourth calculation step of calculating the entropy of each value according to H (X) is the entropy of the value X, and p is the weight of the value X. iA probability of each of the above-mentioned values corresponding to the above-mentioned historical test sample corresponding to the above-mentioned execution command being the i-th kind, n is the number of kinds of the above-mentioned execution command;

[0087] In step S20314, a fifth calculation step, the entropy of each of the above-mentioned values is weighted and averaged using the weight of each of the above-mentioned values to obtain a weighted average entropy of the above-mentioned target test factor;

[0088] In step S20315, a sixth calculation step, the difference between the initial entropy value and the weighted average entropy of the above-mentioned target test factor is calculated to obtain the information gain of the above-mentioned target test factor, which is the first importance of the above-mentioned test factor, and the initial entropy value is the entropy of the above-mentioned execution command of the above-mentioned historical test sample;

[0089] In step S20316, the above-mentioned obtaining step, the above-mentioned third calculation step, the above-mentioned fourth calculation step, the above-mentioned fifth calculation step and the above-mentioned sixth calculation step are repeated at least once in turn until all the above-mentioned first importance is obtained.

[0090] In the above-mentioned embodiment, the information gain is used as a measure to calculate the classification after branching selection by different test factors, and the best one is found as the root node, and so on, H(X) is a core concept in information theory, used to quantify the expected value of uncertainty or information content of a random variable X. In the decision tree model, the random variable X represents the value of the test factor. For example, a test factor may be "system architecture type", which can take the value of "monolithic architecture" or "microservice architecture". Test factors are variables that affect test strategy selection (such as requirement complexity, test phase, personnel skills, etc.), while X is the actual value of these factors in a specific project, used to construct the classification conditions of the decision tree. pi represents the probability of the random variable X taking the i-th possible value, which must satisfy 0≤pi≤1 and ∑pi=1. n represents the number of possible values of the random variable X, i.e. the size of the sample space or the total number of events. pi represents the probability of the random variable X taking the i-th value in a certain test strategy. For example, in the "compatibility test" strategy, if the test factor "device type" has 3 values (iOS, Android, HarmonyOS), and the historical data shows that iOS accounts for 50%, Android accounts for 30%, and HarmonyOS accounts for 20%, then: p1=0.5 (the probability of iOS appearing), p2=0.3 (the probability of Android appearing), p2=0.2 (the probability of HarmonyOS appearing), so the greater the entropy value, the greater the uncertainty of the test factor that needs to be improved in the test strategy, and the difference between the initial entropy value and the weighted average entropy of the above-mentioned target test factor is calculated to obtain the information gain of the above-mentioned target test factor, which is the first importance.

[0091] It should be noted that as the division process continues, the samples contained in the branch nodes belong to the same category as much as possible, that is, the "purity" of the nodes is higher and higher. When the number of yes and no is the same, it is a leaf node. Pruning low importance factors: remove test factors with importance lower than a set threshold. Pruning low probability test factors: by pruning low probability test factors, the complexity of the model can be reduced, the generalization ability can be improved, and the time complexity and space complexity can be reduced. The pruning method includes: factor importance evaluation based on information gain or Gini coefficient. Set the threshold, remove test factors with importance lower than the threshold. Generate test factor decision tree: each test strategy corresponds to a decision tree, and the nodes of the decision tree represent test factors and branches represent the values of test factors. The pruned decision tree is more concise, easy to understand and execute. Prune test factors with low probability to improve the generalization ability of the model, while reducing the time complexity and space complexity. According to the algorithm, output the most important test factors for each test method, and cut off the test factors with low purity. Generate a test factor decision tree corresponding to each test strategy.

[0092] In order to realize the test of each full stage, in an optional implementation, the above step S204 includes:

[0093] Step S2041, in different stages of the software to be tested, the test factors of the software to be tested are obtained respectively, and the target test factors of each stage are obtained, and the stages include the development stage, the test stage and the online stage.

[0094] In the above embodiment, in different stages of the software to be tested, the test manager can enter the interface to select various test factors and click OK. The model traverses the test factors selected by the test manager in the decision forest. If the root node is hit, the test method is directly selected and put into the test strategy combination pool. If other nodes are hit, whether the current test method is important is judged according to the position of the test factor in the tree model.

[0095] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.

[0096] The embodiment of the present application further provides a software testing strategy matching device. It should be noted that the software testing strategy matching device of the embodiment of the present application can be used to execute the software testing strategy matching method provided by the embodiment of the present application. The device is used to realize the above-mentioned embodiment and preferred embodiment, and details are not repeated. As used below, the term "module" can be a combination of software and / or hardware that realizes a predetermined function. Although the device described in the following embodiment is preferably realized in software, hardware, or a combination of software and hardware is also possible and conceived.

[0097] The software testing strategy matching device provided by the embodiment of the present application is described below.

[0098] Figure 5 is a structural block diagram of the software testing strategy matching device according to the embodiment of the present application. As shown in Figure 5 , the device comprises:

[0099] The first acquisition unit 10 is configured to acquire a plurality of candidate testing strategies, wherein the candidate testing strategies comprise compatibility testing, performance testing, security testing, contract testing, precision testing, user experience testing, product level testing and automation testing.

[0100] Specifically, each test factor (defined as feature x) involved in each testing strategy in the project is collected according to whether the test factor is involved in the test method (defined as target y). Test factor (x): divided into six categories: architecture factor, system factor, technology factor, requirement factor, test factor, and personnel factor. Test method (y): compatibility testing, performance testing, security testing, contract testing, precision testing, user experience testing, product level testing, automation testing, internationalization and localization testing.

[0101] The first determination unit 20 is configured to determine test factors corresponding to each of the candidate testing strategies according to historical test samples, wherein the test factors are variables affecting the test process and test results of the candidate testing strategies, the historical test samples comprise values of the test factors and execution commands of the candidate testing strategies, and the execution commands comprise executing the candidate testing strategies and not executing the candidate testing strategies.

[0102] Specifically, according to the actual project data, the large category factors are further divided, as shown in Table 1, the historical test samples comprise values of the test factors and execution commands of the candidate testing strategies, and the test factors corresponding to the candidate testing strategies can be summarized.

[0103] The construction unit 30 is configured to construct test factor decision trees of each of the candidate testing strategies according to the historical test samples and the test factors, wherein the test factor decision trees correspond to the candidate testing strategies one by one.

[0104] Specifically, each test strategy corresponds to a decision tree, the nodes of the decision tree represent test factors, and the branches represent the values ​​of the test factors.

[0105] The second acquisition unit 40 is used to acquire the test factors of the software to be tested to obtain target test factors;

[0106] Specifically, the test manager inputs the test factor of the software to be tested, which is the target test factor.

[0107] A selection unit 50 is configured to use the target test factor with the smallest layer number in each of the test factor decision trees as a root node to obtain a test factor tree model for each of the test strategies to be selected;

[0108] Specifically, according to the position of the target test factor in the test factor decision tree of each candidate test strategy, the target test factor with the smallest layer sequence number is selected as the root node, and the test factor tree model of each candidate test strategy can be obtained, that is, the target test factor closest to the root node of the test factor decision tree is determined as the root node of the test factor tree model.

[0109] The second determining unit 60 is configured to determine whether to execute the corresponding candidate test strategy according to each of the test factor tree models.

[0110] Specifically, if the test factor tree model can be added to the decision forest, indicating that the overall test efficiency can be improved, the candidate test strategy corresponding to the test factor tree model is executed; otherwise, the candidate test strategy corresponding to the test factor tree model is not executed.

[0111] In the matching device of the software testing strategy, the routine testing method of the software is obtained as a candidate testing strategy, and the testing factors corresponding to the candidate testing strategy are summarized according to the historical testing samples of the candidate testing strategy. For example, the testing factors of the product-level testing include terminal types, and the testing factor decision trees of each candidate testing strategy are constructed by selecting each testing factor as each layer node of the decision tree according to the historical testing samples, so that the testing factor selected by the relevant personnel for the software to be tested is obtained as the target testing factor, that is, the current important testing factor. The target testing factor with the smallest layer number in each testing factor decision tree is taken as the root node, and the testing factor tree model of each candidate testing strategy is obtained, that is, the testing factor tree model customized for the target testing factor of the software to be tested. Whether the corresponding candidate testing strategy is executed can be determined through the testing factor tree model. The method can select the current important testing factor at any stage of the software to be tested, so as to determine whether the candidate testing strategy is executed, and the problem in the development stage is tested and solved, without waiting for the development to be completed and the corresponding candidate testing strategy to be executed after the problem occurs. The overall quality and user experience of the product are affected by the patch, which solves the problem that the overall quality and user experience of the product are affected by the patch in the prior art.

[0112] In addition, the method refines complex testing requirements into a series of independent testing factors. By combining these testing factors with the decision tree algorithm, the testing manager can flexibly combine these testing factors according to the specific requirements of the project, quickly build the most suitable testing strategy for the current situation, and solve the problem that the overall quality and user experience of the product are affected by the patch in the prior art.

[0113] In order to improve the testing efficiency, in an optional implementation, the second determination unit includes:

[0114] The combination module is configured to combine the testing factor decision trees of all the candidate testing strategies into a strategy forest.

[0115] The first calculation module is configured to calculate the numerical value of the loss function of each testing factor tree model after being added to the strategy forest, to obtain a plurality of loss function values, and the loss function is used to calculate the difference between the actual testing efficiency and the expected testing efficiency of the strategy forest.

[0116] The addition module is configured to add the testing factor tree model with the smallest loss function value to the strategy forest to obtain an optimized strategy forest.

[0117] The first determination module is configured to determine the candidate testing strategy corresponding to the testing factor tree model added by the optimized strategy forest.

[0118] In the above embodiment, the test factor decision trees of all the above-mentioned candidate test strategies are combined to form a strategy forest, and the selected test factor tree model is added to the strategy forest for calculation to obtain a loss function value. The minimum loss function value indicates that the actual test efficiency of the test factor tree model is closest to the expected test efficiency, and the promotion effect of the test factor tree model on the efficiency is evaluated. This process ensures that the combination of test methods in the strategy forest can effectively improve the test efficiency.

[0119] To select the candidate test strategy, in an optional embodiment, the first determination module includes:

[0120] The first calculation submodule is configured to calculate the values of the loss functions respectively after the remaining test factor tree models are added to the optimized strategy forest, to obtain a plurality of optimized loss function values. The optimized loss function is used to calculate the difference between the actual test efficiency of the optimized strategy forest and the expected test efficiency.

[0121] The adding submodule is configured to add the test factor tree model with the minimum optimized loss function value to the optimized strategy forest to obtain a second optimized strategy forest.

[0122] The determination submodule is configured to determine that the candidate test strategy corresponding to the test factor tree model added to the second optimized strategy forest is the next candidate test strategy to be executed.

[0123] In the above embodiment, the above steps are repeated to obtain the next candidate test strategy to be executed, and the strategy forest is gradually iteratively constructed and optimized. However, not all candidate test strategies are executed. By setting the iteration round m, m candidate test strategies can be selected for execution, as shown in Table 2. In Table 2, the formula of the loss function L(y i ,F m-1 (x i )+h(x i )) is L(y i ,F m-1 (x i )+h(x i ))=1 / 2(y i -(F m-1 (x i )+h(x i ))) 2 , y i represents the expected test efficiency, which is usually determined in the following way: (1) based on historical data or a benchmark strategy: y i is the actual test efficiency of the historical optimal strategy. For example, in test case optimization, y iThe test case can be the execution time, coverage, or defect detection rate of the optimal strategy.(2) Based on artificial labeling or expert experience: the expected target value is set by the test expert (such as "test coverage should be ≥ 90%").(3) Based on the theoretical optimal value: y i The theoretical optimal value can be the shortest test time, maximum coverage, etc.

[0124] In order to ensure the accuracy of the test efficiency evaluation, in an optional implementation, the first calculation module comprises:

[0125] The second calculation submodule is configured to calculate the expected test efficiency corresponding to a plurality of historical test samples;

[0126] The third calculation submodule is configured to perform the first calculation step, calculate the value of the loss function of the target test factor tree model after the strategy forest is added according to a plurality of expected test efficiencies, obtain a plurality of sub-loss function values, and the target test factor tree model is any one of the test factor tree models;

[0127] The fourth calculation submodule is configured to perform the second calculation step, calculate the sum of a plurality of sub-loss function values, and obtain the loss function value corresponding to the target test factor tree model;

[0128] The first repeating submodule is configured to repeat the first calculation step and the second calculation step at least once in turn until the loss function values corresponding to all test factor tree models are obtained.

[0129] In the above implementation, each historical test sample of the test strategy to be selected corresponds to an expected test efficiency, a plurality of expected test efficiencies correspond to a plurality of loss function values, that is, a plurality of sub-loss function values, the sum of a plurality of sub-loss function values is calculated as the loss function value corresponding to the target test factor tree model, which avoids inaccurate efficiency evaluation caused by a single historical test sample and improves the accuracy of test efficiency evaluation.

[0130] In order to construct the test factor decision tree, in an optional implementation, the construction unit comprises:

[0131] The second calculation module is configured to calculate the importance of each test factor corresponding to the test strategy to be selected according to the historical test sample, and obtain a plurality of first importance, wherein the importance is used to represent the influence degree of the test factor on the execution of the test strategy to be selected;

[0132] The second determination module is configured to determine the test factor with the largest first importance as the root node, and set the classification condition of the root node to divide the historical test samples into two categories, and obtain two current historical test sample sets;

[0133] The third determining module is configured to determine that the sub-node corresponding to the current historical test sample set is a leaf node when the execution commands corresponding to the current historical test sample set are all the same.

[0134] The third calculating module is configured to calculate the importance of the test factors other than the root node according to the current historical test sample when any two of the execution commands corresponding to the current historical test sample set are different, to obtain a second importance, and to determine the test factor with the largest second importance as the sub-node corresponding to the current historical test sample set, and to set the classification condition of the sub-node corresponding to the current historical test sample set, so as to divide the current historical test sample into two classes, to obtain two next-level historical test sample sets.

[0135] The establishing module is configured to establish the sub-nodes corresponding to the two next-level historical test sample sets, until the execution commands corresponding to all the next-level historical test sample sets are all the same, and to determine the sub-nodes corresponding to all the next-level historical test sample sets as leaf nodes.

[0136] In the embodiment, the branch node of the decision tree is generated based on the principle of maximum information gain, and the specific steps are as follows: root node selection, selecting the test factor with the maximum information entropy (H(X)) as the root node. For example, if the entropy value of the test phase is the largest, the test phase is selected as the root node. Branch node generation, split condition: dividing the samples according to the value of the test factor. For example, the root node is "test phase ≤ 0.5" (such as "requirement review phase"), and the branches can be "yes" or "no". Recursive splitting: for each subset of the branch, the information gain of the remaining test factors is repeatedly calculated, and the factor with the maximum entropy value is selected as the next-level node. Termination condition: when the node purity reaches a threshold (such as all samples belong to the same class) or cannot be further split, the node becomes a leaf node, and is marked as the final test strategy. When p = 0 or p = 1, H(p) = 0, and the random variable has no uncertainty, when p = 0.5, H(p) = 1, and the uncertainty of the random variable is the largest, for example, Figure 3shown. For example, assume we have collected the following test data from historical projects for building a decision tree for compatibility testing, test factors (features x): client refactoring (whether refactoring is needed for the client, taking the value True / False), test phase (phase number: 0 = requirement review, 1 = development phase, 2 = testing phase), device type (iOS, Android, HarmonyOS), target y: whether compatibility testing is needed (Yes / No). The dataset is shown in Table 3. Root node selection: the criterion is the test factor with the largest information gain. The entropy value of each factor needs to be calculated respectively. Distribution of target variable y: Yes (3 times), No (1 time); total sample size = 4, initial entropy value: H(y) = -(3 / 4log2(3 / 4) + 1 / 4log2(1 / 4)) = 0.811, candidate factor entropy value calculation, client refactoring (True / False): True branch: 2 samples (y = Yes: 2, No: 0) -> entropy = 0, False branch: 2 samples (y = Yes: 1, No: 1) -> entropy = 1, weighted average entropy: H(client refactoring) = -(2 / 4*0 + 2 / 4*1) = 0.5, information gain: Gain = H(y) - H(client refactoring) = 0.811 - 0.5 = 0.311, similarly: H(test phase) = 0, Gain = 0.811, H(device type) = 0.5, Gain = 0.311, the information gain of test phase is the largest (0.811), so it is selected as the root node. Branch node generation: condition division of True and False, after the root node "test phase", the branches need to be divided according to its value. Assume we divide the test phase into two categories: condition: test phase <= 1.5 (i.e. stages 0 and 1 are True, stage 2 is False). This is a threshold set according to actual business requirements or data distribution, as shown in Table 4. True branch (test phase <= 1.5): entropy value calculation: H(True) = -(2 / 3log2(2 / 3) + 1 / 3log2(1 / 3)) = 0.918, further split is needed, select the next test factor. False branch (test phase > 1.5): entropy value = 0 (all samples are Yes), no further split is needed, become a leaf node. Sub-node selection: client refactoring as the next split node, in the True branch, the remaining candidate factors are client refactoring and device type.The information gain of these two factors must be calculated. For client modification (True / False), the True branch has one sample (y=Yes: 2) and entropy=0. For False branch, two samples (y=No: 1) and entropy=0. The weighted average entropy is H(client modification)=-(1 / 3*0+2 / 3*0)=0. The information gain is Gain=0.918-0=0.918. The client modification gain is equal to the device type gain. Select client modification or device type as a child node, and the entropy value is 0. Each branch becomes a leaf node, and the node selection is complete. In a specific example, the test factor decision tree for compatibility testing is as follows: Figure 4 As shown, entropy (information entropy): represents the impurity of the current node, which is used to measure the degree of confusion of the sample categories. Entropy = 0: All samples in the node belong to the same category (completely pure). Entropy is close to 1: The sample categories are evenly distributed (highly impure). samples (number of samples): The total number of samples contained in the current node; value (category distribution): A list indicating the number of samples of each category in the current node; class (predicted category): The classification result of the current node; client transformation ≤ 0.5, test phase ≤ 0.5, etc. are feature splitting conditions, which means that the samples are divided according to the threshold of a certain feature. Leaf nodes (such as nodes with entropy = 0.0) represent the final classification results and do not require further splitting.

[0137] In order to calculate the first importance, in an optional implementation, the second calculation module includes:

[0138] An acquisition submodule, configured to execute an acquisition step, acquire a value of a target test factor in the historical test sample, and obtain multiple values ​​of the target test factor, wherein the target test factor is any one of the test factors corresponding to the test strategy to be selected;

[0139] a fifth calculation submodule, configured to execute the third calculation step, calculate the ratio of the number of the historical test samples corresponding to each of the above values ​​to the total number of the above historical test samples, and obtain the weight of each of the above values;

[0140] The sixth calculation submodule is used to perform the fourth calculation step according to Calculate the entropy of each of the above values, H(X) is the entropy of the above value, X is the above value, p i is the probability that the execution command corresponding to the historical test sample corresponding to each of the above values ​​is the i-th type, and n is the number of types of the execution commands;

[0141] a seventh calculation submodule, configured to perform a weighted average of the entropies of the above-mentioned values ​​using the weights of the above-mentioned values ​​in the fifth calculation step, to obtain a weighted average entropy of the above-mentioned target test factor;

[0142] an eighth calculation submodule configured to calculate, in a sixth calculation step, a difference between an initial entropy value and a weighted average entropy of the target test factor, to obtain an information gain of the target test factor, and take the information gain of the test factor as a first importance of the target test factor, wherein the initial entropy value is an entropy of the execution command of the historical test sample;

[0143] a second repetition submodule configured to sequentially repeat the acquisition step, the third calculation step, the fourth calculation step, the fifth calculation step, and the sixth calculation step at least once until all the first importances are obtained.

[0144] In the above embodiment, the information gain is used as a measurement standard to calculate the classification after branching selection by different test factors, and the best one is found out as the root node, and so on. H(X) is a core concept in information theory, used to quantify the expected value of uncertainty or information amount of random variable X. In the decision tree model, random variable X represents the value of the test factor. For example, a test factor can be "system architecture type", and its values can be "monolithic architecture" or "microservice architecture". The test factor is a variable that affects the selection of the test strategy (such as requirement complexity, test phase, personnel skill, etc.), and X is the actual value of these factors in a specific project, used to construct the classification conditions of the decision tree. pi represents the probability of random variable X taking the ith possible value, which satisfies 0≤pi≤1 and ∑pi=1. n represents the number of possible values of random variable X, i.e. the size of the sample space or the total number of events. pi represents the probability of random variable X taking the ith value in a certain test strategy. For example, in the "compatibility test" strategy, if the test factor "device type" has 3 values (iOS, Android, HarmonyOS), and the historical data shows that iOS accounts for 50%, Android accounts for 30%, and HarmonyOS accounts for 20%, then: p1=0.5 (the probability of iOS appearing), p2=0.3 (the probability of Android appearing), and p3=0.2 (the probability of HarmonyOS appearing). Therefore, the greater the entropy value, the greater the uncertainty of the test factor that needs to be tested. The difference between the initial entropy value and the weighted average entropy of the target test factor is calculated to obtain the information gain of the target test factor, i.e. the first importance.

[0145] It should be noted that as the division process continues, the samples contained in the branch node belong to the same category as much as possible, that is, the "purity" of the node is higher and higher. When the number of yes or no is the same, it is a leaf node. Pruning low importance factors: remove test factors with importance lower than a set threshold. Pruning low probability test factors: by pruning low probability test factors, the complexity of the model can be reduced, the generalization ability can be improved, and the time complexity and space complexity can be reduced. The pruning method includes: factor importance evaluation based on information gain or gini coefficient. Set the threshold, remove test factors with importance lower than the threshold. Generate test factor decision tree: each test strategy corresponds to a decision tree, and the nodes of the decision tree represent test factors and branches represent test factor values. The pruned decision tree is more concise, easy to understand and execute. The test factors with low probability are pruned to improve the generalization ability of the model, while reducing the time complexity and space complexity. According to the algorithm, the most important test factors of each test method are output, and the test factors with low purity are pruned. Generate a test factor decision tree corresponding to each test strategy.

[0146] In order to realize the test of each full stage, in an optional implementation, the second acquisition unit includes:

[0147] The acquisition module is configured to acquire the test factors of the software to be tested in different stages of the software to be tested, respectively, to obtain the target test factors of each stage, and the stages include a development stage, a test stage and an online stage.

[0148] In the above embodiment, in different stages of the software to be tested, the test manager can enter the interface to select various test factors and click OK. The model traverses the test factors selected by the test manager in the decision forest. If the root node is hit, the test method is directly selected and put into the test strategy combination pool. If other nodes are hit, the importance of the current test method is determined according to the position of the test factor in the tree model.

[0149] The matching device of the software test strategy includes a processor and a memory. The first acquisition unit, the first determination unit, the construction unit, the second acquisition unit, the selection unit and the second determination unit are all stored in the memory as program units, and the corresponding functions are realized by the processor executing the program units stored in the memory. The above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0150] The processor contains a core, and the corresponding program unit is called from the memory by the core. The core can be set to one or more, and the overall quality and user experience of the product affected by patching after software testing in the prior art can be solved by adjusting the core parameters.

[0151] The memory can include non-persistent memory in a computer readable medium, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.

[0152] The embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium comprises a stored program, wherein the program controls a device where the computer readable storage medium is located to execute the matching method of the software test strategy when the program runs.

[0153] Specifically, the matching method of the software test strategy comprises:

[0154] In step S201, a plurality of candidate test strategies are acquired, and the candidate test strategies comprise compatibility test, performance test, security test, contract test, precision test, user experience test, product level test and automation test.

[0155] In step S202, test factors corresponding to each candidate test strategy are determined according to historical test samples, the test factors are variables affecting test processes and test results of the candidate test strategies, the historical test samples comprise values of each test factor and execution commands of each candidate test strategy, and the execution commands comprise executing the candidate test strategy and not executing the candidate test strategy.

[0156] In step S203, test factor decision trees of each candidate test strategy are constructed according to the historical test samples and the test factors, and the test factor decision trees correspond to the candidate test strategies one by one.

[0157] In step S204, the test factors of the software to be tested are acquired to obtain target test factors.

[0158] In step S205, the target test factors with the smallest layer sequence numbers in each test factor decision tree are taken as root nodes to obtain test factor tree models of each candidate test strategy.

[0159] In step S206, whether to execute the corresponding candidate test strategy is determined according to each test factor tree model.

[0160] The embodiment of the present application provides a processor, and the processor is used for running a program, wherein the program executes the matching method of the software test strategy when the program runs.

[0161] Specifically, the matching method of the software test strategy comprises:

[0162] Step S201, obtaining a plurality of candidate test strategies, wherein the candidate test strategies include compatibility test, performance test, security test, contract test, precision test, user experience test, product level test and automation test;

[0163] Step S202, determining test factors corresponding to each of the candidate test strategies according to historical test samples, wherein the test factors are variables affecting test processes and test results of the candidate test strategies, the historical test samples include values of the test factors and execution commands of the candidate test strategies, and the execution commands include executing the candidate test strategies and not executing the candidate test strategies;

[0164] Step S203, constructing test factor decision trees of the candidate test strategies according to the historical test samples and the test factors, wherein the test factor decision trees correspond to the candidate test strategies one by one;

[0165] Step S204, obtaining the test factors of the software to be tested to obtain target test factors;

[0166] Step S205, taking the target test factors with the smallest layer sequence numbers in the test factor decision trees as root nodes to obtain test factor tree models of the candidate test strategies;

[0167] Step S206, determining whether to execute the corresponding candidate test strategies according to the test factor tree models.

[0168] An apparatus is provided, and the apparatus includes a processor, a memory, and a program stored on the memory and executable on the processor, and the processor implements at least the following steps when executing the program:

[0169] Step S201, obtaining a plurality of candidate test strategies, wherein the candidate test strategies include compatibility test, performance test, security test, contract test, precision test, user experience test, product level test and automation test;

[0170] Step S202, determining test factors corresponding to each of the candidate test strategies according to historical test samples, wherein the test factors are variables affecting test processes and test results of the candidate test strategies, the historical test samples include values of the test factors and execution commands of the candidate test strategies, and the execution commands include executing the candidate test strategies and not executing the candidate test strategies;

[0171] Step S203, constructing test factor decision trees of the candidate test strategies according to the historical test samples and the test factors, wherein the test factor decision trees correspond to the candidate test strategies one by one;

[0172] Step S204, obtaining the test factors of the software to be tested to obtain target test factors;

[0173] Step S205, taking the target test factor with the smallest layer sequence number in each test factor decision tree as a root node to obtain a test factor tree model of each test strategy to be selected;

[0174] Step S206, determining whether to execute the corresponding test strategy to be selected according to each test factor tree model.

[0175] The application also provides a computer program product adapted to execute a program including at least the following steps when executed on a data processing device:

[0176] Step S201, obtaining a plurality of test strategies to be selected, wherein the test strategies to be selected include compatibility testing, performance testing, security testing, contract testing, precision testing, user experience testing, product level testing and automation testing;

[0177] Step S202, determining test factors corresponding to each test strategy to be selected according to historical test samples, wherein the test factors are variables affecting the test process and test results of the test strategy to be selected, the historical test samples include values of the test factors and execution commands of each test strategy to be selected, and the execution commands include executing the test strategy to be selected and not executing the test strategy to be selected;

[0178] Step S203, constructing a test factor decision tree of each test strategy to be selected according to the historical test samples and the test factors, wherein the test factor decision tree corresponds to the test strategy to be selected one by one;

[0179] Step S204, obtaining the test factors of the software to be tested to obtain target test factors;

[0180] Step S205, taking the target test factor with the smallest layer sequence number in each test factor decision tree as a root node to obtain a test factor tree model of each test strategy to be selected;

[0181] Step S206, determining whether to execute the corresponding test strategy to be selected according to each test factor tree model.

[0182] It should be apparent to those skilled in the art that the modules or steps of the application described above can be implemented with a general purpose computer, and can be centralized in a single computer or distributed among a network of computers, and can be implemented with program code executable by a computer, and thus can be stored in a storage device and executed by a computer, and in some cases, the steps shown or described can be executed in a different order than shown or described, or can be implemented as separate integrated circuit modules or as a single integrated circuit module, and thus the application is not limited to any particular combination of hardware and software.

[0183] Those skilled in the art will appreciate that embodiments of the application can be devised for a method, a system, or a computer program product. Accordingly, the application can be embodied in the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the application can be embodied in the form of a computer program product on one or more computer readable storage media (including, but not limited to, disk memory, CD-ROMs, optical storage media, etc.) having computer usable program code embodied thereon.

[0184] The present application is described below with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0185] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0186] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flowchart illustrations and / or block diagrams.Figure 1 one or more processes and / or functions specified in one or more blocks Figure 1 one or more processes and / or functions specified in one or more blocks

[0187] In one typical arrangement, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0188] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory, etc. The memory is an example of computer readable media.

[0189] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carrier waves.

[0190] It should also be noted that the terms "comprising", "containing", or any other variant thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0191] From the above description, it can be seen that the above-mentioned embodiments of the present application achieve the following technical effects:

[0192] 1)、the matching method of the software test strategy of the application, by obtaining the conventional test method of the software as the selected test strategy, the historical test sample of the selected test strategy can be summarized to the test factor corresponding to the selected test strategy, for example, the test factor of product level test includes terminal type, according to the historical test sample, each test factor is selected as each layer node of decision tree to build the test factor decision tree of each selected test strategy, that is, the test factor tree model customized for the target test factor of the software to be tested, that is, the current important test factor, the target test factor with the smallest layer number in each test factor decision tree is taken as the root node, the test factor tree model of each selected test strategy is obtained, that is, the test factor tree model customized for the target test factor of the software to be tested, whether the corresponding selected test strategy is executed can be determined through the test factor tree model, this method can select the current important test factor at any stage of the software to be tested, so as to determine whether the selected test strategy is executed, the problem of testing can be solved in the development stage, without waiting for the problem to appear after the development is completed to execute the corresponding selected test strategy, which affects the overall quality and user experience of the product after patching, solves the problem of affecting the overall quality and user experience of the product after patching in the prior art.

[0193] 2)、the matching device of the software test strategy of the application, by obtaining the conventional test method of the software as the selected test strategy, the historical test sample of the selected test strategy can be summarized to the test factor corresponding to the selected test strategy, for example, the test factor of product level test includes terminal type, according to the historical test sample, each test factor is selected as each layer node of decision tree to build the test factor decision tree of each selected test strategy, that is, the test factor tree model customized for the target test factor of the software to be tested, that is, the current important test factor, the target test factor with the smallest layer number in each test factor decision tree is taken as the root node, the test factor tree model of each selected test strategy is obtained, that is, the test factor tree model customized for the target test factor of the software to be tested, whether the corresponding selected test strategy is executed can be determined through the test factor tree model, this method can select the current important test factor at any stage of the software to be tested, so as to determine whether the selected test strategy is executed, the problem of testing can be solved in the development stage, without waiting for the problem to appear after the development is completed to execute the corresponding selected test strategy, which affects the overall quality and user experience of the product after patching, solves the problem of affecting the overall quality and user experience of the product after patching in the prior art.

[0194] The above only describes the preferred embodiments of the application and is not intended to limit the application. Those skilled in the art can make various changes and modifications to the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the application shall be included in the protection scope of the application.

Claims

1. A software testing strategy matching method, characterized in that: include: Acquire multiple candidate test strategies, wherein the candidate test strategies include compatibility testing, performance testing, security testing, contract testing, precision testing, user experience testing, product-level testing, and automated testing; Determine, based on historical test samples, a test factor corresponding to each of the test strategies to be selected, wherein the test factor is a variable that affects the test process and test results of the test strategy to be selected, and the historical test samples include values ​​of each of the test factors and execution commands of each of the test strategies to be selected, wherein the execution commands include executing the test strategy to be selected and not executing the test strategy to be selected; Constructing a test factor decision tree for each of the candidate test strategies based on the historical test samples and the test factors, wherein the test factor decision tree corresponds to the candidate test strategy in a one-to-one manner; Obtaining the test factor of the software to be tested to obtain a target test factor; Taking the target test factor with the smallest layer number in each test factor decision tree as the root node, and obtaining the test factor tree model of each test strategy to be selected; Determine whether to execute the corresponding candidate test strategy according to each test factor tree model.

2. The method according to claim 1, characterized in that Determining whether to execute the corresponding candidate test strategy according to each test factor tree model includes: Composing a strategy forest by forming the test factor decision trees of all the candidate test strategies; Calculating the loss function values ​​of each of the test factor tree models after adding the strategy forest, respectively, to obtain multiple loss function values, wherein the loss function is used to calculate the difference between the actual test efficiency of the strategy forest and the expected test efficiency; Adding the test factor tree model with the smallest loss function value to the strategy forest to obtain an optimized strategy forest; Determine and execute the candidate test strategy corresponding to the test factor tree model added by the optimization strategy forest.

3. The method according to claim 2, characterized in that Determining the candidate test strategy corresponding to the test factor tree model added to the optimization strategy forest includes: Calculating the values ​​of the loss functions of the remaining test factor tree models after adding the optimization strategy forest respectively, to obtain multiple optimization loss function values, wherein the optimization loss function is used to calculate the difference between the actual test efficiency of the optimization strategy forest and the expected test efficiency; Adding the test factor tree model with the minimum optimization loss function value to the optimization strategy forest to obtain a secondary optimization strategy forest; Determine that the candidate test strategy corresponding to the test factor tree model added to the secondary optimization strategy forest is the candidate test strategy to be executed next.

4. The method according to claim 2, characterized in that Calculate the loss function values ​​of each test factor tree model after adding the strategy forest, and obtain multiple loss function values, including: Calculating the expected test efficiency corresponding to a plurality of the historical test samples; A first calculation step is to calculate the value of the loss function of the target test factor tree model after adding the strategy forest according to the multiple expected test efficiencies to obtain multiple sub-loss function values, wherein the target test factor tree model is any one of the test factor tree models; A second calculation step is to calculate the sum of multiple sub-loss function values ​​to obtain the loss function value corresponding to the target test factor tree model; Repeat the first calculation step and the second calculation step at least once in sequence until the loss function values ​​corresponding to all the test factor tree models are obtained.

5. The method according to claim 1, wherein Constructing a test factor decision tree for each of the candidate test strategies based on the historical test samples and the test factors includes: Calculating the importance of each of the test factors corresponding to the candidate test strategy based on the historical test samples to obtain a plurality of first importances, wherein the importances are used to characterize the degree of influence of the test factors on whether the candidate test strategy is executed; Determining the test factor with the greatest first importance as a root node, and setting a classification condition for the root node to divide the historical test samples into two categories, thereby obtaining two current historical test sample sets; In a case where the execution commands corresponding to the current historical test sample set are all the same, determining that the child node corresponding to the current historical test sample is a leaf node; When any two of the execution commands corresponding to the current historical test sample set are different, calculating the importance of the test factors other than the root node based on the current historical test samples to obtain a second importance, determining the test factor with the greatest second importance as a child node corresponding to the current historical test sample set, and setting a classification condition for the child node corresponding to the current historical test sample set to divide the current historical test samples into two categories, thereby obtaining two lower-level historical test sample sets; Two child nodes corresponding to the next layer of historical test sample sets are established until the execution commands corresponding to all the next layer of historical test sample sets are the same, and all the child nodes corresponding to the next layer of historical test sample sets are determined as leaf nodes.

6. The method according to claim 5, characterized in that The importance of each of the test factors corresponding to the candidate test strategy is calculated based on the historical test samples to obtain a plurality of first importances, including: an acquisition step of acquiring a value of a target test factor in the historical test sample to obtain multiple values ​​of the target test factor, wherein the target test factor is any one of the test factors corresponding to the test strategy to be selected; A third calculation step is to calculate the ratio of the number of the historical test samples corresponding to each value to the total number of the historical test samples to obtain the weight of each value; The fourth calculation step is based on Calculate the entropy of each value, H(X) is the entropy of the value, X is the value, p i is the probability that the execution command corresponding to the historical test sample corresponding to each value is the i-th type, and n is the number of types of the execution commands; A fifth calculation step is to perform a weighted average on the entropy of each value using the weight of each value to obtain a weighted average entropy of the target test factor; a sixth calculation step of calculating a difference between the initial entropy value and the weighted average entropy of the target test factor to obtain the information gain of the target test factor, and using the information gain of the test factor as the first importance of the target test factor, wherein the initial entropy value is the entropy of the execution command of the historical test sample; Repeat the obtaining step, the third calculating step, the fourth calculating step, the fifth calculating step and the sixth calculating step at least once in sequence until all the first importances are obtained.

7. The method according to any one of claims 1 to 6, characterized in that Obtaining the test factors of the software to be tested to obtain target test factors includes: At different stages of the software to be tested, the test factors of the software to be tested are respectively obtained to obtain the target test factors of each stage. The stages include a development stage, a testing stage, and an online stage.

8. A software testing strategy matching device, characterized in that: include: A first acquisition unit is configured to acquire a plurality of candidate test strategies, wherein the candidate test strategies include compatibility testing, performance testing, security testing, contract testing, precision testing, user experience testing, product-level testing, and automated testing; A first determining unit is configured to determine a test factor corresponding to each of the test strategies to be selected based on historical test samples, wherein the test factor is a variable that affects the test process and test results of the test strategy to be selected, and the historical test samples include values ​​of each of the test factors and execution commands of each of the test strategies to be selected, wherein the execution commands include whether to execute the test strategy to be selected or not execute the test strategy to be selected; A construction unit, configured to construct a test factor decision tree for each of the candidate test strategies based on the historical test samples and the test factors, wherein the test factor decision tree corresponds to the candidate test strategy in a one-to-one manner; A second acquiring unit is configured to acquire the test factor of the software to be tested to obtain a target test factor; A selection unit, configured to take the target test factor with the smallest layer number in each of the test factor decision trees as a root node, and obtain a test factor tree model for each of the test strategies to be selected; The second determining unit is configured to determine whether to execute the corresponding candidate test strategy according to each of the test factor tree models.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.