Combined testing method applied to configurable software system
Through an intelligent search and optimization mechanism, an approximate metric set based on Boolean formulas is constructed, the test intensity is adaptively adjusted, and an efficient and high-coverage test case set is generated, which solves the scalability and problem of combinatorial testing in highly configurable software systems. Coverage issues improve testing efficiency and software reliability.
Patent Information
- Application Number
- CN202410932921.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-15
AI Technical Summary
In highly configurable software systems, existing combination testing methods have scalability problems when facing large-scale configuration spaces. The number of test cases increases sharply, and it is difficult to effectively handle the complex constraint relationships between configuration options, resulting in generated test cases. The collection contains a large number of invalid or redundant configurations, affecting test efficiency and coverage.
Through an intelligent search and optimization mechanism, an approximate metric set based on Boolean formulas is constructed, and the approximate evaluation function is used to dynamically evaluate the benefits of test cases, adaptively adjust the test intensity, and generate an efficient and high-coverage test case set to avoid exhaustion and exhaustion. Redundant testing.
Significantly improves the scalability and efficiency of test case generation, ensures the quality and coverage of test case sets, reduces the risk of system failure caused by configuration errors, and improves software reliability and user satisfaction.
Smart Images

Figure CN118779237A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software testing, and more particularly to a combined testing method applied to a configurable software system. Background Art
[0002] With the rapid development of information technology, software systems are becoming increasingly complex and highly customizable, and users' demand for personalized functions is growing, which has promoted the widespread use of highly configurable systems. Highly configurable systems provide a wealth of configuration options, allowing users to customize functions according to their own needs, greatly improving user experience and satisfaction. However, this high flexibility also brings unprecedented testing challenges.
[0003] In traditional software testing, exhaustive methods or random sampling are usually used to verify software functions. However, in highly configurable systems, the explosive growth of configuration options makes exhaustive testing an impossible task. Even if only a few options are considered for interaction (such as 2-wise and 3-wise combinations), the number of test cases will quickly expand to an unmanageable level. Therefore, a combinatorial testing strategy came into being, which focuses on identifying and testing those key configuration option combinations that may cause system failure.
[0004] Although combinatorial testing is more efficient than comprehensive testing, it still faces many problems when facing large-scale configuration spaces. First, most existing combinatorial testing methods generate test case sets based on fixed test intensity t (such as 2-wise, 3-wise). When the number of system configuration options increases and the test intensity t increases, the number of generated test cases increases exponentially, and the requirements for computing resources and time increase sharply, resulting in prominent scalability issues. Second, many existing technologies ignore the complex constraints between configuration options, which may cause the generated test case set to contain a large number of invalid or redundant configurations, which not only wastes test resources but also may cover up real system defects.
[0005] In addition, traditional combinatorial testing methods often rely on fixed algorithmic strategies, such as completely random sampling or generation based on deterministic rules. These methods are difficult to accurately control the test case generation process when dealing with highly configurable systems with specific structures and constraints, thus affecting the coverage and effectiveness of test cases. Especially for systems with nonlinear constraints and advanced logical relationships, the test case generation strategy needs to be more intelligent and adaptive to ensure that critical configuration combinations are covered while avoiding invalid tests.
[0006] Therefore, how to design a more efficient, intelligent test case generation method that can effectively handle constraints to improve test efficiency and accuracy is an urgent problem that technical personnel in this field need to solve. Summary of the invention
[0007] In view of this, the present invention provides a combinatorial testing method applied to configurable software systems. Through an intelligent search and optimization mechanism, efficient and high-coverage combinatorial testing is achieved. The method is particularly suitable for highly configurable software systems, effectively solving the scalability problem of test case generation, while ensuring the quality of the test case set and the testing efficiency.
[0008] In order to achieve the above object, the present invention adopts the following technical solution:
[0009] A combination testing method applied to a configurable software system, comprising:
[0010] Step S1, based on the constraint relationship configured in the configurable software system to be tested, obtain a Boolean formula F, and construct an approximate measurement set in combination with the test intensity t;
[0011] Step S2: input the Boolean formula F into a valid search model to construct a candidate test case set;
[0012] Step S3, using the approximate metric set, calculating the benefit of each candidate test case in the candidate test case set through an approximate evaluation function, and obtaining the best test case;
[0013] Step S4: based on the best test case, updating the approximate metric set to obtain an updated approximate metric set;
[0014] Step S5, adding the best test case to the test case set, repeating steps S2 to S4 until the preset conditions are met, and outputting the test case set;
[0015] Step S6: Combining the test intensity t adaptive adjustment strategy, repeat the steps S1 to S5 to obtain a test case set under different test intensities t, and perform a combined test of the configurable software system to be tested.
[0016] Preferably, in step S1, constructing an approximate metric set includes:
[0017] The Fisher-Yates shuffling algorithm is used to randomly sample all the value combinations of t options, and several value combinations of t options are selected as the approximate measurement set.
[0018] Preferably, in step S2, the effective search model adopts an adaptive depth control mechanism to dynamically adjust the search depth limit according to the current search depth and the effectiveness of the explored solution space.
[0019] Preferably, the step S2 comprises:
[0020] Step S21: Based on the effective search model, the Boolean formula F is simplified by using unit propagation and pure character elimination, and the set of unassigned variables is updated;
[0021] Step S22, selecting an unassigned variable from the unassigned variable set, and sampling a Boolean value v based on the sampling probability prob(u) of the unassigned variable;
[0022] Step S23, assign v and 1-v to the unassigned variables in turn, and perform partial assignment expansion; if there are unresolved contradictions in the simplified Boolean formula F when assigning v and 1-v to the unassigned variables, return that there is no suitable assignment;
[0023] Step S24, repeating the steps S21 to S23 until all variables are assigned values, and if the expanded partial allocation satisfies all statements in the Boolean formula F, returning the expanded partial allocation, and taking the expanded partial allocation as a candidate test case, and adding it to the candidate test case set;
[0024] Step S25, repeat steps S21 to S24 to generate a candidate test case set.
[0025] Preferably, in step S22, the sampling probability prob(u) of the unassigned variable is obtained through a heuristic selection strategy; the heuristic selection strategy dynamically adjusts the sampling probability of the unassigned variable based on the degree of simplification of the Boolean formula and the influence of the unassigned variable on the current test case set.
[0026] Preferably, in step S3, the approximate evaluation function is:
[0027] gain(α i )=|M(α i )|
[0028] Among them, gain(α i ) represents the benefit of the i-th candidate test case in the candidate test case set; |M(α i )| represents the coverage value of the i-th candidate test case in the candidate test case set for the t option combinations in the approximate metric set.
[0029] Preferably, in step S3, obtaining the best test case includes:
[0030] α=argmax(gain(α i ))
[0031] Among them, argmax() indicates the location of obtaining the maximum value of the function.
[0032] Preferably, in step S4, updating the approximate metric set includes: based on the approximate metric set, removing t option combinations covered by the best test case.
[0033] Preferably, in step S5, the preset conditions include: a test case quantity threshold and a maximum number of iterations.
[0034] Preferably, in step S6, the test intensity t adaptive adjustment strategy includes:
[0035] Step S61, setting a coverage target threshold, when the actual coverage is lower than the threshold, activating the test intensity t adjustment mechanism;
[0036] Step S62: dynamically calculating a new test intensity t according to the deviation between the current coverage and the target through a PID controller;
[0037] Step S63: Implement the rule of gradually increasing or decreasing the test intensity t to respond to the real-time changes in coverage.
[0038] It can be seen from the above technical solution that compared with the prior art, the technical solution of the present invention has the following advantages:
[0039] Beneficial effects:
[0040] 1. By analyzing the configuration constraint relationship of the software to be tested and converting it into a Boolean formula F, an approximate measurement set is directly combined with the test intensity t to construct an approximate measurement set. The constraint logic within the system is explicitly considered, and by constructing an approximate measurement set, the configuration space covered by the test case can be effectively quantified, laying the foundation for subsequent test case generation. It avoids the inefficient practice of directly enumerating all configuration combinations and significantly improves the ability to handle large-scale configuration spaces.
[0041] 2. Input the Boolean formula F into the effective search model to simplify and optimize the Boolean formula, and then build a set of candidate test cases through systematic search. It automatically explores the configuration space through intelligent algorithms and can find the test cases that are most likely to reveal interaction problems between configuration options. It is more efficient and targeted.
[0042] 3. Use the approximate metric set and approximate evaluation function to dynamically evaluate the benefits of each candidate test case, select the best test case to add to the final test case set, and update the approximate metric set accordingly to ensure that the subsequently generated test cases can continue to cover the configuration combinations that have not been touched. It can dynamically adapt to the test process and continuously optimize the test case set to ensure the comprehensiveness and efficiency of test coverage.
[0043] 4. By repeating the iterative process until the predetermined test case set size is reached, it is ensured that the generated test case set not only meets the predetermined test intensity t requirements, but also that each test case is the optimal choice for a specific configuration combination, thereby improving the overall coverage and testing efficiency of the test case set.
[0044] 5. Combination testing using test case sets can deeply explore interaction failures between configuration options and effectively improve the reliability and stability of the software. Especially in highly configurable complex software systems, it can significantly reduce the risk of system failures caused by configuration errors, ensure that the software works as expected, and improve user satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0046] Figure 1 A flow chart of a combined testing method applied to a configurable software system provided by an embodiment of the present invention;
[0047] Figure 2 A flow chart of a method for constructing a candidate test case set provided by an embodiment of the present invention;
[0048] Figure 3 A flow chart of a test intensity t adaptive adjustment strategy method provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] Embodiment 1;
[0051] like Figure 1 As shown, this embodiment provides a combined testing method applied to a configurable software system, including:
[0052] Step S1, based on the constraint relationship configured in the configurable software system to be tested, obtain a Boolean formula F, and construct an approximate measurement set in combination with the test intensity t;
[0053] Step S2: input the Boolean formula F into a valid search model to construct a candidate test case set;
[0054] Step S3, using the approximate metric set, calculating the benefit of each candidate test case in the candidate test case set through an approximate evaluation function, and obtaining the best test case;
[0055] Step S4: based on the best test case, updating the approximate metric set to obtain an updated approximate metric set;
[0056] Step S5, adding the best test case to the test case set, repeating steps S2 to S4 until the preset conditions are met, and outputting the test case set;
[0057] Step S6: Combining the test intensity t adaptive adjustment strategy, repeat the steps S1 to S5 to obtain a test case set under different test intensities t, and perform a combined test of the configurable software system to be tested.
[0058] This method achieves efficient and high-coverage combinatorial testing through intelligent search and optimization mechanisms, effectively solves the scalability problem of test case generation, and ensures the quality and testing efficiency of the test case set.
[0059] The above steps and related features are further described in detail below;
[0060] In step S1 of this embodiment, constructing an approximate metric set includes: using the Fisher-Yates shuffling algorithm to randomly sample all the value combinations of t options, and selecting several value combinations of t options as the approximate metric set.
[0061] Before applying the Fisher-Yates shuffle algorithm, it is necessary to determine the configuration space and the test intensity t. First, the configuration options of the software system and their constraints are clarified to form a set of all possible configurations. Assuming there are n independent configuration options, each with m possible values, then the size of the configuration space is theoretically m n .
[0062] Since directly generating and storing all possible configuration combinations (especially when n is large) may be very resource-intensive, in a specific implementation, this full set is not directly constructed, but the next step is directly entered, using the Fisher-Yates shuffle algorithm to operate on the number of combinations actually required.
[0063] The Fisher-Yates shuffle algorithm allows us to efficiently randomly extract a certain number of different combinations from all possible combinations of t options without knowing all possible combinations. The problem is transformed into a problem of directly sampling from all possible configurations. A method for randomly extracting a certain number of different configuration combinations from the theoretical configuration space without directly enumerating all configuration combinations. Specifically, it includes: initializing a list representing all options, shuffling the list through random exchange operations, and finally selecting the options represented by the first t elements of the shuffled list as the combination of the selected t options, and randomly sampling the values of these t options in turn to obtain a combination of t options. Repeat the above process several times to obtain an approximate metric set.
[0064] Through this step, using the Fisher-Yates shuffle algorithm, we can efficiently randomly extract t option value combinations from a huge configuration space as an approximate metric set for testing purposes without directly enumerating all possible configuration combinations. It is particularly effective when dealing with large-scale configuration spaces, saving computing resources while ensuring the randomness and representativeness of the sampling.
[0065] like Figure 2 As shown, in step S2 of this embodiment, the effective search model adopts an adaptive depth control mechanism to dynamically adjust the search depth limit according to the current search depth and the effectiveness of the explored solution space.
[0066] Specifically include:
[0067] Step S21: Based on the effective search model, the Boolean formula F is simplified by using unit propagation and pure character elimination, and the set of unassigned variables is updated;
[0068] Step S22, selecting an unassigned variable from the unassigned variable set, and sampling a Boolean value v based on the sampling probability prob(u) of the unassigned variable;
[0069] The sampling probability prob(u) of the unassigned variable is obtained through a heuristic selection strategy; the heuristic selection strategy dynamically adjusts the sampling probability of the unassigned variable based on the degree of simplification of the Boolean formula and the influence of the unassigned variable on the current test case set.
[0070] Step S23, assign v and 1-v to the unassigned variables in turn, and perform partial assignment expansion; if there are unresolved contradictions in the simplified Boolean formula F when assigning v and 1-v to the unassigned variables, then return that there is no suitable assignment; partial assignment here means that in the process of processing Boolean formula F, only a part of the variables in a given variable set are assigned Boolean values (usually true (True) or false (False)), and the remaining variables have not yet been determined. The state of its value. It represents the intermediate state in the configuration space exploration process, reflecting the decisions that have been made and the parts that have not yet been decided. By gradually assigning values to the unassigned variables and checking whether the constraints of the Boolean formula are met after each assignment, a valid configuration combination, i.e., a candidate test case, can be gradually constructed.
[0071] The unresolved contradiction here means that when trying to find a suitable assignment for the remaining unassigned variables, it is found that no matter how the assignment is made, all the logical constraints in the Boolean formula F cannot be satisfied at the same time. This means that the current variable assignment path leads to a logically unsolvable situation, that is, no matter how the remaining variables are valued, at least one logical rule will be violated. This usually indicates that some configuration combinations in the software configuration space are impossible to exist, or there is a logical error in the design.
[0072] Step S24, repeating the steps S21 to S23 until all variables are assigned values, and if the expanded partial allocation satisfies all statements in the Boolean formula F, returning the expanded partial allocation, and taking the expanded partial allocation as a candidate test case, and adding it to the candidate test case set;
[0073] Step S25, repeat steps S21 to S24 to generate a candidate test case set.
[0074] In this step, an effective search model with an adaptive depth control mechanism is used to optimize the generation process of configuration test cases. This model intelligently adjusts the search depth and dynamically determines the depth limit based on the current search progress and effective feedback from the explored solution space. This dynamic adjustment and heuristic-driven approach significantly enhances the ability to discover high-quality test cases in large-scale configuration spaces, ensuring the comprehensiveness and efficiency of testing.
[0075] In step S3 of this embodiment, the approximate evaluation function is:
[0076] gain(α i )=|M(α i )|
[0077] Among them, gain(α i ) represents the benefit of the i-th candidate test case in the candidate test case set; |M(α i)| represents the coverage value of the i-th candidate test case in the candidate test case set for the t option combinations in the approximate metric set.
[0078] Get the best test cases, including:
[0079] α=argmax(gain(α i ))
[0080] Among them, argmax() indicates the location of obtaining the maximum value of the function.
[0081] In this stage, an approximate evaluation function is used to evaluate the potential value of each test case in the candidate test case set. This function quantifies the contribution of each test case to the overall test effect by comprehensively considering the individual benefits of each test case and its coverage of t configuration option value combinations in the approximate measurement set. It measures how many configuration option value combinations that have not been fully covered can be touched by the test case to comprehensively evaluate the utility of the test case. By finding the maximum value point of the evaluation function, the test case that can best improve the test coverage and efficiency in the current candidate set is determined.
[0082] In step S4 of this embodiment, the approximate metric set is updated, including: based on the approximate metric set, removing the value combinations of t options covered by the best test case.
[0083] The purpose of this step is to avoid the subsequent generated test cases from repeatedly covering the same configuration combination, thereby promoting the diversity and comprehensiveness of the test case set, ensuring that test resources can more evenly explore the combination of different configurations in the software system, and improving the efficiency and effectiveness of combination testing.
[0084] In step S5 of this embodiment, the preset conditions are defined as two key elements:
[0085] Test case quantity threshold: This condition sets a target test case set size, that is, the number of test cases included in the final candidate test case set should reach or not exceed the preset number. For example, if the preset test case quantity threshold is N, this condition is considered to be met when the size of the final candidate test case set is equal to N. The purpose of this is to ensure the management feasibility of the test case set and the resource efficiency of the test activities, and avoid excessive resource consumption caused by too many test cases.
[0086] Maximum number of iterations: This is another stopping condition that limits the duration or complexity of the entire test case generation process. When starting the combinatorial test approach, a maximum number of iterations is pre-set. Each time a cycle from selecting the best test case to updating the approximate metric set is completed, the iteration counter is incremented. Once the number of iterations is reached, the entire process is terminated even if the threshold number of test cases or other goals have not been reached. This prevents the algorithm from falling into an infinite loop and ensures that the testing activities are completed within the scheduled time.
[0087] If any of the above preset conditions is met: the number of test cases in the final candidate test case set reaches the preset test case number threshold, or the number of iterations reaches the maximum number of iterations, the final candidate test case set is output for subsequent combination testing.
[0088] like Figure 3 As shown, in step S6 of this embodiment, the test intensity t adaptive adjustment strategy includes:
[0089] Step S61, setting a coverage target threshold, when the actual coverage is lower than the threshold, activating the test intensity t adjustment mechanism;
[0090] Step S62: dynamically calculating a new test intensity t according to the deviation between the current coverage and the target through a PID controller;
[0091] Step S63: Implement the rule of gradually increasing or decreasing the test intensity t to respond to the real-time changes in coverage.
[0092] In this step, an intelligent test intensity t adaptive adjustment strategy is introduced to optimize the test resource configuration and accelerate the achievement of the expected test coverage target. The strategy first sets a clear coverage target threshold in step S61 as a baseline for the test effect. When the actual test coverage is detected to be lower than the preset threshold, the built-in test intensity t adjustment mechanism is immediately activated, which ensures the flexibility and pertinence of the test process.
[0093] The subsequent step S62 utilizes the PID controller, a classic control theory tool, which can accurately respond to the deviation between the current test coverage and the established target coverage, and dynamically recalculate the appropriate value of the test intensity t. The PID controller comprehensively considers the feedback information of the three aspects of proportion (P), integration (I) and differentiation (D), effectively balancing fast response and stability, ensuring that the adjustment strategy is both timely and accurate.
[0094] Finally, step S63 adopts a gradually increasing or decreasing adjustment rule according to the new test intensity t value output by the PID controller to finely adjust the depth and breadth of the test. This dynamic adjustment can not only actively respond to the real-time fluctuation of coverage, but also effectively avoid over-testing or under-testing, ensuring that the test activities always focus on accelerating the coverage to the target, thereby maximizing the test efficiency and quality, and ensuring that the combination test of the configurable software system is both comprehensive and efficient.
[0095] Repeat steps S1 to S5, regenerate and optimize the test case set according to the latest test intensity t in each iteration, and when the actual test coverage exceeds the preset target, stop the iteration and output the final test case set to perform a combination test of the configurable software system to be tested.
[0096] In this embodiment, the combined test combines the feedback mechanism of the fault injection and recovery test;
[0097] The feedback mechanism defines the fault model and combines configurable tools to perform various fault tests, and then conducts evaluation and software system optimization based on the fault test results. Specifically, it includes:
[0098] Fault model definition: includes: collecting and classifying possible fault types, such as hardware failure, network interruption, resource exhaustion, etc.; designing specific models for each type of fault, clarifying the triggering conditions, manifestations and expected impact of the fault; associating the fault model with system configuration options to identify which configuration combinations may amplify or suppress specific types of faults.
[0099] Automated fault injection tools: including: designing configurable interfaces to support users to customize the type, injection time and severity of faults according to test cases; implementing precise fault triggering mechanisms to ensure that faults occur in the system as expected; integrating monitoring functions to collect system status information before and after fault injection.
[0100] Critical configuration combination selection: including: identifying core functions and high-risk configuration options in the system based on business logic and historical failure data; giving priority to test cases that cover a wide range of dependencies and have highly complex configuration combinations; using approximate metric sets as guidance to ensure that the selected configuration combinations can maximize test coverage.
[0101] Fault injection and recovery test execution: Execute random and directed fault injection strategies to ensure coverage of various fault scenarios; apply progressive fault injection to gradually increase the fault level and test the system's ability to withstand extremes; enable enhanced system monitoring and logging before and after fault injection to fully record fault behavior and system response.
[0102] Result analysis and evaluation: Analyze system logs during and after fault injection to confirm the effectiveness of fault detection and response mechanisms; compare expected recovery behavior with actual recovery to evaluate the completeness and speed of system recovery; identify system weaknesses and potential improvement points based on test results.
[0103] Iterative optimization and feedback: Adjust and add test cases based on discovered faults and insufficient system responses; update the approximate measurement set to ensure that the test case set can more accurately reflect the complexity of the system configuration space; establish a feedback mechanism to feed back test results and suggestions to the development team to promote continuous improvement of software quality.
[0104] Embodiment 2;
[0105] This embodiment is aimed at a configurable customer relationship management system (CRM), which is highly customizable and allows users to adjust various configuration options such as user interface style, data import and export formats, automated workflow rules, email notification settings, etc. according to enterprise needs. There are n = 8 configuration options in the system, and each configuration option has an average of m = 4 possible values. The theoretical configuration space is 4^8≈65,536 combinations. Considering resource and time constraints, the test team plans to adopt a test intensity t = 3-wise strategy, that is, to test the interaction effect between any three configuration options.
[0106] Constructing Boolean formula F and approximate measurement set: First, by analyzing the configuration manual and source code of the CRM system, the constraints between all configuration options are identified. For example, a specific data import format is only compatible with certain workflow rules. These constraints are converted into Boolean expressions to form Boolean formula F. Based on the t=3-wise test strength, the Fisher-Yates shuffle algorithm is used to randomly select some combinations of values of 3 options from all possible configuration combinations as the approximate measurement set to reduce the size of the configuration space and maintain its representativeness.
[0107] Constructing a candidate test case set: The Boolean formula F is input into an efficient search model based on a constraint solver. The model uses a depth-first search combined with a constraint propagation algorithm to solve the Boolean formula. During the search process, the model first fixes a set of selected configuration options, and then recursively searches for values that meet the constraints for other options, gradually generating an initial set of candidate test cases. For example, the search model may first determine a specific combination of data import format, workflow rules, and email notification settings to ensure that these configuration items are compatible with each other.
[0108] Calculate the benefit and obtain the best test case: Use the constructed approximate metric set to evaluate the benefit of each candidate test case through an approximate evaluation function, which comprehensively considers the contribution of the candidate test case to the configuration option value combinations that are not fully covered. For example, if a candidate test case can cover 10 additional triple configuration combinations that have not been tested, its benefit is 10. By comparing the benefits of all candidate test cases, select the test case with the highest benefit to add to the test case set.
[0109] Update the approximate metric set: Remove the configuration combinations covered by the best test cases selected into the test case set from the approximate metric set to ensure that subsequent searches can explore new configuration combinations, avoid repeated testing, and improve the diversity of the test case set.
[0110] Build a test case set: Repeat steps S2 to S4 until the test case set reaches a preset size, such as 50 test cases, each for a specific configuration combination. The preset conditions include the test case number threshold (e.g., 50) and the maximum number of iterations (e.g., 100 iterations). If any of the conditions is met, the iteration stops and the final test case set is output.
[0111] Adaptive adjustment strategy of test intensity t: In the process of building a test case set, set an expected coverage target threshold. Monitor the deviation between the current coverage and the target coverage through the PID controller, and dynamically adjust the test intensity t. If the actual coverage is lower than the target value, the PID controller will calculate the new test intensity based on the deviation, and adjust the depth and breadth of the search by gradually increasing or decreasing it to more effectively approach the coverage target and ensure the efficiency and quality of the test activities.
[0112] Finally, the generated test case set is used to conduct a combination test on the CRM system. The system runs under different configuration combinations to verify its correctness, stability and performance. Combined with the feedback mechanism of fault injection and recovery testing, the comprehensiveness of the test is further enhanced. The fault tolerance and recovery mechanism of the system are evaluated by simulating fault scenarios, and the software is continuously optimized accordingly.
[0113] The above further illustrates how to conduct efficient and high-coverage combinatorial testing in a configurable CRM system to ensure that key system configurations are fully tested under limited resources.
[0114] In addition, this embodiment also collects a data set consisting of 123 public instances based on a highly configurable system, and each instance is encoded as a conjunction normal form.
[0115] For each test case generation method (Uniform sampling, Baital, Ns, PLEDGE, Ls-sampling), 500 configurations are selected as test cases from the configuration space of highly configurable systems according to their specific algorithms and strategies. Each method operates independently and aims to cover different configuration combinations in order to efficiently detect errors or vulnerabilities in the system.
[0116] Each instance (i.e., a configuration encoded as a conjunctive normal form in the dataset) is tested using all the test case sets generated by the five methods in turn. Each instance is tested with 500 test cases, and this testing process is repeated for all 123 instances in the dataset.
[0117] After running the test on all instances, the test results are shown in the following table:
[0118]
[0119] It can be seen from the above table that the test case set generation method based on system search with guaranteed effectiveness proposed in this embodiment generates a higher coverage rate of the test case set than other advanced test case set generation methods. This illustrates the effectiveness of the test case set generation method based on system search with guaranteed effectiveness proposed in the present invention in generating high-quality test case sets.
[0120] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0121] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A combined testing method applied to a configurable software system, characterized in that: include: Step S1, based on the constraint relationship configured in the configurable software system to be tested, obtain a Boolean formula F, and construct an approximate measurement set in combination with the test intensity t; Step S2: input the Boolean formula F into a valid search model to construct a candidate test case set; Step S3, using the approximate metric set, calculating the benefit of each candidate test case in the candidate test case set through an approximate evaluation function, and obtaining the best test case; Step S4: based on the best test case, updating the approximate metric set to obtain an updated approximate metric set; Step S5, adding the best test case to the test case set, repeating steps S2 to S4 until the preset conditions are met, and outputting the test case set; Step S6: Combining the test intensity t adaptive adjustment strategy, repeat the steps S1 to S5 to obtain a test case set under different test intensities t, and perform a combined test of the configurable software system to be tested.
2. A combined testing method for a configurable software system according to claim 1, characterized in that: In the step S1, constructing an approximate metric set includes: The Fisher-Yates shuffling algorithm is used to randomly sample all the value combinations of t options, and several value combinations of t options are selected as the approximate measurement set.
3. A combined testing method for a configurable software system according to claim 1, characterized in that: In step S2, the effective search model adopts an adaptive depth control mechanism to dynamically adjust the search depth limit according to the current search depth and the effectiveness of the explored solution space.
4. A combined testing method for a configurable software system according to claim 1, characterized in that: The step S2 comprises: Step S21: Based on the effective search model, the Boolean formula F is simplified by using unit propagation and pure character elimination, and the set of unassigned variables is updated; Step S22, selecting an unassigned variable from the unassigned variable set, and sampling a Boolean value v based on the sampling probability prob(u) of the unassigned variable; Step S23, assign v and 1-v to the unassigned variables in turn, and perform partial assignment expansion; if there are unresolved contradictions in the simplified Boolean formula F when assigning v and 1-v to the unassigned variables, return that there is no suitable assignment; Step S24, repeating the steps S21 to S23 until all variables are assigned values, and if the expanded partial allocation satisfies all statements in the Boolean formula F, returning the expanded partial allocation, and taking the expanded partial allocation as a candidate test case, and adding it to the candidate test case set; Step S25, repeat steps S21 to S24 to generate a candidate test case set.
5. A combined testing method for a configurable software system according to claim 4, characterized in that: In step S22, the sampling probability prob(u) of the unassigned variable is obtained by a heuristic selection strategy; the heuristic selection strategy dynamically adjusts the sampling probability of the unassigned variable based on the degree of simplification of the Boolean formula and the influence of the unassigned variable on the current test case set.
6. A combined testing method for a configurable software system according to claim 1, characterized in that: In step S3, the approximate evaluation function is: gain(a i )=|M(α i )| Among them, gain(α i ) represents the benefit of the i-th candidate test case in the candidate test case set; |M(α i )| represents the coverage value of the i-th candidate test case in the candidate test case set for the t option combinations in the approximate metric set.
7. A combined testing method for a configurable software system according to claim 1, characterized in that: In step S3, obtaining the best test case includes: α=argmax(gain(α i )) Among them, argmax() indicates the location of obtaining the maximum value of the function.
8. A combined testing method for a configurable software system according to claim 1, characterized in that: In the step S4, the approximate metric set is updated, including: based on the approximate metric set, t option combinations covered by the best test case are removed.
9. A combined testing method for a configurable software system according to claim 1, characterized in that: In step S5, the preset conditions include: a test case quantity threshold and a maximum number of iterations.
10. A combined testing method for a configurable software system according to claim 1, characterized in that: In step S6, the test intensity t adaptive adjustment strategy includes: Step S61, setting a coverage target threshold, when the actual coverage is lower than the threshold, activating the test intensity t adjustment mechanism; Step S62: dynamically calculating a new test intensity t according to the deviation between the current coverage and the target through a PID controller; Step S63: Implement the rule of gradually increasing or decreasing the test intensity t to respond to the real-time changes in coverage.
Citation Information
Cited By
Distributed testing system and method based on micro-service architecture
CN120045449A
Generation method of paired combination test cases applied to configurable software
CN121880220A
A method for generating pairwise combination test cases applied to configurable software
CN121880220B
