Test case construction method, system and storage medium based on knowledge base
Through the knowledge base-based test case construction method, the problem of repeated test cases and dependence on experience in the existing technology is solved, efficient reuse and optimization of test cases is achieved, and testing efficiency and quality are improved.
Patent Information
- Application Number
- CN202410800243.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-06-20
AI Technical Summary
In the existing technology, test cases need to be rebuilt for each new test project or version, and the construction of test cases depends on the experience and skills of the testers, resulting in redundancy and duplication of test cases, difficult to guarantee the test quality, and inefficient testing. .
Provide a test case construction method based on the knowledge base. By obtaining the set of items to be tested, matching the test input data attributes and output data attributes, matching the initial test case set based on the knowledge base, and evaluating it for typical values, boundary values, and frequency analysis. , determine the evaluation value and filter the target test cases.
By reusing and optimizing historical test cases, the workload of the test team is reduced, testing efficiency is improved, testing quality and coverage are ensured, and testing costs are reduced.
Smart Images

Figure CN118672920B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and specifically to a test case construction method, system and storage medium based on a knowledge base. Background Art
[0002] With the increasing complexity of software systems and the continuous increase in testing requirements, traditional test case construction methods have been unable to meet the needs of efficient and high-quality testing. A test case construction method based on a knowledge base has emerged, aiming to improve testing efficiency and quality by reusing, optimizing and sharing test case knowledge. This method relies on advanced software technology and database technology to store historical test cases, test experience, test data, etc. in a knowledge base, providing a unified and accessible test resource for the test team.
[0003] In summary, the prior art has the technical problem that test cases need to be rebuilt for each new test project or version, and the construction of test cases depends on the experience and skills of testers, resulting in redundancy and duplication of test cases, difficulty in ensuring test quality, and low test efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a knowledge base-based test case construction method, system and storage medium to address the above technical problems. The knowledge base-based test case construction method can reduce the workload of the test team and improve the test efficiency by reusing and optimizing historical test cases.
[0005] In a first aspect, a test case construction method based on a knowledge base is provided, the method comprising: obtaining a set of software projects to be tested; matching test input data attributes and output data attributes according to the set of projects to be tested; matching an initial test case set based on the test input data attributes and output data attributes through a knowledge base; performing typical value, boundary value, and frequency analysis and evaluation on the initial test case set to determine an evaluation value of each initial test case; obtaining the target number of use cases and the proportion of use cases of core parameters of the set of projects to be tested; based on the target number of use cases and the proportion of use cases of core parameters, screening target test cases according to the evaluation values to obtain target test cases.
[0006] In a second aspect, a test case construction system based on a knowledge base is provided, the system comprising: a module for acquiring a set of items to be tested, the module for acquiring a set of items to be tested of the software; a matching module, the module for matching test input data attributes and output data attributes according to the set of items to be tested; a module for matching an initial test case set, the module for matching an initial test case set based on the test input data attributes and output data attributes through a knowledge base; an evaluation value determination module, the module for performing typical value, boundary value and frequency analysis and evaluation on the initial test case set to determine the evaluation value of each initial test case; a module for acquiring a use case ratio, the module for acquiring a use case ratio to obtain the target number of use cases and the use case ratio of core parameters of the set of items to be tested; a target test case acquisition module, the module for screening target test cases according to the evaluation value based on the target number of use cases and the use case ratio of core parameters to obtain target test cases.
[0007] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps described in the first aspect are implemented.
[0008] The above-mentioned knowledge base-based test case construction method, system and storage medium solve the technical problems in the prior art that test cases need to be rebuilt for each new test project or version, and the construction of test cases depends on the experience and skills of testers, resulting in redundancy and duplication of test cases, difficulty in ensuring test quality, and low test efficiency. The knowledge base-based test case construction method reduces the workload of the test team and improves the test efficiency by reusing and optimizing historical test cases.
[0009] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A schematic diagram of a flow chart of a test case construction method based on a knowledge base in an embodiment;
[0011] Figure 2 A schematic diagram of a process for determining a boundary value of a test case construction method based on a knowledge base in an embodiment;
[0012] Figure 3 A structural block diagram of a knowledge base-based test case construction system in one embodiment.
[0013] Explanation of the reference numerals: module for acquiring a set of items to be tested 11 , matching module 12 , module for matching an initial test case set 13 , evaluation value determination module 14 , module for acquiring a proportion of test cases 15 , and module for obtaining target test cases 16 . DETAILED DESCRIPTION
[0014] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0015] like Figure 1 As shown, the present application provides a test case construction method based on a knowledge base, the method comprising:
[0016] Get the set of projects to be tested for the software.
[0017] A knowledge base is a database that stores structured information in a centralized manner. It is usually used to support various applications, such as intelligent question-answering systems, recommendation systems, decision support systems, natural language processing, etc. The information in a knowledge base can include facts, rules, definitions, relationships, attributes, etc., which are organized in some form for efficient query and reasoning. The construction of test cases is an important part of the software testing process, which is used to guide the implementation of the test and ensure the comprehensiveness and accuracy of the test. Test cases in a knowledge base are often highly dependent on specific data structures and contents. As the scale and complexity of the knowledge base increase, it becomes more difficult to design comprehensive and effective test cases, and some key scenarios or edge cases are omitted, resulting in incomplete testing. By providing a test case construction method based on a knowledge base, the key scenarios and edge cases of the knowledge base are effectively covered, the defects of the test case construction method based on the knowledge base are overcome, and its efficiency and effectiveness are improved.
[0018] Software generally refers to programs and data in a computer system, as well as documentation for the programs and data. In this application, it refers to programs or systems that need to be tested and their quality and performance verified. To be tested refers to what is waiting to be tested and is about to be tested. A project refers to a specific task or work, usually with a clear goal and plan. In this application, a project can refer to a specific software function, module, business process or feature, etc., which all need to be tested to verify their correctness. To be tested items are software functions, modules, businesses, etc. waiting to be tested. In software testing, a set represents a group of items or function points to be tested, which need to be considered and managed in a unified manner to ensure that they are all properly tested. Obtaining a set of software items to be tested means determining, identifying or collecting a set of software items or function points that need to be tested. Through the above method, a set of items to be tested is obtained in order to carry out subsequent software testing work.
[0019] Obtain target requirement information of the software; parse modules or function points according to the target requirement information; and use the modules or function points obtained by parsing as the set of items to be tested.
[0020] Obtain the target requirement information of the software, usually from product documents, user stories, use case descriptions or other project-related materials, determine the clear description of the expected behavior, characteristics or results of the software, and after obtaining the target requirement information, parse the target requirement information and break it down into smaller, manageable parts, namely modules or function points, to ensure the completeness and accuracy of the test and ensure that each module or function point is properly tested. After parsing the target requirement information and obtaining the modules or function points, use the modules or function points as a set of items to be tested. The set of items to be tested will serve as the basis for subsequent testing work to ensure that all important parts that need to be tested are paid attention to. Through the above method, starting from obtaining the target requirement information of the software, the modules or function points are identified by parsing the target requirement information, and finally the modules or function points are used as a set of items to be tested, laying the foundation for subsequent software testing work.
[0021] According to the set of items to be tested, the test input data attributes and output data attributes are matched.
[0022] According to the set of items to be tested, all software modules, function points or features that need to be tested are included, which are usually parsed according to the target requirement information of the software and represent the core functions and business logic of the software. The test input data attribute refers to the data and related characteristics that need to be input into the system under test when executing the test case, including user input, system parameters, configuration files, database records, etc. In order to effectively test the items to be tested, it is necessary to determine the corresponding input data attributes for each item to be tested. For example, for the order function of an e-commerce website, the input data attributes may include product ID, quantity, delivery address, payment method, etc. The output data attribute refers to the data and related characteristics returned or generated by the system under test after executing the test case. It is usually used to verify whether the system works as expected and whether the correct results are generated. Similar to the input data attribute, the corresponding output data attribute is determined for each item to be tested. For example, for the order function, the output data attribute may include order number, payment status, logistics information, etc. After determining the set of items to be tested, the test input data attribute and the output data attribute, the set of items to be tested, the test input data attribute and the output data attribute are matched. According to the above method, matching the test input data attributes and output data attributes of the set of items to be tested has a significant beneficial effect on improving the test coverage and enhancing the pertinence and accuracy of the test.
[0023] An initial test case set is matched based on the test input data attributes and output data attributes through the knowledge base.
[0024] The knowledge base should contain various information related to the system to be tested, including but not limited to input data attributes, output data attributes, expected input / output relationships, boundary conditions, abnormal situations, etc. The knowledge base can be collected through historical data, documents, expert knowledge or previous test cases. For the given test input data attributes, it is necessary to clarify its data type, value range, possible boundary values and relationship with other attributes. For the output data attributes, it is necessary to understand its expected data type, structure and possible range of variation. Search for existing test cases that match the test input data attributes in the knowledge base. Search through fields such as attribute name, data type, value range, etc., that is, match the initial test case set based on the test input data attributes and output data attributes. Through the above method, matching the initial test case set according to the knowledge base not only improves the efficiency and quality of the testing work, but also reduces costs and enhances the maintainability, consistency and traceability of the test.
[0025] The initial test case set is analyzed and evaluated in terms of typical values, boundary values, and frequency, to determine the evaluation value of each initial test case.
[0026] It is an effective method to prioritize and screen test cases by analyzing and evaluating the typical value, boundary value, and frequency of the initial test case set to determine the evaluation value of each initial test case. The typical value is used to evaluate whether the test case covers the main functions and common usage scenarios of the system, identify the main functions and common usage scenarios of the software, check whether the test case contains the typical input data of these functions and scenarios, and assign evaluation values to the test case based on the completeness and accuracy of the typical value coverage. The boundary value refers to evaluating whether the test case considers the boundary conditions of the input data to find possible boundary errors. By determining the boundary values of the input data, including the minimum value, maximum value, upper and lower limits, etc., check whether the test case contains tests for these boundary values. According to the completeness and rationality of the boundary value coverage, the evaluation value is assigned to the test case. Frequency refers to evaluating the frequency of the functions or scenarios covered by the test case in actual use to determine the test priority. By collecting or estimating the frequency data of the functions or scenarios of the system in actual use, the frequency of the functions or scenarios covered by the test case is analyzed, and the evaluation value is assigned to the test case based on the frequency data. Frequently used functions or scenarios should have higher evaluation values. Through the above method, the typical value, boundary value and frequency analysis and evaluation can provide a comprehensive and objective evaluation result for the initial test case set, which can better understand the quality and coverage of the test cases and provide strong support for subsequent testing work.
[0027] According to each input field in the initial test case set, a valid value domain and an invalid value domain are defined, wherein the valid value domain is the input value within the allowed range, and the invalid value domain is the input value outside the allowed range; perform mean calculation according to the valid value domain of the initial test case set, and obtain a typical value based on the mean calculation of the valid value domain; perform boundary value calculation according to the valid value domain and the invalid value domain to obtain a boundary value; perform reliability evaluation of the initial test case using the typical value and the boundary value, respectively, to obtain a first evaluation value; obtain the frequency of use of the initial test case, perform reliability evaluation based on the frequency, and obtain a second evaluation value; perform fusion calculation using the first evaluation value and the second evaluation value to obtain an evaluation value of the initial test case.
[0028] According to each input field in the initial test case set, a valid value domain and an invalid value domain are defined. The valid value domain is to determine the input value within the allowable range according to the specifications and requirements of each input field. It should meet the functional requirements of the software and will not cause errors or exceptions; the invalid value domain is an input value outside the defined allowable range, which may include data that is illegal, abnormal, or exceeds the system processing capacity. According to the valid value domain of the initial test case set, the mean value is calculated. For the valid value domain of each input field, the average value of all valid values is calculated. If the data distribution is uneven, the median is calculated. Based on the mean of the valid value domain, one or more representative values are selected as typical values, which can represent common or important situations in the valid value domain. According to the valid value domain and the invalid value domain, the boundary value calculation is performed to obtain the boundary value, and the input value is selected at the junction of the valid value domain and the invalid value domain, which is usually the maximum and minimum values allowed. By calculating the boundary value, it is ensured that the boundary value test covers the boundary of the valid value domain and the invalid value domain, as well as possible boundary conditions or abnormal situations. The typical value and boundary value are used to evaluate the reliability of the initial test case respectively to obtain a first evaluation value, and a set of evaluation criteria is defined to measure whether the test case fully uses the typical value and boundary value. According to the coverage of the typical value and boundary value by the test case, a reliability score is assigned to the test case, which is recorded as the first evaluation value. The frequency of use of the initial test case is obtained, and the reliability evaluation is performed based on the frequency. The frequency data of the functions or scenarios covered by the test case in actual use is collected or estimated. Based on the frequency data, a reliability score is assigned to the test case, which is recorded as the second evaluation value. Functions or scenarios with high frequency of use should have higher evaluation values. Appropriate weights are set for the first evaluation value and the second evaluation value to reflect their importance in the test case evaluation. The first evaluation value and the second evaluation value are weighted and summed according to the set weights to obtain the final test case evaluation value. Through the above method, a comprehensive reliability evaluation value is assigned to each test case in the initial test case set, thereby helping the test team to better understand the quality and priority of the test case and provide strong support for subsequent testing work.
[0029] like Figure 2 As shown, according to the valid value range, the maximum valid value range and the minimum valid value range are obtained; according to the invalid value range, the immediate neighborhood values are extracted to obtain the neighborhood values; based on the maximum valid value range, the minimum valid value range and the neighborhood values, the boundary value is determined.
[0030] The maximum valid value domain is to determine the maximum value allowed by the input field, which is obtained based on the specifications, requirements or business logic of the system. The minimum valid value domain is to determine the minimum value allowed by the input field, which also depends on the specifications, requirements or business logic of the system. According to the invalid value domain, the adjacent domain value is extracted to obtain the neighborhood value. The value adjacent to the valid value domain is extracted from the invalid value domain. It is usually located outside the boundary of the valid value domain, but very close to the boundary. It is called the neighborhood value because it is adjacent to the boundary of the valid value domain. Based on the maximum valid value domain, the minimum valid value domain, and the neighborhood value, the boundary value is determined, the value of the maximum valid value domain is selected as the upper boundary value, and the value of the minimum valid value domain is selected as the lower boundary value. The extracted neighborhood value is tested as an additional boundary value, which can help discover edge cases or problems that may occur when the input value is close to the boundary of the valid value domain. For example, suppose there is an input field whose valid value domain is 1 to 100, including 1 and 100, and the invalid value domain is all values less than 1 and greater than 100. The maximum valid value range is 100, the minimum valid value range is 1, the adjacent domain value is 0, which is adjacent to the minimum valid value range, and 101, which is adjacent to the maximum valid value range. The boundary values can be determined as 0, 1, 100, 101, which will be used to test the behavior of the system when the input value approaches or exceeds the boundary of the valid value range. Through the above method, determining the boundary value based on the valid value range can help testers evaluate the performance and reliability of the system more comprehensively and efficiently.
[0031] According to the initial test case input value and the typical value, an input difference value is obtained; according to the ratio of the input difference value to the typical value, a typical evaluation value is obtained; according to the initial test case input value and the boundary value, a boundary distance value is obtained; according to the ratio of the boundary distance value to the boundary value, a boundary evaluation value is obtained; and the maximum value of the typical evaluation value and the boundary evaluation value is set as the first evaluation value.
[0032] According to the initial test case input value and the typical value, an input difference value is obtained, and the input difference value refers to the difference or degree of difference between the input value in the initial test case and the defined typical value. This difference value can be used to quantitatively evaluate the closeness between the input of the test case and the typical value; by taking the ratio of the input difference value to the typical value as the typical evaluation value, the typical evaluation value is calculated by the ratio of the input difference value to the typical value, and is used to evaluate the closeness between the input of the test case and the typical value. The boundary distance value refers to the difference or distance between the input value of the initial test case and the defined boundary value. This distance value is used to quantitatively evaluate the closeness between the input of the test case and the boundary value, and then judge the coverage of the test case for the boundary condition. According to the ratio of the boundary distance value to the boundary value, a boundary evaluation value is obtained, which is calculated by the ratio of the boundary distance value to the boundary value, and is used to evaluate the closeness between the input of the test case and the boundary value, so as to judge the coverage of the test case for the boundary condition. The first evaluation value is obtained by comparing the typical evaluation value and the boundary evaluation value, and taking the maximum value of the two. This value represents the comprehensive importance or priority of the test case. Setting this value helps testers determine the execution order or weight distribution of test cases. Through the above method, the typicality and boundary of test cases can be quantitatively evaluated, so as to design and execute tests more scientifically and improve the efficiency and effectiveness of tests.
[0033] Obtain the target number of use cases and the use case ratio of core parameters of the set of items to be tested.
[0034] The target number of test cases refers to the total number of test cases designed to test a certain project or function to be tested. These test cases are designed to cover different test scenarios, input conditions and expected outputs to ensure the quality and stability of the software. The acquisition method includes listing all test cases in the set of projects to be tested, counting these test cases, and obtaining the total number of test cases. If the test cases are grouped or classified, ensure that the test cases of all groups or categories are included in the statistics. The use case ratio of core parameters refers to the proportion of the number of test cases designed for key or core functions, parameters or business logic in the project to the number of all test cases. These core parameters are usually the most important part of the software function and have an important impact on the overall performance and reliability of the software. The acquisition method includes determining the core parameters or key functions in the project to be tested, determining them through requirements analysis, business logic analysis or expert review, identifying all test cases designed for core parameters, counting the number of these core parameter use cases, and calculating their proportion to the number of all test cases. Through the above method, the use case ratio of core parameters can help the test team identify and prioritize test tasks related to key functions or parameters. By focusing on these high-priority test cases, the test team can more effectively ensure that the key functions of the software are fully tested, thereby improving the quality and reliability of the software.
[0035] Perform an impact analysis based on the performance parameters of the module or function point and the target demand information to determine the impact coefficient of the module or function point; screen the core parameters based on the impact coefficient, and the core parameters are one or more parameters with the largest impact coefficient; obtain the use case uniformity requirement based on the parameter characteristics of the input value of the core parameter, and obtain the use case proportion of the core parameter based on the use case uniformity requirement; obtain the total proportion based on the impact coefficient distribution and the use case uniformity requirement; perform quantity configuration based on the total proportion and the target demand information to obtain the target quantity of the use cases.
[0036] According to the performance parameters of the modules or function points, an impact analysis is performed with the target demand information, and the performance parameters of each module or function point, including response time, throughput, error rate, etc., are analyzed, and these performance parameters are compared with the target demand information, such as business requirements, user expectations, quality standards, etc. Through the impact analysis, the degree of influence of each module or function point on the overall system or application is determined, so as to determine its impact coefficient. The impact coefficient is a quantitative indicator that reflects the importance of the module or function point to the overall system. According to the size of the impact coefficient, one or more parameters with the largest impact coefficient are selected as core parameters. These parameters are usually the most critical and sensitive parameters in the system or application, and have an important impact on ensuring system performance and user satisfaction. The parameter characteristics of the input values of the core parameters are analyzed, including the range, distribution, and change frequency of the input values. According to these parameter characteristics, the uniformity requirements of the test cases on these input values are determined. The uniformity requirement means that the test cases should cover all possible input values as evenly as possible to ensure the comprehensiveness and effectiveness of the test. Based on the uniformity requirements of the use cases, the use case proportion of the core parameters is calculated, which reflects the proportion of the test cases for the core parameters in all the test cases, which is determined according to the importance of the core parameters and the uniformity requirements of the use cases. According to the influence coefficient distribution and the use case uniformity requirements, calculate the total proportion. The total proportion is a comprehensive indicator that reflects the relative weight of the test cases of all modules or function points in the overall test plan. According to the coefficient distribution and uniformity requirements, the weight ratio is calculated, and the number is configured according to the total number of copies. According to the total proportion and target demand information, configure the target number of test cases. The target number should be determined based on the total proportion to ensure that the test plan can fully cover all important modules or function points and meet the use case uniformity requirements. When configuring the target number of use cases, it is also necessary to consider the limitations of test resources and the requirements of the test cycle. If the test resources are limited or the test cycle is short, the target number of use cases may need to be adjusted to ensure the feasibility and effectiveness of the test. Through the above method, the relevant parameters and quantity of the test cases are determined according to the performance parameters of the modules or function points and the target demand information, so as to formulate a comprehensive and effective test plan.
[0037] According to the target number of the use case and the proportion of the use cases of the core parameters, the target test cases are screened according to the evaluation values to obtain the target test cases.
[0038] According to the target number of test cases, the use case ratio of core parameters, and the importance and influence coefficient of the core parameters analyzed above, the use case ratio of core parameters is calculated. For each test case, the typical evaluation value and boundary evaluation value are calculated according to the relationship between the initial test case input value and the typical value and boundary value. The maximum value of the typical evaluation value and the boundary evaluation value is set as the evaluation value of the test case. An empty target test case set is initialized, all test cases are traversed, and they are sorted from high to low according to the evaluation value. Starting from the test case with the highest evaluation value, it is added to the target test case set in sequence until the number of test cases in the set reaches or exceeds the target number of test cases. In the above process, although the number of test cases reaches the target number, the use case ratio of core parameters does not reach the expected situation. In order to ensure the full testing of core parameters, in the screening process, it is necessary to regularly check the coverage of core parameters in the selected test cases. If it is found that the use case ratio of core parameters is lower than expected, it can be selected from the test cases with higher evaluation values and targeting core parameters to ensure the full coverage of core parameters. Through the above method, the target test cases are screened based on the evaluation value, and the number of test cases and the coverage of core parameters are ensured to meet the requirements of the project.
[0039] Determine whether the target test case meets the requirements of the target number of use cases and the proportion of use cases of core parameters; when not satisfied, evaluate the use cases based on the input values and output values to determine the extreme cases and the average cases; supplement the use cases through genetic algorithms based on the extreme cases and the average cases, and search for preferred use cases; when the combination of the preferred use cases and the target test case meets the requirements of the target number of use cases and the proportion of use cases of core parameters, output the combined use cases as the target test cases, and construct a supplementary use case set using the preferred use cases, and add the supplementary use case set to the knowledge base.
[0040] Count the number of target test cases and compare them with the target number of test cases. Analyze the use case ratio of core parameters in the target test cases and compare them with the expected use case ratio. If both meet the requirements, end the screening process; otherwise, proceed to the next step. Traverse the remaining unselected test cases, evaluate the use cases according to the input and output values, identify extreme cases, that is, test cases with inputs or outputs close to or beyond the normal range, and mean cases, that is, test cases with inputs or outputs close to the average value, initialize the population of the genetic algorithm, and the individuals in the population can be selected test cases, extreme cases, or mean cases. Define the fitness function, which should be able to reflect the contribution of the test cases to meeting the target number of use cases and the use case ratio requirements of core parameters. Through the genetic operations of selection, crossover, and mutation, iteratively search for the preferred use cases. In each iteration, evaluate the fitness of individuals in the population and retain individuals with high fitness. During the genetic algorithm search process, regularly combine the preferred use cases with the target test cases, and check whether the combined use cases meet the target number of use cases and the use case ratio requirements of core parameters. If they meet the requirements, stop the genetic algorithm search and proceed to the next step. Combine the preferred use cases that meet the requirements with the target test cases to form the final target test case set, and output the target test case set as the target of this test. Construct the preferred use cases generated during the search process but not selected to be added to the target test case set as a supplementary use case set, and add the supplementary use case set to the knowledge base for reuse or reference in future test projects. Through the above method, it is ensured that the target test cases not only meet the requirements of the target number of use cases and the proportion of use cases of core parameters, but also that the preferred use cases obtained through the genetic algorithm search can further improve the coverage and efficiency of the test. At the same time, by constructing and saving the supplementary use case set, valuable reference and reuse resources are provided for future test projects.
[0041] In summary, the beneficial effects of this application include:
[0042] 1. The knowledge base stores verified test cases from previous projects, which can be used in new test projects directly or with minor modifications. This greatly reduces the time to write test cases from scratch and improves testing efficiency.
[0043] 2. Test cases in the knowledge base have usually undergone multiple rounds of testing and verification, and have high reliability and stability. Reusing these cases can ensure the breadth and depth of test coverage, reduce omissions and errors, and thus improve test quality.
[0044] 3. Through the analysis and evaluation of test cases in the knowledge base, as testing experience accumulates, the knowledge base can continuously optimize the design and execution methods of test cases and improve testing efficiency and quality.
[0045] 4. The test cases in the knowledge base have clear information such as input, output and expected results, which can ensure the traceability and repeatability of the test.
[0046] like Figure 3 As shown, the embodiment of the present application includes a test case construction system based on a knowledge base, and the system includes:
[0047] A module 11 for acquiring a set of items to be tested, wherein the module 11 is used to acquire a set of items to be tested of the software;
[0048] A matching module 12, the matching module 12 is used to match the test input data attributes and output data attributes according to the set of items to be tested;
[0049] An initial test case set matching module 13, wherein the initial test case set matching module 13 is used to match the initial test case set based on the test input data attributes and output data attributes through a knowledge base;
[0050] An evaluation value determination module 14, the evaluation value determination module 14 is used to perform typical value, boundary value, and frequency analysis and evaluation on the initial test case set to determine the evaluation value of each initial test case;
[0051] A use case ratio acquisition module 15, wherein the use case ratio acquisition module 15 is used to obtain the target number of use cases and the use case ratio of core parameters of the set of items to be tested;
[0052] The target test case acquisition module 16 is used to screen the target test cases according to the target number of the test cases, the use case proportion of the core parameters, and the evaluation value to obtain the target test cases.
[0053] Furthermore, the embodiment of the present application also includes:
[0054] A target requirement information acquisition module, wherein the target requirement information acquisition module is used to acquire target requirement information of the software;
[0055] A function point analysis module, the function point analysis module is used to analyze modules or function points according to the target demand information;
[0056] The module for collecting items to be tested is used to use the modules or function points obtained through analysis as the set of items to be tested.
[0057] Furthermore, the embodiment of the present application also includes:
[0058] A value range definition module, the value range definition module is used to define a valid value range and an invalid value range according to each input field in the initial test case set, wherein the valid value range is an input value within an allowable range, and the invalid value range is an input value outside the allowable range;
[0059] A typical value obtaining module, the typical value obtaining module is used to perform mean calculation according to the valid value range of the initial test case set, and obtain a typical value based on the valid value range mean calculation;
[0060] A boundary value obtaining module, the boundary value obtaining module is used to calculate the boundary value according to the valid value range and the invalid value range to obtain the boundary value;
[0061] A first evaluation value obtaining module, the first evaluation value obtaining module is used to respectively use the typical value and the boundary value to perform reliability evaluation of the initial test case to obtain a first evaluation value;
[0062] A second evaluation value obtaining module, the second evaluation value obtaining module is used to obtain the usage frequency of the initial test case, perform reliability evaluation based on the frequency, and obtain a second evaluation value;
[0063] A fusion calculation module is used to perform fusion calculation using the first evaluation value and the second evaluation value to obtain the evaluation value of the initial test case.
[0064] Furthermore, the embodiment of the present application also includes:
[0065] An effective value range extreme value obtaining module, the effective value range extreme value obtaining module is used to obtain a maximum effective value range and a minimum effective value range according to the effective value range;
[0066] A neighborhood value acquisition module, the neighborhood value acquisition module is used to extract the immediate neighborhood value according to the invalid value range to obtain the neighborhood value;
[0067] A boundary value obtaining module, wherein the boundary value obtaining module is used to determine the boundary value based on the maximum valid value range, the minimum valid value range, and the neighborhood value.
[0068] Furthermore, the embodiment of the present application also includes:
[0069] An input difference value obtaining module, the input difference value obtaining module is used to obtain an input difference value according to the initial test case input value and the typical value;
[0070] A typical evaluation value obtaining module, wherein the typical evaluation value obtaining module is used to obtain a typical evaluation value according to a ratio of the input difference value to the typical value;
[0071] A boundary distance value obtaining module, wherein the boundary distance value obtaining module is used to obtain a boundary distance value according to the initial test case input value and the boundary value;
[0072] A boundary evaluation value obtaining module, wherein the boundary evaluation value obtaining module is used to obtain a boundary evaluation value according to a ratio of the boundary distance value to the boundary value;
[0073] A maximum value setting module is used to set the maximum value among the typical evaluation value and the boundary evaluation value as the first evaluation value.
[0074] Furthermore, the embodiment of the present application also includes:
[0075] An influence analysis module, the influence analysis module is used to perform influence analysis based on the performance parameters of the module or function point and the target demand information to determine the influence coefficient of the module or function point;
[0076] A core parameter screening module, the core parameter screening module is used to screen the core parameters according to the influence coefficient, the core parameters being one or more parameters with the largest influence coefficient;
[0077] A use case ratio obtaining module, the use case ratio obtaining module is used to obtain a use case uniformity requirement based on a parameter feature of an input value of the core parameter, and obtain a use case ratio of the core parameter based on the use case uniformity requirement;
[0078] A total proportion obtaining module, the total proportion obtaining module is used to obtain the total proportion according to the influence coefficient distribution and the use case uniformity requirement;
[0079] A quantity configuration module is used to perform quantity configuration according to the total proportion and target demand information to obtain the target quantity of the use case.
[0080] Furthermore, the embodiment of the present application also includes:
[0081] A judgment module, the judgment module is used to judge whether the target test case meets the requirements of the target number of test cases and the proportion of test cases of core parameters;
[0082] A use case evaluation module, wherein the use case evaluation module is used to evaluate the use case based on the input value and the output value when the condition is not satisfied, and determine the extreme case and the average case;
[0083] A preferred case search module, which is used to supplement the case through a genetic algorithm based on the extreme case and the average case, and search for a preferred case;
[0084] A condition satisfaction module is used to output the combined use case as a target test case when the combination of the preferred use case and the target test case meets the requirements of the target number of use cases and the use case ratio of core parameters, and at the same time use the preferred use case to construct a supplementary use case set and add the supplementary use case set to the knowledge base.
[0085] For the specific embodiment of the test case construction system based on the knowledge base, please refer to the embodiment of the test case construction method based on the knowledge base above, which will not be repeated here. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0086] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of a test case construction method based on a knowledge base are implemented.
[0087] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0088] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A test case construction method based on a knowledge base, characterized in that: The method comprises: Get the set of software projects to be tested; According to the set of items to be tested, matching test input data attributes and output data attributes; Matching an initial test case set based on the test input data attributes and output data attributes through a knowledge base; Performing typical value, boundary value, and frequency analysis and evaluation on the initial test case set to determine an evaluation value for each initial test case; Obtain the target number of use cases and the proportion of use cases of core parameters of the set of items to be tested; According to the target number of the use cases and the proportion of the use cases of the core parameters, the target test cases are screened according to the evaluation values to obtain the target test cases; The step of obtaining a set of software items to be tested includes: Obtain target demand information for the software; Analyze modules or functional points according to the target demand information; The modules or functional points obtained by analysis are used as the set of items to be tested; The typical value, boundary value and frequency analysis and evaluation of the initial test case set are performed to determine the evaluation value of each initial test case, including: According to each input field in the initial test case set, a valid value range and an invalid value range are defined, wherein the valid value range is an input value within the allowed range, and the invalid value range is an input value outside the allowed range; Performing mean calculation according to the valid value range of the initial test case set, and obtaining a typical value based on the mean calculation of the valid value range; Calculate the boundary value according to the valid value range and the invalid value range to obtain the boundary value; Reliability evaluation of the initial test case is performed using the typical value and the boundary value to obtain a first evaluation value; Obtaining the usage frequency of the initial test case, performing reliability evaluation based on the frequency, and obtaining a second evaluation value; Performing a fusion calculation using the first evaluation value and the second evaluation value to obtain an evaluation value of the initial test case; The target number of use cases and the proportion of use cases of core parameters of the set of items to be tested are obtained, including: Perform an impact analysis based on the performance parameters of the module or function point and the target demand information to determine the impact coefficient of the module or function point; According to the influence coefficient, the core parameters are selected, wherein the core parameters are one or more parameters with the largest influence coefficient; Based on the parameter characteristics of the input values of the core parameters, a use case uniformity requirement is obtained, and based on the use case uniformity requirement, a use case ratio of the core parameters is obtained; Obtaining a total proportion according to the influence coefficient distribution and the use case uniformity requirement; The quantity is configured according to the total proportion and target demand information to obtain the target quantity of the use case.
2. The method according to claim 1, characterized in that According to the valid value range and the invalid value range, boundary value calculation is performed to obtain the boundary value, including: According to the valid value range, obtain the maximum valid value range and the minimum valid value range; Extracting the immediate neighborhood value according to the invalid value range to obtain the neighborhood value; The boundary value is determined based on the maximum valid value range, the minimum valid value range, and the neighborhood value.
3. The method according to claim 1, characterized in that Reliability evaluation of the initial test case is performed using the typical value and the boundary value to obtain a first evaluation value, including: Obtaining an input difference value according to the initial test case input value and the typical value; Obtaining a typical evaluation value according to a ratio of the input difference value to the typical value; Obtaining a boundary distance value according to the initial test case input value and the boundary value; Obtaining a boundary evaluation value according to a ratio of the boundary distance value to the boundary value; The maximum value among the typical evaluation value and the boundary evaluation value is set as the first evaluation value.
4. The method according to claim 1, characterized in that After obtaining the target test case, the method further includes: Determine whether the target test case meets the requirements of the target number of test cases and the proportion of test cases of core parameters; When it is not satisfied, use case evaluation is performed based on input values and output values to determine extreme cases and average cases; Based on the extreme cases and average cases, the use cases are supplemented by genetic algorithms to search for optimal use cases; When the combination of the preferred use case and the target test case meets the requirements of the target number of use cases and the use case ratio of core parameters, the combined use case is output as the target test case, and the preferred use case is used to construct a supplementary use case set, and the supplementary use case set is added to the knowledge base.
5. A test case construction system based on a knowledge base, characterized in that: The system comprises: A module for acquiring a set of items to be tested, wherein the module is used to acquire a set of items to be tested of the software; A matching module, the matching module is used to match the test input data attributes and output data attributes according to the set of items to be tested; An initial test case set matching module, the initial test case set matching module is used to match the initial test case set based on the test input data attributes and output data attributes through a knowledge base; An evaluation value determination module, the evaluation value determination module is used to perform typical value, boundary value, and frequency analysis and evaluation on the initial test case set to determine the evaluation value of each initial test case; A use case ratio acquisition module, the use case ratio acquisition module is used to obtain the target number of use cases and the use case ratio of core parameters of the set of items to be tested; A target test case acquisition module, wherein the target test case acquisition module is used to screen the target test cases according to the target number of the test cases, the use case proportion of the core parameters, and the evaluation value to obtain the target test cases; The step of obtaining a set of software items to be tested includes: Obtain target demand information for the software; Analyze modules or functional points according to the target demand information; The modules or functional points obtained by analysis are used as the set of items to be tested; The typical value, boundary value and frequency analysis and evaluation of the initial test case set are performed to determine the evaluation value of each initial test case, including: According to each input field in the initial test case set, a valid value range and an invalid value range are defined, wherein the valid value range is an input value within the allowed range, and the invalid value range is an input value outside the allowed range; Performing mean calculation according to the valid value range of the initial test case set, and obtaining a typical value based on the mean calculation of the valid value range; Calculate the boundary value according to the valid value range and the invalid value range to obtain the boundary value; Reliability evaluation of the initial test case is performed using the typical value and the boundary value to obtain a first evaluation value; Obtaining the usage frequency of the initial test case, performing reliability evaluation based on the frequency, and obtaining a second evaluation value; Performing a fusion calculation using the first evaluation value and the second evaluation value to obtain an evaluation value of the initial test case; The target number of use cases and the proportion of use cases of core parameters of the set of items to be tested are obtained, including: Perform an impact analysis based on the performance parameters of the module or function point and the target demand information to determine the impact coefficient of the module or function point; According to the influence coefficient, the core parameters are selected, wherein the core parameters are one or more parameters with the largest influence coefficient; Based on the parameter characteristics of the input values of the core parameters, a use case uniformity requirement is obtained, and based on the use case uniformity requirement, a use case ratio of the core parameters is obtained; Obtaining a total proportion according to the influence coefficient distribution and the use case uniformity requirement; The quantity is configured according to the total proportion and target demand information to obtain the target quantity of the use case.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Software test case system and method, computer readable medium and electronic equipment
CN109582578A
Test case set generation method, device and equipment and computer readable storage medium
CN111708703A