Data matching methods, devices, electronic equipment and storage media
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-23
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]有鉴于此,本申请的目的在于提供一种数据匹配方法、装置、电子设备及存储介质,其能够改善目前的匹配方法所存在的匹配效率低、匹配准确率低的问题
[0044]本申请实施例提供的数据匹配方法、装置、电子设备及存储介质,通过将测试用例的目录树名称进行分词,得到目录分词集合,基于该目录分词集合,进行测试用例的目录与缺陷间的匹配,得到测试用例的目录匹配缺陷。从与目录匹配缺陷匹配的目录中选取最佳匹配目录,将最佳匹配目录的匹配缺陷作为最佳候选缺陷,将最佳匹配目录下的测试用例与该最佳候选缺陷进行匹配,得到用例缺陷匹配结果。如此,通过先将测试用例目录与缺陷匹配,再将目录下的测试用例与缺陷匹配的分层匹配方式,能够极大地提高用例缺陷匹配的准确率。并且,匹配过程全自动处理,能够提高地提升匹配效率。
Smart Images

Figure CN117370616B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and more specifically, to a data matching method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of internet and software technology, the variety of software products is countless. To improve user experience, software testing is a crucial part of software development. Matching test cases with defects allows developers to quickly identify all potential flaws in the software product.
[0003] The test case system platform has accumulated tens of thousands of test cases, while the defect management system has accumulated thousands of defects. Currently, common test case-defect matching methods include: (i) manual matching and association by developers; and (ii) segmenting test cases and defects into words and matching test cases-defects based on the intersection-union ratio (IUU) of the segmentation results. However, the first method has a relatively small overall matching volume and low efficiency. The second method only matches from the perspective of IUU, resulting in a lower overall accuracy. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a data matching method, apparatus, electronic device and storage medium that can improve the problems of low matching efficiency and low matching accuracy of the current matching methods.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:
[0006] In a first aspect, embodiments of this application provide a data matching method, the method comprising:
[0007] Obtain the directory tree name of the test case, and perform word segmentation on the directory tree name to obtain a directory word set; wherein, the directory tree name includes the names of each level of the test case's directory;
[0008] Based on the directory word segmentation set, the directory of the test case is matched with the defects in the preset defect library to obtain the directory matching defects of the test case;
[0009] Select the best matching directory from the directories that match the defects in the directory, take the matching defects in the best matching directory as the best candidate defects, and match the test cases under the best matching directory with the best candidate defects to obtain the test case defect matching results.
[0010] In one possible implementation, the step of matching the directory of the test cases with defects in a preset defect library based on the directory segmentation set to obtain the directory-matched defects of the test cases includes:
[0011] For each preset defect, based on the directory word segmentation set, the defect word segmentation set of the defect is subjected to maximum word segmentation matching to obtain the word segmentation matching result between the directory word segmentation set and the defect word segmentation set;
[0012] Based on the word segmentation matching results, the directory matching weight between the directory of the test case and each defect is calculated;
[0013] Defects that meet the high matching criteria in the directory matching weight are selected as candidate defects. A second matching and filtering process is then performed, combining the candidate defects, the directories at each level, and the preset first prompt word, to obtain the directory matching defects of the test case.
[0014] In one possible implementation, the word segmentation matching result includes the intersection and union of word segmentation between the directory word segmentation set and the defective word segmentation set;
[0015] The step of calculating the directory matching weight between the directory of the test cases and each defect includes:
[0016] Calculate the character length of each word in the union of the word segments, and add the cubes of the character lengths of the words in the union of the same directory level to obtain the union weight value of each directory level.
[0017] For each word in the union of word segments, if the word exists in the intersection of word segments, the cube of the character length of the word segment is added to the intersection weight value of the directory level to which the word segment belongs;
[0018] For each directory level, the intersection weight value of the directory levels is divided by the union weight value to obtain the Jaccard distance of the directory level, and the product of the Jaccard distance and the preset weighting coefficient corresponding to the directory level is calculated to obtain the matching weight of the directory level.
[0019] Calculate the sum of the matching weights of all the directory levels to obtain the directory matching weight between the directory of the test case and the defect.
[0020] In one possible implementation, the first prompt word is a template for a question describing a directory of test cases and a defect matching problem;
[0021] The step of combining the candidate defects, the directories at each level, and the preset first prompt words to perform secondary matching and filtering to obtain the directory matching defects of the test cases includes:
[0022] For each candidate defect, a directory of the test case and the candidate defect are sequentially filled into the first prompt word to obtain multiple directory defect matching questions;
[0023] Each of the aforementioned directory defect matching problems is input into a pre-trained NLP matching model for matching processing to obtain matching relationships;
[0024] When the matching relationship exists, the candidate defects in the directory defect matching problem are taken as the directory matching defects of the directory in the directory defect matching problem.
[0025] In one possible implementation, the step of performing maximum segmentation matching on the defect segmentation set based on the directory segmentation set to obtain the segmentation matching result between the directory segmentation set and the defect segmentation set includes:
[0026] A bidirectional maximum matching algorithm is used to match the directory word segmentation set with the defect word segmentation set to obtain the word segmentation matching result between the directory word segmentation set and the defect word segmentation set.
[0027] In one possible implementation, the step of selecting the best matching directory from the directories that match the directory matching defect includes:
[0028] From the directory matching defects, select the defect with the highest corresponding directory matching weight, and take the directory that matches the defect as the best matching directory.
[0029] In one possible implementation, the step of matching test cases in the best matching directory with the best candidate defects to obtain test case defect matching results includes:
[0030] Obtain the vector of each test case in the best matching directory, and obtain the vector of the best candidate defect;
[0031] For each of the best candidate defects, calculate the matching value between the vector of the best candidate defect and the vector of each test case in the best matching directory, and select the test cases whose matching values satisfy the high matching condition as candidate test cases for the best candidate defects.
[0032] By combining the candidate use cases of the best candidate defect with the preset second prompt word, a secondary matching and filtering is performed to obtain the use case defect matching result between each best candidate defect and the candidate use cases of the best candidate defect.
[0033] In one possible implementation, the second prompt word is a template describing a matching question between test cases and defects;
[0034] The step of combining the candidate use cases of the best candidate defect with the preset second prompt word to perform secondary matching and filtering, and obtaining the use case defect matching result between each best candidate defect and the candidate use cases of the best candidate defect, includes:
[0035] For each of the best candidate defects, the best candidate defect and a candidate use case of the best candidate defect are sequentially filled into the second prompt word to obtain the use case defect matching problem;
[0036] Each of the aforementioned use case defect matching problems is input into a pre-trained NLP matching model for matching processing to obtain matching results;
[0037] When the matching result indicates that a matching relationship exists, the best candidate defect in the use case defect matching problem is taken as the matching defect of the candidate use case in the use case defect matching problem.
[0038] Secondly, embodiments of this application provide a data matching device, including a word segmentation module, a directory defect matching module, and a use case defect matching module;
[0039] The word segmentation module is used to obtain the directory tree name of the test case, segment the directory tree name into words, and obtain a directory word segmentation set; wherein, the directory tree name includes the names of each level of the test case's directory;
[0040] The directory defect matching module is used to match the directory of the test case with defects in the preset defect library based on the directory word segmentation set, so as to obtain the directory matching defect of the test case.
[0041] The test case defect matching module is used to select the best matching directory from the directories that match the defects in the directory, take the matching defects in the best matching directory as the best candidate defects, and match the test cases under the best matching directory with the best candidate defects to obtain the test case defect matching result.
[0042] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing machine-executable instructions executable by the processor, the processor executing the machine-executable instructions to implement the data matching method as described in any possible implementation of the first aspect.
[0043] Fourthly, embodiments of this application provide a storage medium having a computer program stored thereon, which, when executed by a processor, implements the data matching method as described in any possible implementation of the first aspect.
[0044] The data matching method, apparatus, electronic device, and storage medium provided in this application segment the directory tree name of test cases to obtain a directory segmentation set. Based on this directory segmentation set, the directory of test cases is matched with defects to obtain the directory matching defects of the test cases. The best matching directory is selected from the directories that match the directory matching defects, and the matching defects of the best matching directory are taken as the best candidate defects. The test cases under the best matching directory are matched with the best candidate defects to obtain the test case defect matching results. In this way, by first matching the test case directory with defects, and then matching the test cases under the directory with defects, the accuracy of test case defect matching can be greatly improved. Moreover, the matching process is fully automated, which can greatly improve the matching efficiency.
[0045] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0046] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 A schematic diagram of the structure of the data matching system provided in an embodiment of this application is shown.
[0048] Figure 2 A flowchart illustrating the data matching method provided in an embodiment of this application is shown.
[0049] Figure 3 A schematic diagram of the directory tree structure provided in an embodiment of this application is shown.
[0050] Figure 4 It shows Figure 2 A flowchart illustrating some sub-steps of step S13.
[0051] Figure 5 It shows Figure 4 A flowchart illustrating some sub-steps of step S132.
[0052] Figure 6 It shows Figure 4 A schematic diagram of the process of some sub-steps in step S133.
[0053] Figure 7 It shows Figure 2 A flowchart illustrating some sub-steps of step S15.
[0054] Figure 8 It shows Figure 7 A flowchart illustrating some sub-steps of step S153.
[0055] Figure 9 A schematic diagram of the data matching device provided in an embodiment of this application is shown.
[0056] Figure 10 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown.
[0057] Explanation of reference numerals in the attached figures: 1000 - Data matching system; 10 - Development management equipment; 20 - Matching equipment; 30 - Data matching device; 301 - Word segmentation module; 302 - Directory defect matching module; 303 - Use case defect matching module; 40 - Electronic equipment. Detailed Implementation
[0058] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can be arranged and designed in various different configurations.
[0059] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0060] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0061] The commonly used test case-defect matching method involves segmenting test cases and defects into words and then matching them based on the intersection-union ratio (IUU) of the segmentation results. However, this method only considers the IUU of segmentation results, resulting in low overall accuracy. Traditional manual matching methods are also inefficient.
[0062] Based on the above considerations, this application provides a data matching method that can improve the problems of low matching efficiency and low matching accuracy of current matching methods.
[0063] The data matching method provided in this application embodiment can be applied to... Figure 1 The data matching system 1000 shown may include a matching device 20 and a development management device 10. The matching device 20 can communicate with the development management device 10 via wired or wireless means such as a network. The matching device 20 is pre-deployed with a defect library, which includes multiple defects and a defect segmentation set and vector for each defect.
[0064] The defect word segmentation set includes word segments of defects. After removing special characters, standardized text formats, and uniform terminology from the text, each defect can be segmented into smaller, meaningful words or phrases, resulting in the defect word segmentation set. Word vectorization algorithms or language models can then be used to convert the defect text into numerical vectors, yielding the defect text vector.
[0065] Development management device 10 is used to distribute test cases to be matched for defects to the development management device 10.
[0066] The matching device 20 can implement the data matching method provided in the embodiments of this application and send the matching results to the development and management device 10.
[0067] The development and management device 10 may include, but is not limited to, servers, personal computers, laptops, mobile terminals, and wearable portable devices. The matching device 20 may include, but is not limited to, standalone servers and server clusters.
[0068] In one possible implementation, a data matching method is provided, referring to Figure 2 This may include the following steps. In this embodiment, the data matching method is applied to... Figure 1 Let's take the matching device 20 in the example as an illustration.
[0069] S11, obtain the directory tree name of the test case, segment the directory tree name into words, and obtain the directory word set.
[0070] In this embodiment, the directory tree refers to a directory tree composed of various levels of directories for test cases. For example, it could be like this: Figure 3 The directory tree shown. The directory tree name can include the names of the nodes (directory levels) in the directory tree, for example, in Figure 3 The directory tree shown includes names such as Videos, Live Streaming Rooms, Basics, Immersive Player, Video Tools, Game Live Streaming Rooms, Event Live Streaming Rooms, My Tab, and Home Tab.
[0071] S13, based on the directory word segmentation set, match the directory of the test cases with the defects in the preset defect library to obtain the directory matching defects of the test cases.
[0072] S15: Select the best matching directory from the directories that match the directory matching defects, take the matching defects of the best matching directory as the best candidate defects, and match the test cases under the best matching directory with the best candidate defects to obtain the test case defect matching results.
[0073] In step S11, to avoid interference from irrelevant data, the test cases can be preprocessed before word segmentation of the directory tree name. Preprocessing may include data cleaning, standardization, removal of redundant information, and filtering of special symbols. This removes duplicate data, interfering symbols, and other distracting information, resulting in the directory tree name. The directory tree name is then word segmented to obtain a directory word set.
[0074] The development management device 10 sends test case information of the test project to the matching device 20. The test case information may include a directory tree and multiple test cases. After receiving the test case information, the matching device 20 uses a preset word segmentation algorithm to extract the directory tree names of the test cases and perform word segmentation to obtain a directory word segmentation set. The word segmentation algorithm can be any word segmentation method, such as dictionary-based, understanding-based, or statistical word segmentation methods; this embodiment does not impose a specific limitation.
[0075] After obtaining the directory segmentation set, the matching device 20 matches the directory of the test case with the defects in the defect library based on the directory segmentation set to obtain the directory matching defects. It should be noted that the number of directory matching defects can be 0, or one or more. When the number of directory matching defects is 0, it indicates that there are no defects that match the test case, and there is no need to execute step S15.
[0076] When the number of directory matching defects is not zero, the best matching directory is selected from the directories that match the directory matching defects, and the matching defects of the best matching directory are taken as the best candidate defects. Then, the matching device 20 matches each best candidate defect with the test cases under the best matching directory to obtain the test case defect matching results.
[0077] It should be understood that the test case defect matching results can include all test cases that match the best candidate defect. After obtaining the matching results, the matching device 20 packages the matching results and sends them to the development management device 10 for developers to view and use.
[0078] Compared to current matching methods, the above data matching method significantly improves the accuracy of test case-defect matching through a hierarchical matching approach: first matching the test case directory with defects, and then matching test cases within the directory with defects. Furthermore, the matching process is fully automated, greatly enhancing matching efficiency.
[0079] For step S13, the method of matching the catalog and defects can be flexibly set. For example, it can be matched according to preset rules, or it can be matched using a neural network model, etc. In this embodiment, no specific limitation is made.
[0080] To ensure that the directory and defect matching are as accurate as possible and to improve the accuracy of the matching, maximum word segmentation matching, matching weight judgment, and secondary matching filtering can be introduced in step S13. In one possible implementation, refer to... Figure 4 Step S13 can be further implemented as follows.
[0081] S131, for each preset defect, based on the directory word segmentation set, perform maximum word segmentation matching on the defect word segmentation set to obtain the word segmentation matching result between the directory word segmentation set and the defect word segmentation set.
[0082] S132, based on the word segmentation matching results, calculate the directory matching weight between the test case directory and each defect.
[0083] S133, select defects that meet the high matching condition of directory matching weight as candidate defects, and perform secondary matching and filtering by combining the candidate defects, directories at all levels and preset first prompt words to obtain the directory matching defects of the test cases.
[0084] For step S131, in one possible implementation, a bidirectional maximum matching algorithm can be used to match the directory word segmentation set with the defect word segmentation set to obtain the word segmentation matching result between the directory word segmentation set and the defect word segmentation set. In this way, the matching result with the longest bidirectional matching between the directory word segmentation set and the defect word segmentation set can be obtained, that is, the optimal matching result can be obtained, thereby helping to improve the matching accuracy.
[0085] In other implementations, matching algorithms such as forward maximum matching or reverse forward matching can also be used to obtain the word segmentation matching results between the directory word segmentation set and the defect word segmentation set.
[0086] For step S132, the method for calculating the directory matching weight can be flexibly set. For example, the ratio between the matching item and all word segments can be used as the directory matching weight, or the directory matching weight can be calculated according to preset rules. In this embodiment, no specific limitation is made.
[0087] In one possible implementation, the word segmentation matching result may include the intersection and union of word segments between the directory word segmentation set and the defective word segmentation set. The word segmentation intersection includes word segments with matching relationships, and the word segmentation intersection includes all word segments in the directory word segmentation set and the defective word segmentation set.
[0088] For step S132, to ensure that the directory matching weights can adequately measure the degree of matching between directories and defects, and to consider the contribution rate of matching results from different levels of directories, a preset weighting coefficient and weight value calculation corresponding to the directory level are introduced. Furthermore, Jaccard distance is introduced to measure the difference between the intersection and union of word segments. (Refer to...) Figure 5 Step S132 can be further implemented as follows.
[0089] S1321, calculate the character length of each word in the union of word segments, and add the cube values of the character lengths of the words in the union of words belonging to the same directory level to obtain the union weight value of each directory level.
[0090] It should be noted that if a union segment does not belong to any directory level, the cube of the character length of the union segment is added to the union weight value of each directory level. For example, taking a directory with first-level, second-level, and third-level directories as an example, if union segment A does not belong to any of the first-level, second-level, and third-level directories, the cube of the character length of union segment A is added to the union weight value of the first-level, second-level, and third-level directories respectively.
[0091] S1322: For each word in the word segment union, if the word exists in the word segment intersection, the cube of the character length of the word is added to the intersection weight value of the directory level to which the word belongs.
[0092] S1323, For each directory level, divide the intersection weight value of the directory level by the union weight value to obtain the Jaccard distance of the directory level, and calculate the product of the Jaccard distance and the preset weighting coefficient corresponding to the directory level to obtain the matching weight of the directory level.
[0093] S1324, calculate the sum of the matching weights of all directory levels to obtain the directory matching weight between the test case directory and the defect.
[0094] Taking the example that the test case has three directory levels, the calculation formula of the directory matching weight can be expressed as: directory matching weight = weighted coefficient of the first-level directory × (Jaccard distance between the directory word segmentation set of the first-level directory and the corrected defect word segmentation set) + weighted coefficient of the second-level directory × (Jaccard distance between the directory word segmentation set of the second-level directory and the modified defect word segmentation set) + weighted coefficient of the third-level directory × (Jaccard distance between the directory word segmentation set of the third-level directory and the corrected defect word segmentation set). Among them, the modified defect word segmentation set of the n-level directory = defect word segmentation set - directory word segmentation set of non-n-level directories.
[0095] It should be noted that the weighted coefficients of the directory levels increase with the levels, that is, the weighted coefficient of the 1st-level directory < the weighted coefficient of the 2nd-level directory < … < the weighted coefficient of the n-level directory, and the sum of the weighted coefficients of all directory levels is 1.
[0096] Through the above steps S1321 to S1324, the preset weighted coefficients, weight values, and Jaccard distance corresponding to the directory levels are introduced in the calculation of the directory matching weight. It not only considers the difference between the word segmentation intersection and the word segmentation union but also considers the influence contribution rate of different directory levels, enabling the directory matching weight to fully measure the matching degree between the directory and the defect, thereby improving the matching accuracy.
[0097] In this embodiment, the first prompt word is a template for describing the matching problem between the directory of the test case and the defect. For example, it can be in the form of "Does defect i belong to directory M", "Do defects j or k similar to defect i belong to directory M", and "Do defects j / k similar to defect i belong to directory M", etc.
[0098] For step S133, when selecting defects with directory matching weights that meet the high matching conditions as candidate defects, the setting of the high matching conditions can be flexibly selected. For example, it can be greater than the preset weight threshold, or the rank after sorting the directory matching weights reaches the preset rank. In this embodiment, no specific limitation is made.
[0099] In a possible implementation manner, the directory matching weights can be sorted in descending order, and the defects with the first N in the sorting order of the directory matching weights are used as candidate defects. The value of N can be set and adjusted according to the actual situation. For example, it can be the top ten, or the top five, or the top three.
[0100] The method of secondary screening can be screening and matching according to preset rules, or screening and matching using a machine learning model. No specific limitation is made in this embodiment.
[0101] In one possible implementation, to fully consider the feature matching between the test case catalog and defects during secondary screening and matching, and to improve matching speed, a pre-trained NLP matching model for catalog-defect matching analysis can be introduced. (Refer to...) Figure 6 Step S133 can be further implemented as follows.
[0102] S1331, for each candidate defect, sequentially fill in a directory of the test case and the candidate defect into the first prompt word to obtain multiple directory defect matching questions.
[0103] For example, if there are 8 directories, then 8 directory curve matching problems can be constructed between each candidate directory and the directories. The directory defect matching problem can be in the form of "Does defect i belong to directory M?" or "Does defect j or defect k, which are similar to defect i, belong to directory M?"
[0104] S1332: Input each directory defect matching problem into a pre-trained NLP matching model, perform matching processing, and obtain matching relationships.
[0105] S1333, when the matching relationship is that a matching relationship exists, the candidate defects in the directory defect matching problem are taken as the directory matching defects of the directory in the directory defect matching problem.
[0106] It should be noted that the NLP matching model is a large language model obtained by training a Natural Language Processing (NLP) model. It can analyze the matching relationship between texts. For example, it can be a GPT model or a text-based large model. In this embodiment, no specific limitation is made.
[0107] In this way, directory matching defects that match the test case's directory can be quickly and accurately identified. Furthermore, a secondary filtering process can further improve matching accuracy.
[0108] In the above method, steps S131 to S133 and their sub-steps introduce maximum word segmentation matching, calculation of directory matching weight, and secondary matching filtering into the directory defect matching process. Furthermore, the differences between word segmentation intersection and word segmentation union, as well as the influence contribution rate of different directory levels, are considered in the directory matching calculation, ensuring that the directory matching weight can fully measure the degree of matching between the directory and the defect. In addition, based on the directory matching results and directory matching weight, an NLP model is used for secondary matching filtering. This significantly improves the matching accuracy of directory defect matching, contributing to the improvement of the accuracy of use case defect matching.
[0109] For step S15, the defect with the highest directory matching weight can be selected from the directory matching defects, and the directory that matches this defect is taken as the best matching directory. Specifically, the directory that matches this defect is the directory identified in step S1332 through the NLP matching model matching process, which confirms a matching relationship with the defect. The same directory matching defect can have multiple matching directories; therefore, there can be one or more best matching directories.
[0110] In one possible implementation, in step S15, to fully consider the meaning of use cases and defects in use case defect matching, vector matching is introduced, and to ensure the accuracy of matching to a certain extent, a secondary matching filtering method is introduced. (Refer to...) Figure 7 In step S15, test case defect matching can be further implemented as follows.
[0111] S151, obtain the vector of each test case in the best matching directory, and obtain the vector of the best candidate defect.
[0112] S152, for each best candidate defect, calculate the matching value between the vector of the best candidate defect and the vector of each test case in the best matching directory, and select the test cases whose matching value satisfies the high matching condition as candidate test cases for the best candidate defect.
[0113] S153, combining the candidate use cases of the best candidate defect and the preset second prompt word, a secondary matching and filtering is performed to obtain the use case defect matching result between each best candidate defect and the candidate use cases of the best candidate defect.
[0114] In step S151, to avoid interference from irrelevant data, the test cases can be preprocessed before word segmentation of the directory tree name. Preprocessing may include data cleaning, standardization, removal of redundant information, and filtering of special symbols. After preprocessing, the test case data may include the directory name, test case name, preconditions, test case content, expected test case results, test case notes and prompts, and a summary of the test case content.
[0115] Thus, after removing duplicate data, interfering symbols, and other distracting data, all test cases in the best-matching directory are obtained. Then, using any vectorization algorithm, each test case in the best-matching directory is vectorized to obtain a test case vector. The vector of the best candidate defect can be directly extracted from the defect database.
[0116] For step S152, you can either iterate through the matching calculations one by one or use the nearest neighbor search method to perform matching in a concentrated manner.
[0117] Nearest neighbor search refers to finding the element with the smallest distance to a given query term within a defined distance metric and a search space. It can be represented as NN(q) = argmin x∈X dist(q,x) is the distance between query term q and element x in the search space.
[0118] Therefore, we can search for the defect with the smallest distance to the vector of each test case in the best-matching directory from the vector set (search space) of all best candidate defects. In this case, the vector of the test case is the query term. Conversely, we can search for the test case with the smallest distance to the vector of each best candidate defect from the vector set of all test case vectors in the best-matching directory. In this case, the vector set of the test case vectors is the search space, and the vector of the best candidate defect is the query term.
[0119] Here, the distance is the matching value; the smaller the distance, the greater the matching degree. The method for calculating the distance can be flexibly set; for example, it can be cosine distance or Euclidean distance. In this embodiment, no specific limitation is made.
[0120] For step S153, the second prompt word is a template describing the matching problem between test cases and defects. It can be in the form of "Does defect i match test case i?" or "Does defect bug_j / bug_k, which is similar to defect i, belong to test case i?" In this embodiment, the second prompt word is not limited.
[0121] In one possible implementation, refer to Figure 8 Step S153 can be further implemented as follows.
[0122] S1531, for each best candidate defect, fill the second prompt word with the best candidate defect and a candidate use case of the best candidate defect in turn to obtain the use case defect matching problem.
[0123] It should be understood that for each best candidate defect, the number of candidate use cases corresponds to the number of use case defect matching problems. For example, if the best candidate defect has 3 candidate use cases, then the number of use case defect matching problems for that best candidate defect is also 3. Use case defect matching problems can take the form of "Is defect i equal to test case M?" or "Is defect j or defect k, which is similar to defect i, equal to test case M?"
[0124] S1532: Input each use case defect matching problem into a pre-trained NLP matching model, perform matching processing, and obtain the matching results.
[0125] S1533, when the matching result indicates that a matching relationship exists, the best candidate defect in the use case defect matching problem is taken as the matching defect of the candidate use case in the use case defect matching problem.
[0126] In this way, matching defects that match each candidate use case can be quickly and accurately identified. Furthermore, the matching accuracy can be further improved through secondary filtering.
[0127] In the above method, vector matching is introduced into test case defect matching through steps S151 to S153 and their sub-steps. This allows for better handling of the feature space between test cases and defects, improving matching accuracy. Furthermore, based on the results of vector matching, an NLP model is used for secondary matching and filtering. This significantly improves the accuracy of test case defect matching.
[0128] The data matching method described above introduces maximum word segmentation matching, directory matching weight calculation, secondary matching filtering, and considers the contribution rate of matching at different directory levels. First, test case directories are matched with defects. Then, based on the results of directory defect matching, vector matching and secondary matching filtering are introduced to perform test case defect matching. In this way, through hierarchical matching, the characteristics of test cases and defects are fully matched, thereby greatly improving the accuracy of test case defect matching. Furthermore, the matching process is fully automated, significantly improving matching efficiency.
[0129] It should be noted that the data matching method provided in this application is not limited to matching use cases and defects. In scenarios where other two sets of data are matched, the data matching method provided in this application can still be adapted and used. In different scenarios, variable data items such as the first prompt word and the second prompt word can be adaptively adjusted according to the actual situation and needs.
[0130] Based on the same inventive concept as the data matching method described above, in one possible implementation, a data matching device 30 is also provided, which can be applied to... Figure 1 Matching device 20 in the middle. (Refer to...) Figure 9 The data matching device 30 may include a word segmentation module 301, a directory defect matching module 302, and a use case defect matching module 303.
[0131] The word segmentation module 301 is used to obtain the directory tree name of the test cases, segment the directory tree name into words, and obtain a directory word set. The directory tree name includes the names of each level of the test cases' directories.
[0132] The directory defect matching module 302 is used to match the directory of the test case with the defects in the preset defect library based on the directory word segmentation set, so as to obtain the directory matching defect of the test case.
[0133] The test case defect matching module 303 is used to select the best matching directory from the directories that match the directory defect, take the matching defect of the best matching directory as the best candidate defect, and match the test cases under the best matching directory with the best candidate defect to obtain the test case defect matching result.
[0134] In the aforementioned data matching device 30, through the coordinated action of the word segmentation module 301, the directory defect matching module 302, and the test case defect matching module 303, a hierarchical matching method is adopted, which first matches the test case directory with defects, and then matches the test cases under the directory with defects. This greatly improves the accuracy of test case defect matching. Furthermore, the matching process is fully automated, which significantly enhances matching efficiency.
[0135] Specific limitations regarding the data matching device 30 can be found in the limitations of the data matching method described above, and will not be repeated here. Each module in the aforementioned data matching device 30 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the electronic device 40 in hardware form, or stored in the memory of the electronic device 40 in software form, so that the processor can call and execute the operations corresponding to each module.
[0136] In one embodiment, an electronic device 40 is provided, the internal structure of which can be shown in the figure below. Figure 10 As shown, the electronic device 40 includes a processor, memory, communication interface, and input device connected via a system bus. The processor of the electronic device 40 provides computing and control capabilities. The memory of the electronic device 40 includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the electronic device 40 is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, near-field communication (NFC), or other technologies. When the computer program is executed by the processor, it implements the data matching method provided in the above embodiments.
[0137] Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the electronic device 40 to which the present invention is applied. The specific electronic device 40 may include, but is not limited to, the following: Figure 10 The diagram shows more or fewer components, or combinations of certain components, or different component arrangements.
[0138] In one embodiment, the data matching device 30 for deployed devices provided by the present invention can be implemented as a computer program, which can be implemented in the form of, for example... Figure 10 The electronic device 40 shown operates on this device. The memory of the electronic device 40 can store various program modules that make up the data matching device 30, for example, Figure 9 The shown modules are word segmentation module 301, directory defect matching module 302, and use case defect matching module 303. The computer program comprised of these modules causes the processor to execute the steps of the data matching method described in this specification.
[0139] For example, Figure 10 The electronic device 40 shown can be used as follows Figure 9 The word segmentation module 301 in the data matching device 30 shown executes step S11. The electronic device 40 can execute step S13 through the directory defect matching module 302. The electronic device 40 can execute step S15 through the use case defect matching module 303.
[0140] In one embodiment, an electronic device 40 is provided, including a processor and a memory for storing one or more programs. When the processor executes one or more programs, the following steps are performed: obtaining the directory tree name of a test case; segmenting the directory tree name into words to obtain a directory segmentation set; matching the directory of the test case with defects in a preset defect library based on the directory segmentation set to obtain the directory matching defect of the test case; selecting the best matching directory from the directories that match the directory matching defect; using the matching defect of the best matching directory as the best candidate defect; and matching the test cases under the best matching directory with the best candidate defect to obtain the test case defect matching result.
[0141] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it performs the following steps: obtaining the directory tree name of the test cases; segmenting the directory tree name into words to obtain a directory segmentation set; matching the directory of the test cases with defects in a preset defect library based on the directory segmentation set to obtain the directory matching defects of the test cases; selecting the best matching directory from the directories that match the directory matching defects; taking the matching defects of the best matching directory as the best candidate defects; and matching the test cases under the best matching directory with the best candidate defects to obtain the test case defect matching result.
[0142] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A data matching method, characterized in that, The method includes: Obtain the directory tree name of the test case, and perform word segmentation on the directory tree name to obtain a directory word set; wherein, the directory tree name includes the names of each level of the test case's directory; Based on the directory word segmentation set, the directory of the test case is matched with the defects in the preset defect library to obtain the directory matching defects of the test case; From the directory matching defects, the defect with the highest corresponding directory matching weight is selected as the best candidate defect, and the directory that matches the best candidate defect is selected as the best matching directory. The test cases under the best matching directory are matched with the best candidate defect to obtain the test case defect matching result. The step of matching the directory of the test cases with defects in a preset defect library based on the directory word segmentation set to obtain the directory-matched defects of the test cases includes: For each preset defect, based on the directory word segmentation set, the defect word segmentation set of the defect is subjected to maximum word segmentation matching to obtain the word segmentation matching result between the directory word segmentation set and the defect word segmentation set; the word segmentation matching result includes the word segmentation intersection and word segmentation union between the directory word segmentation set and the defect word segmentation set; Based on the intersection and union of the word segments, the Jaccard distance for each directory level is calculated, and based on the Jaccard distance for each directory level, the directory matching weight between the directory tree of the test case and each defect is calculated. Defects that meet the high matching criteria in the directory matching weight are selected as candidate defects. A second matching and filtering process is then performed, combining the candidate defects, the directories at each level, and the preset first prompt word, to obtain the directory matching defects of the test case.
2. The data matching method according to claim 1, characterized in that, The step of calculating the directory matching weight between the directory tree of the test cases and each defect includes: Calculate the character length of each word in the union of the word segments, and add the cubes of the character lengths of the words in the union of the same directory level to obtain the union weight value of each directory level. For each word in the union of word segments, if the word exists in the intersection of word segments, the cube of the character length of the word segment is added to the intersection weight value of the directory level to which the word segment belongs; For each directory level, the intersection weight value of the directory levels is divided by the union weight value to obtain the Jaccard distance of the directory level, and the product of the Jaccard distance and the preset weighting coefficient corresponding to the directory level is calculated to obtain the matching weight of the directory level. Calculate the sum of the matching weights of all the directory levels to obtain the directory matching weight between the directory tree of the test case and the defect.
3. The data matching method according to claim 1, characterized in that, The first prompt word is a template for matching test case directories with defects; The step of combining the candidate defects, the directories at each level, and the preset first prompt words to perform secondary matching and filtering to obtain the directory matching defects of the test cases includes: For each candidate defect, a directory of the test case and the candidate defect are sequentially filled into the first prompt word to obtain multiple directory defect matching questions; Each of the aforementioned directory defect matching problems is input into a pre-trained NLP matching model for matching processing to obtain matching relationships; When the matching relationship exists, the candidate defects in the directory defect matching problem are taken as the directory matching defects of the directory in the directory defect matching problem.
4. The data matching method according to claim 1, characterized in that, The step of performing maximum word segmentation matching on the defect word segmentation set based on the directory word segmentation set to obtain the word segmentation matching result between the directory word segmentation set and the defect word segmentation set includes: A bidirectional maximum matching algorithm is used to match the directory word segmentation set with the defect word segmentation set to obtain the word segmentation matching result between the directory word segmentation set and the defect word segmentation set.
5. The data matching method according to claim 1, characterized in that, The step of matching test cases in the best matching directory with the best candidate defects to obtain test case defect matching results includes: Obtain the vector of each test case in the best matching directory, and obtain the vector of the best candidate defect; For each of the best candidate defects, calculate the matching value between the vector of the best candidate defect and the vector of each test case in the best matching directory, and select the test cases whose matching values satisfy the high matching condition as candidate test cases for the best candidate defects. By combining the candidate use cases of the best candidate defect with the preset second prompt word, a secondary matching and filtering is performed to obtain the use case defect matching result between each best candidate defect and the candidate use cases of the best candidate defect.
6. The data matching method according to claim 5, characterized in that, The second prompt is a template describing the matching problem between test cases and defects; The step of combining the candidate use cases of the best candidate defect with the preset second prompt word to perform secondary matching and filtering, and obtaining the use case defect matching result between each best candidate defect and the candidate use cases of the best candidate defect, includes: For each of the best candidate defects, the best candidate defect and a candidate use case of the best candidate defect are sequentially filled into the second prompt word to obtain the use case defect matching problem; Each of the aforementioned use case defect matching problems is input into a pre-trained NLP matching model for matching processing to obtain matching results; When the matching result indicates that a matching relationship exists, the best candidate defect in the use case defect matching problem is taken as the matching defect of the candidate use case in the use case defect matching problem.
7. A data matching device, characterized in that, It includes a word segmentation module, a directory defect matching module, and a use case defect matching module; The word segmentation module is used to obtain the directory tree name of the test case, segment the directory tree name into words, and obtain a directory word segmentation set; wherein, the directory tree name includes the names of each level of the test case; The directory defect matching module is used to match the directory of the test case with defects in the preset defect library based on the directory word segmentation set, so as to obtain the directory matching defect of the test case. The test case defect matching module is used to select the defect with the highest corresponding directory matching weight from the directory matching defects as the best candidate defect, and to select the directory that matches the best candidate defect as the best matching directory. The test cases under the best matching directory are then matched with the best candidate defect to obtain the test case defect matching result. The directory defect matching module is specifically used to perform maximum word segmentation matching on the defect word segmentation set based on the directory word segmentation set for each preset defect, to obtain the word segmentation matching result between the directory word segmentation set and the defect word segmentation set; the word segmentation matching result includes the word segmentation intersection and word segmentation union between the directory word segmentation set and the defect word segmentation set; based on the word segmentation intersection and word segmentation union, the Jaccard distance of each directory level is calculated, and based on the Jaccard distance of each directory level, the directory matching weight between the directory tree of the test case and each defect is calculated; defects whose directory matching weight satisfies the high matching condition are selected as candidate defects, and a secondary matching and filtering is performed in combination with the candidate defects, the directories at each level and the preset first prompt word to obtain the directory matching defects of the test case.
8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor to implement the data matching method as described in any one of claims 1 to 6.
9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data matching method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
File storage method and device
CN111639056A
Defect Classification And Association In A Software Development Environment
US20150378874A1