Test case quality evaluation method and device, computer equipment and storage medium
By calculating the Shannon information volume of test requirements and test case groups and building the requirements use case relationship function, the inaccuracy and non-universal problems of test case quality evaluation in the existing technology are solved, and the rapid and overall test case quality evaluation is achieved, and the efficiency of product function development is improved.
Patent Information
- Application Number
- CN202510168600.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-06
Smart Images

Figure CN120104483A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a test case quality evaluation method, device, computer equipment and storage medium. Background Art
[0002] During the development of application systems or functional modules, testers need to write test cases based on test requirements to test the systems or modules. The quality of test cases directly affects the accuracy of test results and test efficiency. Therefore, after writing test cases and before testing, it is an extremely important step in the testing process to evaluate the quality of test cases to determine whether the test cases meet the test requirements.
[0003] At present, the quality evaluation methods of test cases mainly include the following two categories. The first category is the traditional manual quality evaluation method, that is, based on manual experience, a comprehensive evaluation is conducted from various aspects such as the number of test cases, effectiveness, missed tests, test case efficiency, code coverage, and functional coverage. This evaluation method relies on manual experience, and the evaluation accuracy is insufficient and the efficiency is low. The second category is the machine learning evaluation method. The existing technology provides a test case quality evaluation method based on machine learning. It uses a classification model based on a logistic regression algorithm to process the target dimension to obtain the quality evaluation result of the test case. However, this evaluation method only involves the evaluation of the proprietary test dimension direction and cannot obtain the comprehensive evaluation result of the test case. Secondly, for the method using machine learning, the test dimension evaluation experience requires a large amount of data support, which is the key data that is not disclosed in each company. However, this method relies on the knowledge learning of different project types and different dimensions, and the demand for this knowledge data is huge. But in fact, for test cases, the number of samples is not enough to support the learning of use cases. Even if there are 100,000 use cases, it is almost impossible to cover a product and project. It is even more impossible to obtain the public data of hundreds of projects and use cases at a low cost, so the achievable value is low; finally, different projects and products have different styles, and the correlation of test dimensions in different projects may be very low or even non-existent. For example, mobile app software has a very low correlation with a carrier-level underlying system software in terms of test dimensions, and only a few major dimensions such as performance, stability, and function have a rough correlation, so the quality evaluation method of this test case is not universal.
[0004] Therefore, how to achieve overall and general evaluation of test case quality has become a technical problem that needs to be urgently solved in this field. Summary of the invention
[0005] The purpose of the present invention is to provide a test case quality evaluation method, device, computer equipment and storage medium to solve the above-mentioned technical problems in the prior art.
[0006] On the one hand, to achieve the above objectives, the present invention provides a test case quality evaluation method.
[0007] The test case quality evaluation method includes: receiving a target test requirement and a target test case group, wherein the target test case group includes a plurality of target test cases; calculating the Shannon information of the target test requirement and the target test case group respectively, and obtaining a first information amount and a second information amount in sequence; obtaining a requirement-use case relationship function, wherein the requirement-use case relationship function is a relationship function constructed according to the Shannon information amount of the test requirement and the Shannon information amount of the test case group; substituting the first information amount into the requirement-use case relationship function to obtain an expected information amount; and determining a quality evaluation result of the target test case group according to a deviation between the expected information amount and the second information amount.
[0008] Furthermore, the steps of respectively calculating the Shannon information amount of the target test requirement and the target test case group include: extracting feature information of the target test requirement to obtain a number of target requirement features, extracting feature information of the target test case to obtain a number of target use case features; determining the occurrence probability of the target requirement feature in a preset requirement feature set, and determining the occurrence probability of the target use case feature in a preset use case feature set; calculating the Shannon information amount of the target test requirement according to the occurrence probability of each target requirement feature in the target test requirement in the requirement feature set; and calculating the Shannon information amount of the target test case according to the occurrence probability of each target use case feature in the target test case in the use case feature set, and calculating the Shannon information amount of the target test case group according to the Shannon information amount of each target test case in the target test case group.
[0009] Furthermore, the Shannon information of the target test requirement and the Shannon information of the target test case group are calculated using the following formula: R
[0010] ,
[0011] Wherein, R is the Shannon information required by the target test, a is a preset constant, is the occurrence probability corresponding to the i-th target requirement feature, n is the number of target requirement features, C is the Shannon information of the target test case group, is the Shannon information of the kth target test case in the target test case group, l is the number of target test cases in the target test case group, b is a preset constant, is the occurrence probability corresponding to the jth target case feature in the kth target test case, and m is the number of the target case features in the kth target test case.
[0012] Further, the characteristic information of the target test requirement includes keywords of the target test requirement, and the characteristic information of the target test case includes keywords of the target test case; the steps of extracting the characteristic information of the target test requirement to obtain a number of target requirement characteristics, and extracting the characteristic information of the target test case to obtain a number of target use case characteristics include: extracting keywords of the target test requirement to obtain a number of target requirement words, and extracting keywords of the target test case to obtain a number of target use case words; determining the probability of occurrence of the target requirement characteristics in a preset requirement characteristic set, and determining the probability of occurrence of the target use case characteristics in a preset use case characteristic set include: obtaining a test requirement vocabulary and a test case vocabulary, wherein the test requirement vocabulary includes requirement words and the probability of occurrence of the requirement words in a preset test requirement vocabulary library, and the test case vocabulary includes use case words and the probability of occurrence of the use case words in a preset test case vocabulary library; querying the corresponding occurrence probability of the target requirement words in the test requirement vocabulary, and querying the corresponding occurrence probability of the target use case words in the test case vocabulary.
[0013] Further, when the occurrence probability corresponding to the target requirement vocabulary cannot be found in the test requirement vocabulary, the step of determining the occurrence probability of the target requirement feature in the preset requirement feature set also includes: obtaining synonyms of the target requirement vocabulary, and querying the occurrence probability corresponding to the synonyms of the target requirement vocabulary in the test requirement vocabulary as the occurrence probability corresponding to the target requirement vocabulary; or querying the minimum value of the occurrence probability in the test requirement vocabulary as the occurrence probability corresponding to the target requirement vocabulary; when the occurrence probability corresponding to the target use case vocabulary cannot be found in the test case vocabulary, the step of determining the occurrence probability of the target use case feature in the preset use case feature set also includes: obtaining synonyms of the target use case vocabulary, and querying the occurrence probability corresponding to the synonyms of the target use case vocabulary in the test case vocabulary as the occurrence probability corresponding to the target use case vocabulary; or querying the minimum value of the occurrence probability in the test case vocabulary as the occurrence probability corresponding to the target use case vocabulary.
[0014] Furthermore, the following steps are adopted to construct the requirement feature set and the use case feature set: obtain multiple historical test requirements and multiple historical test cases; extract feature information of each of the historical test requirements to form the requirement feature set, and extract feature information of each of the historical test cases to form the use case feature set.
[0015] Furthermore, the following steps are adopted to construct the requirement-use case relationship function: obtain historical test requirements and historical test case groups, wherein the historical test case group includes multiple historical test cases; calculate the Shannon information of the historical test requirements and the historical test case group respectively, and obtain the first historical information amount and the second historical information amount in turn; use multiple groups of the first historical information amount and the second historical information amount to perform function fitting to obtain the requirement-use case relationship function.
[0016] Furthermore, the step of performing function fitting using multiple groups of the first historical information and the second historical information to obtain the demand use case relationship function includes: constructing the first historical information and the second amount of historical information The mapping function between: ,in, , , , , , and are fitting coefficients respectively; the mapping function is fitted by the least square method using the multiple groups of the first historical information and the second historical information to determine each of the fitting coefficients to obtain the demand use case relationship function.
[0017] Furthermore, the step of determining the quality evaluation result of the target test case group based on the deviation between the expected amount of information and the second amount of information includes: when the deviation is less than or equal to a preset threshold, the target test case group meets the target test requirement; when the expected amount of information is greater than the second amount of information, and the deviation is greater than the preset threshold, the number of the target test case group does not meet the target test requirement, or the target test requirement includes invalid information; when the expected amount of information is less than the second amount of information, and the deviation is greater than the preset threshold, the target test case group meets the target test requirement, or the target test requirement description is unclear, or the target test case group includes repeated target test cases.
[0018] On the other hand, to achieve the above-mentioned purpose, the present invention provides a test case quality evaluation device.
[0019] The test case quality evaluation device comprises: a receiving module, which is used to receive a target test requirement and a target test case group, wherein the target test case group comprises a plurality of target test cases; a calculating module, which is used to calculate the Shannon information of the target test requirement and the target test case group respectively, and obtain a first information amount and a second information amount in sequence; an acquiring module, which is used to obtain a requirement-use case relationship function, wherein the requirement-use case relationship function is a relationship function constructed according to the Shannon information amount of the test requirement and the Shannon information amount of the test case group; a processing module, which is used to substitute the first information amount into the requirement-use case relationship function, and obtain an expected information amount; and a determining module, which is used to determine a quality evaluation result of the target test case group according to a deviation between the expected information amount and the second information amount.
[0020] On the other hand, to achieve the above objectives, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0021] On the other hand, to achieve the above object, the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0022] The test case quality evaluation method, device, computer equipment and storage medium provided by the present invention, when evaluating the quality of the target test requirement and the target test case group for the target test requirement, first calculate the Shannon information of the target test requirement and the target test case group respectively, and obtain the first information amount and the second information amount in sequence, and then obtain the preset demand case relationship function, which is a relationship function constructed according to the Shannon information amount of the test requirement and the Shannon information amount of the test case group for the test requirement, substitute the first information amount into the demand case relationship function, obtain the expected information amount, and finally determine the quality evaluation result of the target test case group according to the deviation between the expected information amount and the second information amount. The test case quality evaluation method provided by this embodiment provides a quality rating method of a general test case based on information amount, which is used to evaluate the degree of compliance between the test case group and the test requirement, and can quickly evaluate the degree to which the test case group meets the test requirement from an overall perspective, and give the evaluation result before the test case is executed, without relying on the actual test execution result of the test case, timely adjust the test case group and the test requirement, so that the test case group adapts to the test requirement and improves the efficiency of the overall product function development. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings: Figure 1 A flow chart of a test case quality evaluation method provided in Embodiment 1 of the present invention; Figure 2 A flowchart of a test case quality evaluation method provided in Embodiment 2 of the present invention; Figure 3 A block diagram of a test case quality evaluation device provided in Embodiment 3 of the present invention; Figure 4 This is a hardware structure diagram of a computer device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0025] Embodiment 1 The embodiment of the present invention provides a test case quality evaluation method, through which the quality of the test case is evaluated based on the relationship between the Shannon information of the test requirement and the Shannon information of the test case. From the perspective of the amount of information contained in the test case, it is evaluated whether it meets the information requirement of the test requirement. The method is universal and is not restricted by the project or product type. At the same time, the method can be evaluated from the perspective of the test case as a whole, and is not limited to a single evaluation indicator. Specifically, Figure 1 The flowchart of the test case quality evaluation method provided in the first embodiment of the present invention is as follows: Figure 1 As shown, the test case quality evaluation method provided by this embodiment includes the following steps S101 to S105.
[0026] Step S101: receiving target test requirements and target test case groups.
[0027] The target test case group includes several target test cases, and the target test case group is a plurality of test cases set for target test requirements.
[0028] Typically, multiple test cases, also known as test case groups, are set for a certain test requirement. In this application, the test requirement to be evaluated is defined as a target test requirement, and the test case group set for the target test requirement is defined as a target test case group.
[0029] Step S102: Calculate the Shannon information of the target test requirement and the target test case group respectively, and obtain the first information amount and the second information amount in sequence.
[0030] Specifically, the Shannon information of the target test requirement is calculated to obtain the first information, and the Shannon information of the target test case group is calculated to obtain the second information. Shannon information theory was proposed by Claude Shannon in the 1940s to quantify the transmission and storage of information. This application uses Shannon information to measure the information content included in the target test requirement and the target test case group.
[0031] Optionally, in one embodiment, when calculating the Shannon information amount of the target test requirement, the characteristic information of the target test requirement is first extracted to obtain a number of target requirement features, and then the probability of occurrence of the target requirement features in a preset requirement feature set is determined, and finally the Shannon information amount of the target test requirement is calculated based on the probability of occurrence of each target requirement feature in the target test requirement in the requirement feature set.
[0032] When calculating the Shannon information amount of the target test case group, the feature information of the target test case is first extracted to obtain a number of target test case features, and then the occurrence probability of the target test case features in the preset test case feature set is determined. The Shannon information amount of the target test case is calculated based on the occurrence probability of each target test case feature in the test case feature set, and finally the Shannon information amount of the target test case group is calculated based on the Shannon information amount of each target test case in the target test case group.
[0033] Further optionally, in one embodiment, both the target test requirement and the target test case are documents, and the characteristic information can be keywords in the document. A keyword library is set for the technical field where the test project is located. For example, the keyword library set for the network security technology field includes keywords such as network, equipment, firewall, traffic, and tester. The document of the target test requirement is segmented and matched with the keyword library. The matched keywords are the target requirement characteristics. The document of the target test case is segmented and matched with the keyword library. The matched keywords are the target case characteristics.
[0034] Alternatively, the target test requirement document may be segmented and the content words therein may be extracted as keywords to obtain the target requirement feature. The target test case document may be segmented and the content words therein may be extracted as keywords to obtain the target case feature.
[0035] Further optionally, in another embodiment, the target test requirement includes several types of sub-requirements, and the characteristic information may be the types of sub-requirements included in the target test requirement, for example, the types of sub-requirements include functional requirements, performance requirements, security requirements, etc., or the types of sub-requirements include login function, registration function, search function, shopping cart function, etc., identify the types of sub-requirements included in the target test requirement, and obtain the target requirement characteristics. For example, a target test requirement includes 3 performance requirements, which is the target requirement characteristics. The target test case includes several types of test steps, and the characteristic information may be the types of test steps included in the target test case, for example, the types of test steps include inputting valid data, inputting invalid data, checking output, capturing errors, etc., identify the types of test steps included in the target test case, and obtain the target case characteristics. For example, a target test case includes 1 input valid step and 1 check output step, which is the target case characteristics.
[0036] Alternatively, other characteristic information setting methods may be used, and this application will not give examples one by one.
[0037] After obtaining the target demand feature, determine the probability of occurrence of the target demand feature in the preset demand feature set; after obtaining the target use case feature, determine the probability of occurrence of the target use case feature in the preset use case feature set. Optionally, in one embodiment, when constructing the demand feature set, multiple historical test requirements are obtained, and then feature information of each historical test requirement is extracted to form a demand feature set. The more times a feature information appears in the historical test requirements, the higher its probability of occurrence in the demand feature set; when constructing the use case feature set, multiple historical test cases are obtained, and then feature information of each historical test case is extracted to form a use case feature set. The more times a feature information appears in the historical test cases, the higher its probability of occurrence in the use case feature set.
[0038] After determining the occurrence probability of each target requirement feature in the requirement feature set, the Shannon information of the target test requirement is calculated according to the occurrence probability; after determining the occurrence probability of each target use case feature in the use case feature set, the Shannon information of the target test case is calculated according to the occurrence probability, and then the Shannon information of the target test case group is calculated. Optionally, in one embodiment, the Shannon information of the target test requirement and the Shannon information of the target test case group are calculated using the following formula: R
[0039] ,
[0040] Where R is the Shannon information required by the target test, that is, the first information amount, and a is a preset constant, for example, a=2. is the occurrence probability corresponding to the i-th target requirement feature, n is the number of target requirement features, C is the Shannon information of the target test case group, that is, the second information amount, is the Shannon information of the kth target test case in the target test case group, l is the number of target test cases in the target test case group, and b is a preset constant, for example, b=2. is the occurrence probability corresponding to the jth target case feature in the kth target test case, and m is the number of target case features in the kth target test case.
[0041] Step S103: Obtain the requirement use case relationship function.
[0042] The requirement-use case relationship function is a relationship function constructed based on the Shannon information of the test requirement and the Shannon information of the test case group for the test requirement.
[0043] Specifically, the requirement-use case relationship function represents the relationship between the Shannon information of the test requirement and the Shannon information of the test case group. Assuming the Shannon information of the test requirement is C and the Shannon information of the test case group is R, the requirement-use case relationship function can be represented as C=Pn(R).
[0044] A requirement-use case relationship function is preset, and when evaluating the quality of the test case, the requirement-use case relationship function is obtained. Optionally, different requirement-use case relationship functions are preset for different types of projects or products, and the corresponding requirement-use case relationship function is obtained based on the project or product to which the test case to be evaluated belongs.
[0045] Optionally, in one embodiment, when constructing the requirement-use case relationship function, the requirement-use case relationship function is constructed based on different historical testing requirements and historical test case groups for each historical testing requirement. For example, the requirement-use case relationship function of instant messaging projects is constructed based on the historical testing requirements and historical test case groups of instant messaging apps; and the requirement-use case relationship function of instant shopping projects is constructed based on the historical testing requirements and historical test case groups of shopping apps.
[0046] Further optionally, in one embodiment, the following steps are used to construct a requirement-use case relationship function: obtain historical test requirements and a historical test case group for the historical test requirements, wherein the historical test case group includes multiple historical test cases; calculate the Shannon information of the historical test requirements and the historical test case group respectively, and obtain the first historical information amount and the second historical information amount in turn; use multiple groups of the first historical information amount and the second historical information amount to perform function fitting to obtain the requirement-use case relationship function.
[0047] Specifically, when calculating the Shannon information of historical test requirements, the specific steps of calculating the Shannon information of target test requirements can be used, which will not be repeated here. When calculating the Shannon information of historical test case groups, the specific steps of calculating the Shannon information of target test case groups can be used, which will not be repeated here. Through multiple historical test requirements and their historical test case groups, multiple groups of first historical information and second historical information are obtained, and function fitting is performed on them to obtain the demand-case relationship function. Among them, the second historical information C' is taken as the value, and the first historical information R As a variable, the function is fitted using the least squares method, feature normalization method or gradient descent method.
[0048] Further optionally, in one embodiment, the step of using multiple sets of first historical information and second historical information to perform function fitting to obtain the demand use case relationship function includes: constructing the first historical information and the second historical information The mapping function between: ,in, , , , , , and are fitting coefficients respectively; the least squares method is used to fit the mapping function using multiple sets of first historical information and second historical information to determine each fitting coefficient to obtain the demand use case relationship function. By recommending the use of a sixth-order polynomial curve fitting method and performing quadratic fitting, the demand use case relationship function can take into account both accuracy and computational complexity.
[0049] Step S104: Substitute the first amount of information into the requirement use case relationship function to obtain the expected amount of information.
[0050] Step S105: Determine the quality evaluation result of the target test case group according to the deviation between the expected information amount and the second information amount.
[0051] Specifically, when the deviation between the expected amount of information and the second amount of information is small, that is, the second amount of information is close to the expected amount of information, it is characterized that the target test case group meets the target test requirements. When the deviation between the expected amount of information and the second amount of information is large, it is necessary to further adjust the target test case group and / or target test requirements.
[0052] Optionally, in one embodiment, the step of determining the quality evaluation result of the target test case group based on the deviation between the expected amount of information and the second amount of information includes: when the deviation is less than or equal to a preset threshold, the target test case group meets the target test requirement; when the expected amount of information is greater than the second amount of information, and the deviation is greater than the preset threshold, the number of the target test case group does not meet the target test requirement, or the target test requirement includes invalid information, and further adjustment of the target test case group and / or the target test requirement is required; when the expected amount of information is less than the second amount of information, and the deviation is greater than the preset threshold, the target test case group meets the target test requirement, or the target test requirement description is unclear, or the target test case group includes repeated target test cases, and further adjustment of the target test case group and / or the target test requirement is required. Among them, the preset threshold can be an empirical value, for example, the preset threshold is set to an allowable missed detection rate of 5% In the test case quality evaluation method provided in this embodiment, when the target test requirement and the target test case group for the target test requirement are evaluated, the Shannon information of the target test requirement and the target test case group are calculated respectively, and the first information amount and the second information amount are obtained in sequence, and then the preset demand case relationship function is obtained, and the demand case relationship function is a relationship function constructed according to the Shannon information amount of the test requirement and the Shannon information amount of the test case group for the test requirement, and the first information amount is substituted into the demand case relationship function to obtain the expected information amount, and finally the quality evaluation result of the target test case group is determined according to the deviation between the expected information amount and the second information amount. The test case quality evaluation method provided by this embodiment provides a quality rating method for general test cases based on information amount, which is used to evaluate the degree of compliance between the test case group and the test requirement, and can quickly evaluate the degree to which the test case group meets the test requirement from an overall perspective, and give the evaluation result before the test case is executed, without relying on the actual test execution result of the test case, and timely adjust the test case group and the test requirement, so that the test case group adapts to the test requirement and improves the efficiency of the overall product function development.
[0053] Optionally, in one embodiment, the characteristic information of the target test requirement includes keywords of the target test requirement, and the characteristic information of the target test case includes keywords of the target test case. The step of extracting the characteristic information of the target test requirement and obtaining a number of target requirement characteristics includes: extracting keywords of the target test requirement and obtaining a number of target requirement words; the step of extracting the characteristic information of the target test case and obtaining a number of target use case characteristics includes: extracting keywords of the target test case and obtaining a number of target use case words.
[0054] The steps of determining the occurrence probability of a target requirement feature in a preset requirement feature set and determining the occurrence probability of a target use case feature in a preset use case feature set include: obtaining a test requirement vocabulary and a test case vocabulary, wherein the test requirement vocabulary includes requirement vocabulary and the occurrence probability of requirement vocabulary in a preset test requirement vocabulary library, and the test case vocabulary includes use case vocabulary and the occurrence probability of use case vocabulary in a preset test case vocabulary library; querying the corresponding occurrence probability of the target requirement vocabulary in the test requirement vocabulary, and querying the corresponding occurrence probability of the target use case vocabulary in the test case vocabulary.
[0055] Specifically, in this embodiment, keywords are used as feature information, keywords of target test requirements, namely target requirement vocabulary, are used as target requirement features; keywords of target test cases, namely target use case vocabulary, are used as target use case features.
[0056] A test requirement vocabulary library is formed using keywords of historical test requirements. Optionally, multiple historical test requirements are obtained, and keywords of each historical test requirement are extracted as a requirement vocabulary. All requirement vocabulary form a test requirement vocabulary library, and a test requirement vocabulary table is formed through the test requirement vocabulary library, wherein the test requirement vocabulary table includes multiple requirement vocabulary records, each requirement vocabulary record includes a requirement vocabulary and the probability of occurrence of the requirement vocabulary in the test requirement vocabulary library, that is, the ratio of the number of occurrences of the requirement vocabulary in the test requirement vocabulary library to the total number of requirement vocabulary in the test requirement vocabulary library.
[0057] A test case vocabulary library is formed using keywords of historical test cases. Optionally, multiple historical test cases are obtained, keywords of each historical test case are extracted as a use case vocabulary, all use case vocabularies form a test case vocabulary library, and a test case vocabulary table is formed through the test case vocabulary library, wherein the test case vocabulary table includes multiple use case vocabulary records, each use case vocabulary record includes a use case vocabulary and the probability of occurrence of the use case vocabulary in the test case vocabulary library, that is, the ratio of the number of occurrences of the use case vocabulary in the test case vocabulary library to the total number of use case vocabulary in the test case vocabulary library.
[0058] When determining the probability of occurrence of the target requirement feature in the preset requirement feature set, first obtain the above-mentioned test requirement vocabulary, and query the corresponding probability of occurrence of the target requirement vocabulary in the test requirement vocabulary, that is, the probability of occurrence of the target requirement feature in the preset requirement feature set. When determining the probability of occurrence of the target use case feature in the preset use case feature set, first obtain the above-mentioned test case vocabulary, and query the corresponding probability of occurrence of the target use case vocabulary in the test case vocabulary, that is, the probability of occurrence of the target use case feature in the preset use case feature set.
[0059] When calculating the Shannon information of the target test requirement based on the occurrence probability corresponding to the above target requirement vocabulary, and calculating the Shannon information of the target test case group based on the occurrence probability corresponding to the above target case vocabulary: R
[0060] ,
[0061] Where R is the Shannon information required by the target test, and a is a preset constant, for example, a=2. is the probability of occurrence corresponding to the i-th target requirement word, n is the number of target requirement words, C is the Shannon information of the target test case group, that is, the second information amount, is the Shannon information of the kth target test case in the target test case group, l is the number of target test cases in the target test case group, and b is a preset constant, for example, b=2. is the occurrence probability of the jth target case vocabulary in the kth target test case, and m is the number of target case vocabulary in the kth target test case.
[0062] When calculating the Shannon information of historical test requirements and the Shannon information of historical test case groups, extract the keywords of historical test requirements to obtain a number of historical requirement words; extract the keywords of historical test cases to obtain a number of historical case words; query the occurrence probability corresponding to the historical requirement words in the above test requirement vocabulary table, and query the occurrence probability corresponding to the historical case words in the above test case vocabulary table; respectively use the following formulas to calculate the Shannon information of historical test requirements and the Shannon information of historical test case groups: ' , ' in, is the Shannon information required by the historical test, a is a preset constant, ' is the occurrence probability corresponding to the i-th historical demand word, n' is the number of historical demand words, C is the Shannon information of the historical test case group, is the Shannon information of the kth historical test case in the historical test case group, l' is the number of historical test cases in the historical test case group, b is a preset constant, ' is the occurrence probability of the jth historical case vocabulary in the kth historical test case, and m' is the number of historical case vocabulary in the kth historical test case.
[0063] In the test case quality evaluation method provided in this embodiment, keywords are used as feature information, and a test requirement vocabulary library is constructed using keywords of historical test requirements. The occurrence probability of each requirement vocabulary is calculated by counting the number of occurrences of each requirement vocabulary and the total number of requirement vocabulary in the test requirement vocabulary library to form a test requirement vocabulary table, and a test case vocabulary table is formed based on the same steps using historical test cases. When calculating the Shannon information amount of the target (or historical) test requirement, the keywords of the target (or historical) test requirement are extracted to obtain the target (or historical) test requirement vocabulary, and then the occurrence probability is obtained by querying the test requirement vocabulary table for calculation; when calculating the Shannon information amount of the target (or historical) test case group, the keywords of the target (or historical) test case are extracted to obtain the target (or historical) test case vocabulary, and then the occurrence probability is obtained by querying the test case vocabulary table for calculation.
[0064] Optionally, in one embodiment, when the occurrence probability corresponding to the target requirement vocabulary cannot be found in the test requirement vocabulary table, the step of determining the occurrence probability of the target requirement feature in the preset requirement feature set also includes: obtaining synonyms of the target requirement vocabulary, and querying the occurrence probability corresponding to the synonyms of the target requirement vocabulary in the test requirement vocabulary table as the occurrence probability corresponding to the target requirement vocabulary; or querying the minimum value of the occurrence probability in the test requirement vocabulary table as the occurrence probability corresponding to the target requirement vocabulary.
[0065] When the occurrence probability corresponding to the target use case vocabulary cannot be found in the test case vocabulary, the step of determining the occurrence probability of the target use case feature in the preset use case feature set also includes: obtaining synonyms of the target use case vocabulary, and querying the occurrence probability corresponding to the synonyms of the target use case vocabulary in the test case vocabulary as the occurrence probability corresponding to the target use case vocabulary; or querying the minimum value of the occurrence probability in the test case vocabulary as the occurrence probability corresponding to the target use case vocabulary.
[0066] Specifically, when a target requirement word that is not in the test requirement vocabulary table appears in the target test requirement, the probability of occurrence of the target requirement word cannot be obtained by querying the test requirement vocabulary table. At this time, the synonym matching method can be used to compare the words in the dictionary, find the word with the highest similarity to the target requirement word in the dictionary as the synonym of the target requirement word, query the synonym in the test requirement vocabulary table, and use the corresponding probability of occurrence of this synonym as the probability of occurrence of the target requirement word, for example, use the WordSimilarirty library to find the synonym of the target requirement word. Alternatively, the minimum probability replacement method can be used, that is, the minimum probability of occurrence in the test case vocabulary is used as the corresponding probability of occurrence of the target case vocabulary.
[0067] Accordingly, when a target test case vocabulary that is not in the test case vocabulary appears in the target test case, the probability of occurrence of the target test case vocabulary cannot be obtained by querying the test case vocabulary. At this time, the synonym matching method can be used to compare the vocabulary in the dictionary, find the vocabulary with the highest similarity to the target test case vocabulary in the dictionary as the synonym of the target test case vocabulary, query the synonym in the test case vocabulary, and use the corresponding probability of occurrence of the synonym as the probability of occurrence of the target test case vocabulary, for example, use the WordSimilarirty library to find the synonym of the target test case vocabulary. Alternatively, the minimum probability replacement method can be used, that is, the minimum probability of occurrence in the test case vocabulary is used as the corresponding probability of occurrence of the target test case vocabulary.
[0068] Further optionally, when a target requirement vocabulary that is not in the test requirement vocabulary list appears in the target test requirement, or a target use case vocabulary that is not in the test case vocabulary list appears in the target test case, the target test requirement and target use case vocabulary are used to update the test requirement vocabulary library and the test case vocabulary library, that is, the fitting requirement-use case relationship function is recalculated.
[0069] Embodiment 2 Figure 2 The flowchart of the test case quality evaluation method provided in the second embodiment of the present invention is as follows: Figure 2 As shown, in this embodiment, the test case quality evaluation method mainly includes 8 steps: vocabulary collection, calculation of historical test case group information volume, calculation of historical test requirement information volume, function fitting of historical test case group information volume and historical test requirement information volume, calculation of target test case information volume, calculation of target test requirement information volume, deviation analysis and system optimization.
[0070] By quantifying the amount of information of historical test cases and historical test requirements, and performing least square fitting mapping on the relationship between the amount of information of historical test case groups and the amount of information of historical test requirements, a requirement-case relationship function is obtained. When evaluating the quality of test cases, the amount of information of target test case groups and target test requirements is quantified, and the amount of information of the target test case group is substituted into the above function to obtain the expected amount of information. The deviation of the expected amount of information relative to the amount of information of the target test requirement is used to evaluate the conformity of the target test case with respect to the requirement.
[0071] Specifically, each step is described in detail as follows.
[0072] 1. Vocabulary Collection Each industry has its own commonly used vocabulary information. Taking network product testing as an example, commonly used vocabulary includes: network, traffic, time, configuration, observation, system, interface, Ethernet, routing, static, dynamic, mac, arp, address, ipv4, ipv6, etc. These types of words are used as keywords.
[0073] This type of vocabulary is extracted from the documents of historical test cases and historical test requirements respectively, to form a test case vocabulary library and a test requirement vocabulary library in turn.
[0074] After the vocabulary database is built, the number of occurrences of each word in the vocabulary database and the total number of vocabulary databases are counted, and the probability of occurrence of each word is calculated to form a vocabulary table, specifically a test case vocabulary table and a test requirement vocabulary table. The following table shows a test case vocabulary table with a total vocabulary of 5 million:
[0075] 2. Calculation of information volume of historical test case groups According to Shannon's information theory, the relationship between information volume and event probability is a monotonically decreasing function. This application defines the information volume of a test case as the accumulation of the information volume of all keywords in the test case.
[0076] The probability of an occurrence is Vocabulary Amount of information The calculation is done using the following formula:
[0077] The amount of information in a test case :
[0078] For example: Test case 1: Use a tester to run traffic on the device and observe for a long time. The device does not freeze. Test case 2: Using BPS, the bridge interface hits 21KB of HTTP traffic. After 24 hours, there is no memory leak. Extract the keywords of test case 1, and the obtained use case vocabulary includes: use, tester, for, equipment, hit, flow, long time, observe, no, crash Query each use case vocabulary in the test case vocabulary table to obtain the corresponding occurrence probability of each use case vocabulary, and then use the above formula to calculate that the information content of test case 1 is approximately: 126.8.
[0079]
[0080] Extract the keywords of test case 2, and the obtained test case vocabulary includes: use, bridge interface, hit, 21KB, HTTP, traffic, 24, hours, none, memory leak Look up each use case word in the test case vocabulary table to obtain the corresponding occurrence probability of each use case word, and then use the above formula to calculate that the information content of test case 1 is approximately: 144.3.
[0081]
[0082] After adding up the information of n test cases, we can get the information C of the test case group:
[0083] 3. Calculation of historical test demand information Test requirements include customer requirements, product requirements or functional requirements. In the testing industry, test requirements are used as test work input to write test cases. The calculation method of the test requirement information volume is exactly the same as the calculation method of a single test case. During the calculation process, the calculation is based on the test requirement vocabulary, which will not be repeated here.
[0084] 4. Function fitting of historical test case group information volume and historical test requirement information volume Through the above steps, the information volume I of each test case is calculated, and then the information volume C of the test case group is obtained, and the test requirement information volume R is obtained. For different test requirements, the corresponding relationship between the information volume of the test requirement and the information volume of the test case group can be obtained as follows:
[0085] Then, the information volume of the test case group (C) is used as the value and the information volume of the corresponding test requirement (R) is used as the variable. A function is fitted according to the least squares method. Preferably, a curve fitting method of a sixth-order polynomial is used to obtain a mapping function from the information volume of the test case group to the information volume of the test requirement. Assume that the mapping function between R and C is as follows.
[0086]
[0087] By inputting the data in the above table, we can finally get the values of all the above coefficients a through least squares fitting, that is, the demand use case relationship function: Pn(R) 5. Calculation of target test case group information volume and target test requirement information volume In the development of new product functions, a new test case group will be designed based on the new test requirements for the new functions. For the new test requirements and the new test case group, the information volume of the test requirements and the information volume of the test case group will be calculated according to the method described above.
[0088] In the calculation process, when a new test requirement or test case contains a keyword that appears for the first time, that is, it does not appear in the vocabulary, any of the following methods can be used to handle it: A: Semantic Similarity Method Use the synonym matching method to compare the words in the dictionary, find the word with the highest similarity, and calculate the probability of occurrence of the word with the highest similarity. For example, use the WordSimilarity library to determine similar words.
[0089] B: Take the lowest probability value The value with the lowest probability of occurrence in the vocabulary is taken as the probability of occurrence of this unqueried vocabulary and used for information calculation.
[0090] 6. Deviation analysis Assume that the information volume of a target test case group calculated through the above steps is C, and the corresponding target test requirement information volume is R. Substitute the target test requirement information volume R into the use case requirement relationship function to obtain the expected information volume : Pn(R).
[0091] For C and Analyze various situations: (one) : This indicates that the test case group settings meet the test requirements, that is, they meet expectations. (two) : This indicates that the test case group contains a lot of information, which may be in line with expectations. Alternatively, it may be that the test requirement description is not clear, or there is some duplication in the test case group.
[0092] (three) : This indicates that the amount of information in the test case group is less than expected. This may be because the test requirements are not refined and there is a lot of invalid information, or there may be a lack of test cases in the test case group.
[0093] Among them, in judging When a threshold is set a priori, for example, the product's missed detection rate of 5% over the years is used as the deviation value. Within this deviation value, it is determined ; Or substitute the least squares variance for verification to see whether the minimum variance becomes larger. If it becomes larger, it exceeds the threshold.
[0094] 7. System optimization When the target test case group and target test requirement are developed and archived, the target test case group and target test requirement are used to summarize the vocabulary and update it as a whole, including updating the test case vocabulary, test requirement vocabulary, and refitting the requirement-case relationship function.
[0095] This embodiment provides a general test case quality rating method based on information volume, which is used to evaluate the degree of compliance between test cases and test requirement documents. It can quickly give an "ex ante" evaluation from an overall perspective, and evaluate the satisfaction of the use case from an overall perspective. It does not depend on the actual test execution results of the use case, embodies the idea of "problems must be discovered at the front end", and improves the efficiency of overall product function development.
[0096] Embodiment 3 Corresponding to the above-mentioned embodiment 1, embodiment 3 of the present invention provides a test case quality evaluation device. The corresponding technical feature details and corresponding technical effects can be referred to the above-mentioned embodiment 1, and will not be repeated in this embodiment. Figure 3 A block diagram of a test case quality evaluation device provided in Embodiment 3 of the present invention, such as Figure 3 As shown, the device includes: a receiving module 301, a calculating module 302, an acquiring module 303, a processing module 304 and a determining module 305.
[0097] Among them, a receiving module 301 is used to receive a target test requirement and a target test case group, wherein the target test case group includes a number of target test cases; a calculating module 302 is used to calculate the Shannon information of the target test requirement and the target test case group respectively, and obtain a first information amount and a second information amount in turn; an acquiring module 303 is used to obtain a requirement-use case relationship function, wherein the requirement-use case relationship function is a relationship function constructed according to the Shannon information amount of the test requirement and the Shannon information amount of the test case group; a processing module 304 is used to substitute the first information amount into the requirement-use case relationship function to obtain an expected information amount; and a determining module 305 is used to determine a quality evaluation result of the target test case group according to a deviation between the expected information amount and the second information amount.
[0098] Optionally, in one embodiment, the calculation module includes: an extraction unit, used to extract characteristic information of the target test requirement to obtain a number of target requirement characteristics, and extract characteristic information of the target test case to obtain a number of target use case characteristics; a determination unit, used to determine the occurrence probability of the target requirement characteristic in a preset requirement characteristic set, and determine the occurrence probability of the target use case characteristic in a preset use case characteristic set; a calculation unit, used to calculate the Shannon information amount of the target test requirement according to the occurrence probability of each target requirement characteristic in the target test requirement in the requirement characteristic set, calculate the Shannon information amount of the target test case according to the occurrence probability of each target use case characteristic in the target test case in the use case characteristic set, and calculate the Shannon information amount of the target test case group according to the Shannon information amount of each target test case in the target test case group.
[0099] Optionally, in an embodiment, the Shannon information amount of the target test requirement and the Shannon information amount of the target test case group are calculated using the following formula: R
[0100] ,
[0101] Wherein, R is the Shannon information required by the target test, a is a preset constant, is the occurrence probability corresponding to the i-th target requirement feature, n is the number of target requirement features, C is the Shannon information of the target test case group, is the Shannon information of the kth target test case in the target test case group, l is the number of target test cases in the target test case group, b is a preset constant, is the occurrence probability corresponding to the jth target case feature in the kth target test case, and m is the number of the target case features in the kth target test case.
[0102] Optionally, in one embodiment, the characteristic information of the target test requirement includes keywords of the target test requirement, and the characteristic information of the target test case includes keywords of the target test case; the steps specifically performed by the extraction unit include: extracting the keywords of the target test requirement to obtain a number of target requirement vocabularies, extracting the keywords of the target test case to obtain a number of target use case vocabularies; the steps specifically performed by the determination unit include: obtaining a test requirement vocabulary and a test case vocabulary, wherein the test requirement vocabulary includes requirement vocabulary and the probability of occurrence of the requirement vocabulary in a preset test requirement vocabulary library, and the test case vocabulary includes use case vocabulary and the probability of occurrence of the use case vocabulary in a preset test case vocabulary library; querying the corresponding occurrence probability of the target requirement vocabulary in the test requirement vocabulary, and querying the corresponding occurrence probability of the target use case vocabulary in the test case vocabulary.
[0103] Optionally, in one embodiment, when the occurrence probability corresponding to the target requirement vocabulary cannot be found in the test requirement vocabulary table, the steps executed by the determination unit also include: obtaining synonyms of the target requirement vocabulary, and querying the occurrence probability corresponding to the synonyms of the target requirement vocabulary in the test requirement vocabulary table as the occurrence probability corresponding to the target requirement vocabulary; or querying the minimum value of the occurrence probability in the test requirement vocabulary table as the occurrence probability corresponding to the target requirement vocabulary; when the occurrence probability corresponding to the target use case vocabulary cannot be found in the test case vocabulary table, the steps specifically executed by the determination unit also include: obtaining synonyms of the target use case vocabulary, and querying the occurrence probability corresponding to the synonyms of the target use case vocabulary in the test case vocabulary table as the occurrence probability corresponding to the target use case vocabulary; or querying the minimum value of the occurrence probability in the test case vocabulary table as the occurrence probability corresponding to the target use case vocabulary.
[0104] Optionally, in one embodiment, the following steps are adopted to construct the requirement feature set and the use case feature set: obtain multiple historical test requirements and multiple historical test cases; extract feature information of each of the historical test requirements to form the requirement feature set, and extract feature information of each of the historical test cases to form the use case feature set.
[0105] Optionally, in one embodiment, the following steps are used to construct the requirement-use case relationship function: obtain historical test requirements and historical test case groups, wherein the historical test case group includes multiple historical test cases; calculate the Shannon information of the historical test requirements and the historical test case group respectively, and obtain a first historical information amount and a second historical information amount in turn; use multiple groups of the first historical information amount and the second historical information amount to perform function fitting to obtain the requirement-use case relationship function.
[0106] Optionally, in one embodiment, the step of using multiple groups of the first historical information and the second historical information to perform function fitting to obtain the demand use case relationship function includes: constructing the first historical information and the second amount of historical information The mapping function between: ,in, , , , , , and are fitting coefficients respectively; the mapping function is fitted by the least square method using the multiple groups of the first historical information and the second historical information to determine each of the fitting coefficients to obtain the demand use case relationship function.
[0107] Optionally, in one embodiment, the determination module includes: a first determination unit, used to determine that the target test case group meets the target test requirement when the deviation is less than or equal to a preset threshold; a second determination unit, used to determine that the number of the target test case group does not meet the target test requirement, or the target test requirement includes invalid information, when the expected amount of information is greater than the second amount of information and the deviation is greater than the preset threshold; a third determination unit, used to determine that the target test case group meets the target test requirement, or the target test requirement description is unclear, or the target test case group includes repeated target test cases, when the expected amount of information is less than the second amount of information and the deviation is greater than the preset threshold.
[0108] Embodiment 4 This embodiment also provides a computer device, such as a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that can execute programs. Figure 4 As shown, the computer device 01 of this embodiment includes at least but is not limited to: a memory 012 and a processor 011 which can be interconnected through a system bus. Figure 4 It should be pointed out that Figure 4 Only a computer device 01 having components memory 012 and processor 011 is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0109] In this embodiment, the memory 012 (i.e., a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 012 may be an internal storage unit of the computer device 01, such as a hard disk or a memory of the computer device 01. In other embodiments, the memory 012 may also be an external storage device of the computer device 01, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 01. Of course, the memory 012 may also include both the internal storage unit of the computer device 01 and its external storage device. In this embodiment, the memory 012 is generally used to store an operating system and various reference software installed on the computer device 01, such as the program code of the test case quality evaluation device of the second embodiment. In addition, the memory 012 can also be used to temporarily store various types of data that have been output or are to be output.
[0110] In some embodiments, the processor 011 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 011 is generally used to control the overall operation of the computer device 01. In this embodiment, the processor 011 is used to run the program code stored in the memory 012 or process data, such as a test case quality evaluation method.
[0111] Embodiment 5 This embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App reference mall, etc., on which a computer program is stored, and the program realizes the corresponding function when executed by the processor. The computer-readable storage medium of this embodiment is used to store a test case quality evaluation device, and when executed by the processor, the test case quality evaluation method of embodiment 1 is realized.
[0112] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0113] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0115] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A test case quality evaluation method, characterized in that: include: Receiving a target test requirement and a target test case group, wherein the target test case group includes a plurality of target test cases; Calculate the Shannon information of the target test requirement and the target test case group respectively, and obtain the first information amount and the second information amount in sequence; Obtaining a requirement-use case relationship function, wherein the requirement-use case relationship function is a relationship function constructed according to the Shannon information amount of the test requirement and the Shannon information amount of the test case group; Substituting the first amount of information into the requirement use case relationship function to obtain an expected amount of information; and The quality evaluation result of the target test case group is determined according to the deviation between the expected amount of information and the second amount of information.
2. The test case quality evaluation method according to claim 1, characterized in that: The steps of respectively calculating the Shannon information of the target test requirement and the target test case group include: Extracting characteristic information of the target test requirement to obtain a number of target requirement characteristics, extracting characteristic information of the target test case to obtain a number of target case characteristics; Determine the occurrence probability of the target demand feature in a preset demand feature set, and determine the occurrence probability of the target use case feature in a preset use case feature set; Calculating the Shannon information of the target test requirement according to the occurrence probability of each target requirement feature in the target test requirement in the requirement feature set; and The Shannon information amount of the target test case is calculated according to the occurrence probability of each target test case feature in the target test case in the test case feature set, and the Shannon information amount of the target test case group is calculated according to the Shannon information amount of each target test case in the target test case group.
3. The test case quality evaluation method according to claim 2, characterized in that: The Shannon information of the target test requirement and the Shannon information of the target test case group are calculated using the following formula: R , Wherein, R is the Shannon information required by the target test, a is a preset constant, is the occurrence probability corresponding to the i-th target requirement feature, n is the number of target requirement features, C is the Shannon information of the target test case group, is the Shannon information of the kth target test case in the target test case group, l is the number of target test cases in the target test case group, b is a preset constant, is the occurrence probability corresponding to the jth target case feature in the kth target test case, and m is the number of the target case features in the kth target test case.
4. The test case quality evaluation method according to claim 2, characterized in that: The characteristic information of the target test requirement includes keywords of the target test requirement, and the characteristic information of the target test case includes keywords of the target test case; The steps of extracting characteristic information of the target test requirement to obtain a plurality of target requirement characteristics, and extracting characteristic information of the target test case to obtain a plurality of target case characteristics include: extracting keywords of the target test requirement to obtain a plurality of target requirement words, extracting keywords of the target test case to obtain a plurality of target case words; The step of determining the occurrence probability of the target demand feature in the preset demand feature set and determining the occurrence probability of the target use case feature in the preset use case feature set includes: Acquire a test requirement vocabulary and a test case vocabulary, wherein the test requirement vocabulary includes requirement vocabulary and the occurrence probability of the requirement vocabulary in a preset test requirement vocabulary library, and the test case vocabulary includes use case vocabulary and the occurrence probability of the use case vocabulary in a preset test case vocabulary library; The occurrence probability corresponding to the target requirement vocabulary is queried in the test requirement vocabulary table, and the occurrence probability corresponding to the target use case vocabulary is queried in the test case vocabulary table.
5. The test case quality evaluation method according to claim 4, characterized in that: When the occurrence probability corresponding to the target requirement vocabulary cannot be found in the test requirement vocabulary table, the step of determining the occurrence probability of the target requirement feature in the preset requirement feature set further includes: Obtaining synonyms of the target demand vocabulary, and searching the test demand vocabulary table for the corresponding occurrence probabilities of the synonyms of the target demand vocabulary as the corresponding occurrence probabilities of the target demand vocabulary; or Querying the minimum value of the occurrence probability in the test requirement vocabulary table as the occurrence probability corresponding to the target requirement vocabulary; When the occurrence probability corresponding to the target use case vocabulary cannot be found in the test case vocabulary table, the step of determining the occurrence probability of the target use case feature in the preset use case feature set further includes: Obtaining synonyms of the target use case vocabulary, and searching the test case vocabulary table for the corresponding occurrence probabilities of the synonyms of the target use case vocabulary as the corresponding occurrence probabilities of the target use case vocabulary; or The minimum value of the occurrence probability is searched in the test case vocabulary table as the occurrence probability corresponding to the target case vocabulary.
6. The test case quality evaluation method according to claim 2, characterized in that: The following steps are used to construct the requirement feature set and the use case feature set: Obtain multiple historical test requirements and multiple historical test cases; The feature information of each of the historical test requirements is extracted to form the requirement feature set, and the feature information of each of the historical test cases is extracted to form the case feature set.
7. The test case quality evaluation method according to claim 1, characterized in that: The following steps are used to construct the requirement use case relationship function: Acquire historical test requirements and a historical test case group, wherein the historical test case group includes multiple historical test cases; Calculating the Shannon information of the historical test requirements and the Shannon information of the historical test case group respectively, and obtaining a first historical information amount and a second historical information amount in sequence; Function fitting is performed using multiple groups of the first historical information amounts and the second historical information amounts to obtain the demand use case relationship function.
8. The test case quality evaluation method according to claim 7, characterized in that: The step of performing function fitting using multiple groups of the first historical information and the second historical information to obtain the demand use case relationship function includes: Constructing the first historical information and the second amount of historical information The mapping function between: in, , , , , , and are the fitting coefficients respectively; The mapping function is fitted by least square method using the multiple groups of the first historical information and the second historical information to determine each of the fitting coefficients to obtain the demand-use case relationship function.
9. The test case quality evaluation method according to claim 1, characterized in that: The step of determining the quality evaluation result of the target test case group according to the deviation between the expected information amount and the second information amount comprises: When the deviation is less than or equal to a preset threshold, the target test case group meets the target test requirement; When the expected amount of information is greater than the second amount of information, and the deviation is greater than a preset threshold, the number of the target test case group does not meet the target test requirement, or the target test requirement includes invalid information; When the expected amount of information is less than the second amount of information and the deviation is greater than a preset threshold, the target test case group meets the target test requirement, or the target test requirement description is unclear, or the target test case group includes repeated target test cases.
10. A test case quality evaluation device, characterized in that: include: A receiving module, used for receiving a target test requirement and a target test case group, wherein the target test case group includes a plurality of target test cases; A calculation module, used to calculate the Shannon information of the target test requirement and the target test case group respectively, and obtain a first information amount and a second information amount in sequence; An acquisition module, used for acquiring a demand-use case relationship function, wherein the demand-use case relationship function is a relationship function constructed according to the Shannon information amount of the test demand and the Shannon information amount of the test case group; a processing module, configured to substitute the first amount of information into the requirement use case relationship function to obtain an expected amount of information; and A determination module is used to determine the quality evaluation result of the target test case group according to the deviation between the expected information amount and the second information amount.
11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. 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 9 are implemented.