Equipment software test case recommendation method and device based on semantic similarity
Through the method based on semantic similarity, test cases with high similarity are recommended, which solves the problems of low efficiency and poor adequacy of software testing design, and realizes the intelligent reuse of equipment software testing cases and the adequacy of new project design, and improves the improvement of new project design. The accuracy of the test and the ability to detect problems are found.
Patent Information
- Application Number
- CN202411268839.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-27
AI Technical Summary
The existing software testing technology lacks in-depth analysis and reuse of historical equipment software testing design experience, resulting in low efficiency and poor adequacy of software testing design, new project software testing design is easy to miss, and typical task scenario verification is insufficient, and failure mode is lacking. and use.
Using the equipment software test case recommendation method based on semantic similarity, by building special noun dictionary and keyword extraction, using the inverse maximum matching algorithm and LDA theme model, the semantic similarity between software test cases and requirements is calculated, and the recommended similarity is high. Test cases, combined with historical defect data, improve test cases reuse and targetedness.
The intelligent and automated reuse of equipment software test cases has been realized, and the adequacy and effectiveness of the design of new project software test cases has been improved. The accuracy and recall rate are both greater than 70%, which has improved the targetedness and problem detection capabilities of tests. .
Smart Images

Figure CN119201714A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software testing and verification, and in particular relates to a method and a device for recommending equipment software test cases based on semantic similarity. Background Art
[0002] In terms of equipment software testing design, the software quality data are stored in isolation and dispersion, and the degree of automation and intelligence in the software testing process is low. The existing software testing methods lack in-depth analysis and reuse of historical equipment software testing design experience, and only rely on the subjective experience of testers. It is difficult to quickly and accurately find applicable historical test cases, and the software testing design process of new projects is prone to omissions, which in turn affects the efficiency and adequacy of software testing work.
[0003] In terms of equipment software test execution and problem distribution, problems that have been discovered and closed in early products still emerge in subsequent products, historical software test problem data is insufficiently used to provide guidance for the application of new products, equipment software that has undergone layers of testing and verification still has many problems when used by users, typical mission scenarios are not sufficiently verified, and software failure modes lack refinement and use.
[0004] In order to improve the efficiency and adequacy of equipment software test design and enhance the testing capabilities of failure modes and mission scenarios, it is necessary to make full use of historical test cases and fault data to form a test case recommendation method suitable for equipment software. Summary of the invention
[0005] In order to solve the above problems, the present invention proposes a method for recommending equipment software test cases based on semantic similarity, comprising the following steps:
[0006] Special noun dictionary construction and keyword extraction:
[0007] According to the domain standard specifications, software requirements design, historical test problems, and historical test case data, a special term dictionary is constructed. The special term dictionary consists of a domain-specific term dictionary and a domain synonym dictionary.
[0008] Based on the special noun dictionary, using the reverse maximum matching algorithm, the test data is segmented; the test data includes software test cases and software requirements;
[0009] Extract keywords of software test cases and software requirements based on LDA topic model;
[0010] Calculation of semantic similarity between requirements and use cases:
[0011] Convert the keywords of software test cases and software requirements into keyword vectors, where the keyword vectors are used to reflect the quantity and position information of the keywords in the test data;
[0012] According to the occurrence position of the keywords in the test case keyword set and the software requirement keyword set, all keyword word vectors are combined and matched to generate keyword-based software test case and software requirement text vectors;
[0013] The semantic similarity between the keyword-based software test case and the software requirement text vector is evaluated by calculating the cosine of the angle between them.
[0014] Software test case reuse:
[0015] Calculate the semantic similarity between software requirements and test cases, and recommend software test cases whose similarity with software requirements is greater than a specified threshold;
[0016] Calculate the semantic similarity between equipment software requirements and historical defects, and recommend test cases related to software defects whose similarity with the software requirements is greater than a specified threshold;
[0017] The above software are all equipment software.
[0018] Furthermore, constructing a special noun dictionary includes the following steps:
[0019] We sorted out the standard specifications, software requirements design, historical software problems, and historical test case data in the equipment field, and built a domain-specific terminology dictionary from the perspective of "equipment field-specific terminology, equipment software requirements design, and problem anomaly types";
[0020] Construct a text stop word list for the equipment field, that is, based on the public stop word list, remove auxiliary words that are not needed for software testing;
[0021] On the basis of professional terminology, we analyze specialized terminology, identify synonyms, antonyms, abbreviations or English translations of specialized terminology in various fields with the help of standard specifications, general synonym dictionaries and expert experience, and construct a field synonym dictionary.
[0022] Furthermore, the reverse maximum matching algorithm is specifically a word segmentation processing algorithm based on a special noun dictionary and a reverse maximum matching algorithm, and the steps are as follows:
[0023] Step 1: Assume that X1 is the test case data string to be segmented, and the output string X2 is an empty set. Max Word is the maximum word length in the dictionary of special nouns;
[0024] Step 2: Determine whether X1 is an empty set. If so, output the string X2; if not, execute step 3;
[0025] Step 3: Starting from the right side of X1, take out the candidate strings Xstr to be processed one by one, where the length of Xstr is less than or equal to Max Word , proceed to step 4;
[0026] Step 4: Check whether the character string Xstr belongs to the special noun dictionary. If yes, go to step 5; otherwise, go to step 6.
[0027] Step 5: X2=X2+Xstr, X1=X1-Xstr, go to step 2;
[0028] Step 6: Remove the leftmost character of Xstr and go to step 7;
[0029] Step 7: Determine whether Xstr is a single word. If so, go to step 5; otherwise, go to step 4.
[0030] Furthermore, extracting keywords of equipment software test cases and software requirements based on the LDA topic model specifically includes the following steps:
[0031] Based on the segmentation results of the test data, search for keywords that represent software requirements and increase the frequency weights of these keywords; the keywords that represent software requirements include function names, interface names, interface types, and state names;
[0032] For the software requirement keywords, match the relevant requirement information for each of them to form an expanded data set, and finally form an expanded test data set;
[0033] Based on the expanded test data set, the LDA topic model is trained and learned to extract keywords of software test cases and software requirements.
[0034] Furthermore, the method of evaluating the semantic similarity between two text vectors by calculating the cosine value of the angle between the two text vectors is specifically as follows:
[0035] Assuming that the keyword-based software test case text vector is recorded as Si = {w1, w2, ... wn}, and the keyword-based software requirement text vector is recorded as Sj = {W1, W2, ... Wn}, the semantic similarity calculation formula is:
[0036]
[0037] Among them, SI represents the calculation result of the semantic similarity between the test case and the software requirement, and its value is a numerical value between 0 and 1. The larger the value, the higher the similarity between the two. If the semantic similarity is 1, it means that the current test case is completely related to the software requirement; if the semantic similarity is 0, it means that the current test case is completely unrelated to the software requirement.
[0038] Furthermore, software test case reuse specifically includes the following steps:
[0039] For each software requirement Qj, the semantic similarity between it and each test case Qi is calculated respectively; each software requirement Qj includes interface data and functional logic;
[0040] If the semantic similarity calculation result Qji is higher than the threshold, it can be considered that there is a strong correlation or similarity between the current software requirement Qj and the software test case Qi, and it will be recorded;
[0041] The test cases Qi whose semantic similarity calculation results Qji with the software requirements Qj are higher than the threshold are sorted according to the semantic similarity values, that is, the test cases with higher semantic similarity values are recommended with higher priority, thus forming a "test case set 1 based on case semantic similarity";
[0042] For each equipment software requirement Qj, the semantic similarity between it and each software defect Qt is calculated respectively;
[0043] If the semantic similarity calculation result Qjt is higher than the threshold, it is considered that there is a strong correlation or similarity between the current software requirement Qj and the software defect Qt, and it is recorded;
[0044] The software defects Qt whose semantic similarity calculation results Qjt with the software requirements Qj are higher than the threshold are sorted according to the semantic similarity values to form "test case set 2 based on defect semantic similarity";
[0045] The final test case recommendation set is composed of “test case set 1 based on use case semantic similarity” and “test case set 2 based on defect semantic similarity”.
[0046] A device for recommending equipment software test cases based on semantic similarity is also provided, comprising a special noun dictionary construction and keyword extraction module, a requirement and use case semantic similarity calculation module, and a software test case reuse module. The special noun dictionary construction and keyword extraction module, the requirement and use case semantic similarity calculation module, and the software test case reuse module perform equipment software test case recommendations according to the steps of the above method.
[0047] Compared with the prior art, the present invention has the following advantages:
[0048] 1. The present invention uses historical equipment software quality data as knowledge, and with the help of artificial intelligence algorithms such as topic models and word vector models, forms the intelligent and automated reuse capabilities of historical equipment software test cases, enhances the reuse efficiency of equipment software test cases, and improves the adequacy and effectiveness of new project software test case design. Based on typical equipment software requirements and test case data, application test research is carried out to verify that the accuracy of the present invention in the reuse of equipment software intelligent test cases is greater than 70%, and the recall rate is greater than 70%.
[0049] 2. The present invention combines historical defects of equipment software to form a test case recommendation method for software defects, thereby improving the pertinence of the test and the ability to detect test problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flow chart of a method for recommending equipment software test cases based on semantic similarity according to an embodiment of the present invention.
[0051] Figure 2 It is a flow chart of a word segmentation processing algorithm based on a dictionary of special nouns in the equipment field and reverse maximum matching according to an embodiment of the present invention.
[0052] Figure 3 This is a test case reuse process based on test case semantic similarity in an embodiment of the present invention.
[0053] Figure 4 This is a test case reuse process based on defect semantic similarity in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In view of the lack of reuse of equipment software test design experience and weak typical defect testing capabilities, the present invention proposes a method for recommending equipment software test cases based on semantic similarity. Using historical equipment software quality data as knowledge, a domain-specific noun dictionary is constructed to achieve accurate word segmentation of equipment domain software test data; with the help of an improved LDA model that incorporates equipment demand characteristics, software test cases with high similarity and high problem detection rates are recommended, forming a method for recommending historical equipment software test cases, enhancing the reuse efficiency of equipment software test cases, and improving the adequacy and effectiveness of new project software test case design.
[0055] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0057] This embodiment provides a method for recommending equipment software test cases based on semantic similarity. The technical solution is as follows: Figure 1 As shown, the LDA topic model is first used to extract keywords from the use case text, and then the Chinese word vector model such as BERT is used to generate word vectors for the keywords of the use case. The cosine distance algorithm is used to identify the correlation or similarity between requirements and use cases, and to recommend software test cases and test cases related to historical problem data whose similarity to equipment software requirements is greater than the specified threshold, so as to achieve efficient reuse of historical test experience. With the historical equipment software quality data as knowledge, with the help of artificial intelligence algorithms such as topic models and word vector models, the intelligent and automated reuse capabilities of historical equipment software test cases are formed. The specific steps are as follows:
[0058] 1. Construction and segmentation of special noun dictionary for equipment field
[0059] Construct a special noun dictionary for the field to which the equipment belongs, realize accurate word segmentation of the text of test cases and software requirements, and use the topic model technology to obtain the keyword vector set of equipment software test cases. The steps are as follows:
[0060] Step 1-1: Based on the domain standard specifications, software requirements design, historical test problems, historical test cases and other materials, a special term dictionary is constructed, which consists of a "domain-specific term dictionary" and a "domain synonym dictionary";
[0061] We sorted out the standard specifications, software requirements design, historical software problems, historical test cases and other materials in the equipment field, and built a "domain-specific terminology dictionary" from the perspectives of "equipment field-specific terminology, equipment software requirements design, and problem anomaly types" to segment the text of professional data in the equipment field such as "equipment software requirements" and "equipment software test cases". Taking the radar field as an example, the domain-specific terminology dictionary is as follows:
[0062] Table 1 Example of a dictionary of special terms in the radar field
[0063]
[0064]
[0065] In addition, a stop word list for text segmentation in the equipment field is constructed. That is, based on the public stop word list, auxiliary words that are not needed for software testing are removed, such as debugging assistant, software, personnel, must not, data, etc., to further enhance the accuracy of text segmentation and keywords.
[0066] On the basis of professional terminology, these special terms are analyzed, and with the help of standard specifications, general synonym dictionaries, expert experience, etc., synonyms, antonyms, abbreviations or English translations of various field-specific terms are identified. Taking the radar field as an example, the field synonym dictionary example is as follows:
[0067] Table 2 Examples of synonymous dictionaries in the field of radar
[0068] Serial number Special terms Synonyms 1. Quiet Zone Quiet zone, silent zone 2. Radio Frequency RF 3. Main lobe Main lobe, main beam 4. Frequency Agility Agile Frequency 5. Fine Tracking Fine heel 6. …… ……
[0069] Step 1-2: Based on the special noun dictionary, use the reverse maximum matching algorithm to achieve accurate word segmentation of texts such as software test cases and software requirements. Based on the text stop word list and domain-specific term dictionary, use word segmentation algorithms such as "reverse maximum matching or forward maximum matching" to accurately segment texts such as software test cases and software requirements into a collection of independent words.
[0070] The reverse maximum matching algorithm proposed in step 1-2 is specifically a word segmentation processing algorithm based on a special noun dictionary and a reverse maximum matching algorithm, such as Figure 2 As shown, the steps are as follows:
[0071] Step 1-2-1: Assume that X1 is the test case data string to be segmented, the output string X2 is an empty set, Max Word is the maximum word length in the dictionary of special nouns;
[0072] Step 1-2-2: Determine whether X1 is an empty set. If so, output the string X2 (i.e. the word segmentation result); if not, execute step 1-2-3;
[0073] Step 1-2-3: Starting from the right side of X1, take out the candidate string Xstr to be processed one by one (where the length of Xstr is less than or equal to Max Word ), execute steps 1-2-4;
[0074] Step 1-2-4: Check whether the character string Xstr belongs to the equipment domain dictionary. If so, go to step 1-2-5; otherwise, go to step 1-2-6;
[0075] Step 1-2-5: X2=X2+Xstr, X1=X1-Xstr, go to step 1-2-2;
[0076] Step 1-2-6: Remove the leftmost character of Xstr and execute step 1-2-7;
[0077] Step 1-2-7: Determine whether Xstr is a single word, if so, go to step 1-2-5, otherwise go to step 1-2-4.
[0078] 2. Intelligent keyword extraction based on topic model
[0079] This embodiment improves the weight and text length of the words that characterize the equipment software requirements to form an improved LDA topic model. The steps are as follows:
[0080] Step 2-1: Based on the word segmentation results in the original test data set, search for key words that represent equipment software requirements and increase the frequency weights of these key words.
[0081] Step 2-2: For the key words of equipment software requirements, match the relevant requirement information for each word to form an expanded data set, and finally form an expanded test data set.
[0082] Step 2-3: Based on the expanded test data set, the LDA topic model is used for training and learning to accurately extract keywords for equipment software test data and software requirements.
[0083] Specifically, after word segmentation, data texts such as "software requirements" and "test cases" will form a "test data word segmentation set" consisting of multiple words. Some words in the "test data word segmentation set" can be used to represent the theme or features of "software requirements" or "test cases", which can be called keywords. For example, in the test data text "After the display control software has been running for a period of time, an exception of function execution timeout occurs", its keywords may be "display control software, execution timeout", etc. Studies have shown that keyword extraction from data text is one of the important ways to improve the accuracy and recall rate of intelligent reuse of test cases.
[0084] The traditional LDA model does not consider the word weight information in the equipment field background, and the topic allocation is biased towards the topics of high-frequency words. In many cases, important words with a strong field background such as equipment software requirements are difficult to become the output results of "topic-keywords" because their number of occurrences or frequencies may not be very high. Therefore, this embodiment intends to increase the weight and text length of the words that represent equipment software requirements to form an improved LDA topic model. The steps are as follows:
[0085] Step (1): For the word segmentation results in the original test data set D = {d1, d2, ..., dn}, search for a set of key words V = {v1, v2, ... vs} (V∈D, s is the number of key words in the set) that represent the equipment software requirements, such as function name, interface name, interface type, state name, etc. At the same time, increase the word frequency weights of these key words.
[0086] Step (2): For the equipment software requirement keyword words V, for each word vi (i = 1 ~ s) (s is a positive integer), match it with relevant requirement information. For example, for the function name vi, the text information such as the relevant function logic, interface name, state name, etc. can be added to the original test data set to form an expanded data set V' = {v1, v2, ..., vs, vs+1, vs+2, ..., VS} (S is the number of keyword words in the expanded set). Finally, the expanded test data set D' = D∪V' is formed (the length of the expanded test data set D' is S+n).
[0087] Step (3): Based on the expanded test data set, the LDA topic model is used for training and learning to accurately extract keywords of equipment software test data and software requirements.
[0088] 3. Semantic similarity calculation based on use case keywords
[0089] Based on the matching quantity and position information of use case keywords and the cosine distance algorithm, the semantic similarity between software test cases and software requirements is calculated.
[0090] Specifically, before calculating the semantic similarity between equipment software test cases and software requirements, it is necessary to first use deep learning language representation models such as Word2Vec to convert the keywords of equipment software test cases and software requirements into keyword word vectors, which comprehensively reflect the quantity, position and other information of the keywords in the test data corpus. Then, based on the occurrence position of the keywords in the test case keyword set and the software requirement keyword set, the word vectors of all keywords are combined and matched to generate keyword-based test case and software requirement text vectors. Then, the semantic similarity of the two text vectors is evaluated by calculating the cosine value of the angle between them, which specifically includes the following steps:
[0091] Step 3-1: Use the deep bidirectional neural network of the pre-trained Chinese word vector model to train and learn data such as general Chinese corpus and software test cases (general text corpus + equipment software test data text corpus);
[0092] Step 3-2: Consider the word's position, context, frequency of occurrence, and other information in each text, and generate a word vector for each keyword in the test case keyword set and software requirement keyword set based on the training and learning results.
[0093] Step 3-3: Combine and match the word vectors of all keywords according to the positions of the keywords in the test case keyword set and the software requirement keyword set, and finally generate the text vectors of the test case and software requirement. Usually, the "text vectors" of software test cases and software requirements are expressed in digital form such as (0.1, 0.2, 0.3, 0.2, 0.1, 0.5, 0.5, 0.4, ...).
[0094] Step 3-4: Then, semantic similarity algorithms such as cosine distance can be used to calculate the semantic similarity of the requirements and use case text vectors composed of keyword word vectors to achieve the correlation or similarity judgment of requirements and use cases. Assuming that the test case keyword text vector (keyword-based software test case text vector) generated based on the pre-trained word vector model is denoted as Si = {w1, w2, ... wn}, and the software requirement keyword text vector (keyword-based software requirement text vector) is denoted as Sj = {W1, W2, ... Wn}, the semantic similarity calculation formula based on cosine distance is:
[0095]
[0096] In the above formula, SI represents the calculation result of the semantic similarity between the test case and the software requirement, and its value is a numerical value between 0 and 1. The larger the value, the higher the similarity between the two. If the semantic similarity between the test case and the software requirement is 1, it means that the current test case is completely related to the software requirement. If the semantic similarity between the test case and the software requirement is 0, it means that the current test case is completely unrelated to the software requirement.
[0097] 4. Test case reuse (test case reuse based on test case semantic similarity and test case reuse based on defect semantic similarity)
[0098] Use similarity calculation methods to achieve intelligent recommendation and generate historical test cases similar to software requirements and test cases related to typical defects. The steps are as follows:
[0099] Step 4-1: Calculate the semantic similarity between equipment software requirements and test cases, and recommend software test cases whose similarity with equipment software requirements is greater than a specified threshold, so as to achieve efficient recommendation of historical test experience;
[0100] Step 4-2: With the help of natural language processing methods such as equipment software test case word segmentation technology, keyword extraction technology, and semantic similarity algorithm, calculate the semantic similarity between equipment software requirements and historical defects, and recommend test cases related to software defects whose similarity is greater than the specified threshold for equipment software requirements, so as to improve the targetedness of the test and the ability to detect test problems.
[0101] Specifically, in this embodiment, the specific process of step 4-1 is Figure 3 As shown:
[0102] Step 4-1-1: For each equipment software requirement Qj (interface data, functional logic, etc.), calculate the semantic similarity between it and each test case Qi;
[0103] Step 4-1-2: If the semantic similarity calculation result Qji is higher than a certain threshold (for example, 0.7), it can be considered that there is a strong correlation or similarity between the current software requirement Qj and the software test case Qi, and it is recorded;
[0104] Step 4-1-3: Sort the test cases Qi whose semantic similarity calculation results Qji with the software requirements Qj are higher than a certain threshold (for example, 0.7) according to the semantic similarity values. That is, the test cases with higher semantic similarity values are recommended with higher priority, thus forming a "test case set 1 based on case semantic similarity".
[0105] Step 4-2 is as follows:
[0106] Calculate the similarity between each software requirement and historical software defects, and recommend test cases related to suspected deficiencies based on the similarity calculation results. The specific process is as follows: Figure 4 As shown:
[0107] Step 4-2-1: For each equipment software requirement Qj (interface data, functional logic, etc.), calculate the semantic similarity between it and each software defect Qt;
[0108] Step 4-2-2: If the semantic similarity calculation result Qjt is higher than a certain threshold (for example, 0.7), it can be considered that there is a strong correlation or similarity between the current software requirement Qj and the software defect Qt, and it is recorded;
[0109] Step 4-2-3: Sort the defects Qt whose semantic similarity calculation results Qjt with the software requirements Qj are higher than a certain threshold (for example, 0.7) according to the semantic similarity values to form a "test case set 2 based on defect semantic similarity";
[0110] Step 4-2-4: The final test case recommendation set is composed of the "test case set 1 based on use case semantic similarity" formed in step 4-1-3 and the "test case set 2 based on defect semantic similarity" formed in step 4-2-3.
[0111] This embodiment also provides a device for recommending equipment software test cases based on semantic similarity, including a special noun dictionary construction and keyword extraction module, a demand and use case semantic similarity calculation module, and a software test case reuse module. The special noun dictionary construction and keyword extraction module, the demand and use case semantic similarity calculation module, and the software test case reuse module perform equipment software test case recommendation according to the steps of the above method. The device uses historical equipment software quality data as knowledge and a special noun dictionary in the equipment field to achieve accurate word segmentation of software test data in the equipment field. With the help of artificial intelligence algorithms such as the improved LDA model and word vector model that incorporate equipment software demand characteristics, it recommends use cases with high similarity and many problems, forming a historical equipment software test case recommendation method, enhancing the efficiency of equipment software test case reuse, and improving the adequacy and effectiveness of new project software test case design.
[0112] 1) Equipment-specific noun construction and word segmentation: Based on equipment field standards and specifications, software requirements design, historical test problems, historical test cases and other knowledge, a special noun dictionary is formed, including a "domain-specific terminology dictionary" and a "domain synonym dictionary". With the help of the reverse maximum matching algorithm, accurate word segmentation of domain software test cases, software requirements and other texts is achieved.
[0113] 2) Intelligent keyword extraction based on topic model: Improve the weight and text length of words that characterize equipment software requirements, form an improved LDA topic model, and achieve accurate keyword extraction of equipment software test data and software requirements.
[0114] 3) Calculation of semantic similarity between requirements and use cases: Based on the matching number and position information of use case keywords and the cosine distance algorithm, the semantic similarity between software test cases and software requirements is calculated.
[0115] 4) Test case reuse: Calculate the semantic similarity between equipment software requirements and test cases, recommend software test cases whose similarity with equipment software requirements is greater than the specified threshold, and achieve efficient recommendation of historical testing experience; calculate the semantic similarity between equipment software requirements and historical defects, recommend test cases related to software defects whose similarity with software requirements is greater than the specified threshold, and improve the targetedness of testing and the ability to detect test problems.
[0116] This invention uses historical equipment software quality data as knowledge, and with the help of artificial intelligence algorithms such as topic models and word vector models, forms the intelligent and automated reuse capabilities of historical equipment software test cases, enhances the reuse efficiency of equipment software test cases, and improves the adequacy and effectiveness of new project software test case design. Based on typical equipment software requirements and test case data, application test research is carried out to verify that the accuracy of the invention results in the reuse of equipment software intelligent test cases is greater than 70%, and the recall rate is greater than 70%.
[0117] The present invention combines historical defects of equipment software to form a test case recommendation method for software defects, thereby improving the pertinence of the test and the ability to detect test problems. The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for recommending equipment software test cases based on semantic similarity, characterized in that: The following steps are involved: Special noun dictionary construction and keyword extraction: According to the domain standard specifications, software requirements design, historical test problems, and historical test case data, a special term dictionary is constructed. The special term dictionary consists of a domain-specific term dictionary and a domain synonym dictionary. Based on the special noun dictionary, using the reverse maximum matching algorithm, the test data is segmented; the test data includes software test cases and software requirements; Extract keywords of software test cases and software requirements based on LDA topic model; Calculation of semantic similarity between requirements and use cases: Convert the keywords of software test cases and software requirements into keyword vectors, where the keyword vectors are used to reflect the quantity and position information of the keywords in the test data; According to the occurrence position of the keywords in the test case keyword set and the software requirement keyword set, all keyword word vectors are combined and matched to generate keyword-based software test case and software requirement text vectors; The semantic similarity between the keyword-based software test case and the software requirement text vector is evaluated by calculating the cosine value of the angle between the two. Software test case reuse: Calculate the semantic similarity between software requirements and test cases, and recommend software test cases whose similarity with software requirements is greater than a specified threshold; Calculate the semantic similarity between equipment software requirements and historical defects, and recommend test cases related to software defects whose similarity is greater than a specified threshold. The above software are all equipment software.
2. The method for recommending equipment software test cases based on semantic similarity according to claim 1, characterized in that: Building a dictionary of special terms includes the following steps: We sorted out the standard specifications, software requirements design, historical software problems, and historical test case data in the equipment field, and built a domain-specific terminology dictionary from the perspective of "equipment field-specific terminology, equipment software requirements design, and problem anomaly types"; Construct a text stop word list for the equipment field, that is, based on the public stop word list, remove auxiliary words that are not needed for software testing; On the basis of professional terminology, we analyze specialized terminology, identify synonyms, antonyms, abbreviations or English translations of specialized terminology in various fields with the help of standard specifications, general synonym dictionaries and expert experience, and construct a field synonym dictionary.
3. The method for recommending equipment software test cases based on semantic similarity according to claim 1, characterized in that: The reverse maximum matching algorithm is specifically a word segmentation processing algorithm based on a special noun dictionary and a reverse maximum matching algorithm, and the steps are as follows: Step 1: Assume that X1 is the test case data string to be segmented, and the output string X2 is an empty set. Max Word is the maximum word length in the dictionary of special nouns; Step 2: Determine whether X1 is an empty set. If so, output the string X2; if not, execute step 3; Step 3: Starting from the right side of X1, take out the candidate strings Xstr to be processed one by one, where the length of Xstr is less than or equal to Max Word , proceed to step 4; Step 4: Check whether the character string Xstr belongs to the special noun dictionary. If yes, go to step 5; otherwise, go to step 6. Step 5: X2=X2+Xstr, X1=X1-Xstr, go to step 2; Step 6: Remove the leftmost character of Xstr and go to step 7; Step 7: Determine whether Xstr is a single word. If so, go to step 5; otherwise, go to step 4.
4. The method for recommending equipment software test cases based on semantic similarity according to claim 1, characterized in that: The method of extracting keywords of equipment software test cases and software requirements based on the LDA topic model specifically includes the following steps: Based on the segmentation results of the test data, search for keywords that represent software requirements and increase the frequency weights of these keywords; the keywords that represent software requirements include function names, interface names, interface types, and state names; For the software requirement keywords, match the relevant requirement information for each of them to form an expanded data set, and finally form an expanded test data set; Based on the expanded test data set, the LDA topic model is trained and learned to extract keywords of software test cases and software requirements.
5. The method for recommending equipment software test cases based on semantic similarity according to claim 1, characterized in that: The method of evaluating the semantic similarity between two text vectors by calculating the cosine value of the angle between the two text vectors is specifically as follows: Assuming that the keyword-based software test case text vector is recorded as Si = {w1, w2, ... wn}, and the keyword-based software requirement text vector is recorded as Sj = {W1, W2, ... Wn}, the semantic similarity calculation formula is: Among them, SI represents the calculation result of the semantic similarity between the test case and the software requirement, and its value is a numerical value between 0 and 1. The larger the value, the higher the similarity between the two. If the semantic similarity is 1, it means that the current test case is completely related to the software requirement; if the semantic similarity is 0, it means that the current test case is completely unrelated to the software requirement.
6. The method for recommending equipment software test cases based on semantic similarity according to claim 1, characterized in that: Software test case reuse includes the following steps: For each software requirement Qj, the semantic similarity between it and each test case Qi is calculated respectively; each software requirement Qj includes interface data and functional logic; If the semantic similarity calculation result Qji is higher than the threshold, it can be considered that there is a strong correlation or similarity between the current software requirement Qj and the software test case Qi, and it will be recorded; Test cases Qi whose semantic similarity calculation results Qji with software requirements Qj are higher than the threshold are sorted according to the semantic similarity values, that is, test cases with higher semantic similarity values are recommended with higher priority, thus forming "test case set 1 based on case semantic similarity"; For each equipment software requirement Qj, the semantic similarity between it and each software defect Qt is calculated respectively; If the semantic similarity calculation result Qjt is higher than the threshold, it is considered that there is a strong correlation or similarity between the current software requirement Qj and the software defect Qt, and it is recorded; The software defects Qt whose semantic similarity calculation results Qjt with the software requirements Qj are higher than the threshold are sorted according to the semantic similarity values to form "test case set 2 based on defect semantic similarity"; The final test case recommendation set is composed by combining "test case set 1 based on use case semantic similarity" and "test case set 2 based on defect semantic similarity".
7. A device for recommending equipment software test cases based on semantic similarity, characterized in that: It includes a special noun dictionary construction and keyword extraction module, a requirement and use case semantic similarity calculation module, and a software test case reuse module. The special noun dictionary construction and keyword extraction module, the requirement and use case semantic similarity calculation module, and the software test case reuse module recommend equipment software test cases according to the steps of the method described in any one of claims 1-6.
Citation Information
Patent Citations
Classification method for airborne system software defects
CN114090786A
Test case recommendation system and method based on pre-training language model
CN114579430A
Test case generation method and device, electronic equipment and storage medium
CN117370190A
Test case recommendation method based on semantic index relation
CN117591624A
Cited By
Server item testing method, electronic equipment and storage medium
CN120610901A