Training method and device for test case generation model

By splitting and comparing test cases and requirements description data, training data fragments are generated and used to train large language models, the problem of generating high-quality test cases is solved and the model generation ability is significantly improved.

CN118964206APending Publication Date: 2024-11-15ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411131839.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

When generating test cases, existing large language models are difficult to output high-quality test cases, and lack effective training data and mapping relationships, resulting in poor generation results.

Method used

By obtaining multiple test cases and requirements description data, splitting data fragments, performing title comparison and filtering, generating training data fragments, and using them as training samples and labels for pre-trained models, fine-tuning the model to improve test case generation capabilities .

Benefits of technology

It significantly improves the accuracy and quality of large language models when generating test cases, allowing them to better generate high-quality test cases based on demand description data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964206A_ABST
    Figure CN118964206A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a training method and device of a test case generation model, and the training method of the test case generation model comprises the steps: obtaining a plurality of test cases and demand description data corresponding to each test case, splitting the demand description data, obtaining each data segment corresponding to each test case, comparing a first title sequence composed of sub-case titles in each test case with a second title sequence composed of sub-fragment titles in each data fragment, and screening the data fragments corresponding to candidate fragment titles based on title levels of the candidate fragment titles obtained by comparison to obtain training data fragments, and training the pre-training model to obtain a test case generation model by taking the training data fragment as a training sample and taking each test case as a sample label.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to the field of data processing technology, and in particular to a training method and device for a test case generation model. Background Art

[0002] With the rapid development of big model technology, many tasks are automatically generated through big language models. In the field of test analysis, using big language models to generate test cases is an important application direction. Test cases refer to the steps for testing a specific product or requirement, reflecting the test plan, method, technology and strategy. The content of the test case specifically includes test objectives, input data, test steps, expected results, etc. In this case, how to use big language models to generate high-quality test cases has become a key focus in big model application scenarios. Summary of the invention

[0003] One or more embodiments of the present specification provide a method for training a test case generation model, comprising: obtaining multiple test cases and requirement description data corresponding to each test case. Splitting the requirement description data to obtain each data segment corresponding to each test case. Comparing a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment. Screening the data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by comparison to obtain training data segments. Using the training data segments as training samples and each test case as a sample label, training a pre-trained model to obtain a test case generation model.

[0004] One or more embodiments of the present specification provide a training device for a test case generation model, including: a data acquisition module, configured to acquire multiple test cases and requirement description data corresponding to each test case. A data splitting module, configured to split the requirement description data to obtain each data segment corresponding to each test case. A comparison module, configured to compare a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment. A screening module, configured to screen the data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by the comparison to obtain training data segments. A model training module, configured to train a pre-trained model using the training data segments as training samples and each test case as a sample label to obtain a test case generation model.

[0005] One or more embodiments of the present specification provide a training device for a test case generation model, comprising: a processor; and a memory configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor: obtains multiple test cases and requirement description data corresponding to each test case. Splits the requirement description data to obtain each data segment corresponding to each test case. Compares a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment. Based on the title hierarchy of the candidate segment titles obtained by the comparison, the data segments corresponding to the candidate segment titles are screened to obtain training data segments. Using the training data segments as training samples and each test case as a sample label, the pre-trained model is trained to obtain a test case generation model.

[0006] One or more embodiments of the present specification provide a computer-readable storage medium for storing computer-executable instructions, which implement the following process when executed: obtain multiple test cases and requirement description data corresponding to each test case. Split the requirement description data to obtain each data segment corresponding to each test case. Compare a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment. Filter the data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by the comparison to obtain training data segments. Use the training data segments as training samples and each test case as a sample label to train the pre-trained model to obtain a test case generation model. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] In order to more clearly illustrate one or more embodiments of the present specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present specification. For users of ordinary skills in the art, other drawings can be obtained based on these drawings without creative labor.

[0008] Figure 1 A schematic diagram of an implementation environment for a training method of a test case generation model provided in one or more embodiments of this specification;

[0009] Figure 2 A processing flow chart of a training method for a test case generation model provided in one or more embodiments of this specification;

[0010] Figure 3 A title comparison diagram provided for one or more embodiments of this specification;

[0011] Figure 4 A target data segment comparison schematic diagram provided for one or more embodiments of this specification;

[0012] Figure 5 A processing flow chart of a training method for a test case generation model applied to a test case generation scenario provided by one or more embodiments of this specification;

[0013] Figure 6 A schematic diagram of an embodiment of a training device for a test case generation model provided by one or more embodiments of this specification;

[0014] Figure 7 A schematic diagram of the structure of a training device for a test case generation model provided in one or more embodiments of this specification. DETAILED DESCRIPTION

[0015] In order to enable users in the technical field to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technical users in this field without creative work should fall within the scope of protection of this document.

[0016] The training method of the test case generation model provided in one or more embodiments of this embodiment can be applied to the implementation environment of the training of the test case generation model, referring to Figure 1 , the implementation environment at least includes: a pre-trained model 101 for generating test cases, a training system 102 for training the pre-trained model, and in addition, the implementation environment may also include a database 103 for storing demand description data, and a case library 104 for storing test cases;

[0017] In this implementation environment, the training system 102 obtains multiple test cases from the use case library 104 and the requirement description data corresponding to each test case from the database 103, splits the requirement description data to obtain each data segment corresponding to each test case, compares the first title sequence composed of the sub-use case titles in each test case with the second title sequence composed of the sub-segment titles in each data segment, screens the data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by the comparison, obtains training data segments, uses the training data segments as training samples and each test case as a sample label, and trains the pre-trained model 101 to obtain a test case generation model that can generate corresponding test cases for the input requirement description data.

[0018] One or more embodiments of a training method for a test case generation model provided in this specification are as follows:

[0019] Reference Figure 2 The training method for the test case generation model provided in this embodiment specifically includes steps S202 to S210.

[0020] Step S202, obtaining multiple test cases and requirement description data corresponding to each test case.

[0021] In this embodiment, the test case is a series of operating steps and expected results designed to verify whether a software program or system can work normally. The test case includes a set of detailed test guidelines for a specific aspect of the software; the requirement description data refers to data that describes the product's objectives, functions, features, interfaces, performance and other requirements. Optionally, the requirement description data includes a product requirement document (PRD, Product Requirements Document).

[0022] In practical applications, in the field of test analysis, large language models can be used to generate test cases. In order to improve the effect of large language models in generating test cases, requirement description data and corresponding test cases can be added to the training corpus when fine-tuning the large language model to enhance the model's ability to generate test cases.

[0023] In order to prepare the training corpus of the requirement description data and the corresponding test cases, it is necessary to determine the mapping relationship between the requirement description data and the test cases. This embodiment can split the requirement description data into data segments based on the index list of the requirement description data, and establish a mapping relationship between the data segments and the test cases. In this way, the data segments and test cases with the mapping relationship are used as the large model fine-tuning training corpus and the large language model is fine-tuned, thereby enhancing the ability of the large language model to generate test cases based on the requirement description data, so that the test cases it outputs have a higher accuracy rate.

[0024] During the specific execution process, in order to establish a mapping relationship between data segments and test cases, the requirement description data is first obtained from a database storing the requirement description data, and the test cases are obtained from a use case library storing the test cases. In order to ensure the validity of the data, the test cases can be labeled with the data addresses of the requirement description data as labels, so as to make a coarse-grained association with the test cases from the dimension of the requirement description data. In an optional implementation provided in this embodiment, the test cases and the requirement description data are obtained in the following manner: obtain the use case labels obtained by respectively labeling the multiple test cases, and the requirement description data corresponding to the use case labels.

[0025] Specifically, multiple test cases are labeled according to the data addresses of the requirement description data to obtain the use case labels and the requirement description data corresponding to the use case labels. For example, there is a PRD, and then the test cases required to complete the PRD are manually identified, and these test cases are labeled with PRD links.

[0026] Step S204, splitting the requirement description data to obtain data segments corresponding to the test cases.

[0027] After obtaining the multiple test cases and the requirement description data corresponding to each test case, in this step, the requirement description data is split according to the index list of the requirement description data to obtain multiple data segments, and the data segments corresponding to each test case are determined according to the use case label. The index list includes the directory of the requirement description data. For example, according to the directory of the requirement description data, the requirement description data is split into multiple data segments, and the data segments corresponding to each test case are determined according to the data addresses of the data segments.

[0028] During the specific execution process, since a requirement description data may be tested by multiple test cases, the requirement description data is split based on the index list of the requirement description data to obtain data segments corresponding to each test case. In an optional implementation manner provided in this embodiment, the requirement description data is split in the following manner:

[0029] Determine the index list contained in the requirement description data;

[0030] The demand description data is split according to the index list to obtain the data segments.

[0031] Specifically, the requirement description data may be split according to the directory of the requirement description data to obtain data fragments corresponding to the test case.

[0032] Step S206, comparing the first title sequence consisting of the sub-case titles in each test case with the second title sequence consisting of the sub-segment titles in each data segment.

[0033] After the requirement description data is split as mentioned above and the data segments corresponding to the test cases are obtained, taking a data segment as an example, a data segment is divided into multiple sub-data segments by multiple sub-segment titles, and a test case is also divided into multiple sub-test cases by multiple sub-case titles. By comparing the first title sequence composed of the sub-case titles with the second title sequence composed of the sub-segment titles, the correspondence between the test case and the data segment can be determined, thereby finding the data segment corresponding to the test case.

[0034] The first title sequence refers to a title sequence composed of the titles of each sub-case in the test case. Since there is a title hierarchy between the sub-case titles, the first title sequence can be composed according to the title hierarchy of each sub-case title. For example, the first-level title of test case 1 is A, the second-level title is B, and the third-level title is C. Then the first title sequence of test case 1 can be A / B / C; the second title sequence refers to a title sequence composed of the titles of each sub-segment in the data segment. Since there is a title hierarchy between the sub-segment titles, the second title sequence can be composed according to the title hierarchy of each sub-segment title. For example, the first-level title of data segment 1 is A, the second-level title is C, and the third-level title is D. Then the second title sequence of data segment 1 can be A / C / D.

[0035] In the specific implementation process, in the process of comparing the first title sequence with the second title sequence, a random comparison may be performed. In an optional implementation provided by this embodiment, the first title sequence composed of sub-case titles in each test case and the second title sequence composed of sub-segment titles in each data segment are compared in the following manner:

[0036] Performing a title comparison between each sub-use case title in the first title sequence and each sub-segment title in the second title sequence;

[0037] If any sub-segment title among the sub-segment titles is consistent with any sub-use case title among the sub-use case titles, the any sub-segment title is used as the candidate segment title.

[0038] For example, a title comparison is performed between the first title sequence A / B / C of test case 1 and the second title sequence A / C / D of data segment 1, a title comparison is performed between the first title sequence A / B / C of test case 1 and the second title sequence B / C / D of data segment 2, and a title comparison is performed between the first title sequence A / B / C of test case 1 and the second title sequence D / E / F of data segment 3. Since the first-level title A and the second-level title C in data segment 1 are consistent with the first-level title A and the third-level title C of test case 1, the first-level title A and the second-level title C of data segment 1 are used as candidate segment titles. Since the first-level title B and the second-level title C in data segment 2 are consistent with the second-level title B and the third-level title C of test case 1, the first-level title B and the second-level title C of data segment 2 are used as candidate segment titles. Since there is no title consistent with test case 1 in data segment 3, data segment 3 cannot be used as a candidate segment.

[0039] It should be noted that, in the process of comparing the first title sequence with the second title sequence, title comparison can also be performed based on the sub-case titles of each level in the first title sequence to obtain candidate segment titles. In an optional implementation provided by this embodiment, the first title sequence composed of sub-case titles in each test case is compared with the second title sequence composed of sub-segment titles in each data segment in the following manner:

[0040] Based on the title level of each sub-use case title in the first title sequence, performing a title comparison between each sub-use case title and each sub-segment title;

[0041] The sub-segment title among the sub-segment titles that is consistent with the sub-use case title of any level among the sub-use case titles is used as the candidate segment title.

[0042] For example, Figure 3 As shown in the title comparison diagram, taking test case 2 with the first title sequence A / D as the benchmark, firstly, a title comparison is performed based on the first-level title A of test case 2 to obtain data segment 3 with the second title sequence A / B including title A, and then a title comparison is performed based on the second-level title D of test case 2 to obtain data segment 4 with the second title sequence C / D including title D. Therefore, sub-segment title A of data segment 3 is used as a candidate segment title, and sub-segment title D of data segment 4 is used as a candidate segment title. In addition, there is a case where the candidate segment title obtained after comparing the first segment sequence with the second segment sequence is empty. In this case, it indicates that there is no sub-segment title that is consistent with any sub-use case title in the first segment sequence. In view of this, further comparison can be performed in the sub-segment text to find a text field that is consistent with any sub-use case title in the first segment text. In an optional implementation provided by this embodiment, if the candidate segment title obtained after the first segment sequence composed of the sub-use case titles in the test cases and the second segment title sequence composed of the sub-segment titles in the data segments is empty, perform the following operations:

[0043] Identify each sub-segment text under the sub-segment title, and compose a sub-segment text sequence based on the text level of each sub-segment text;

[0044] The first title sequence is compared with the sub-segment text sequence to obtain a candidate sub-segment text.

[0045] For example, taking a data segment as an example, a data segment is divided into multiple sub-data segments by multiple sub-segment titles, each sub-data segment may include a sub-segment title and a sub-segment text, by identifying each sub-segment text under each sub-segment title, a sub-segment text sequence is formed based on the text level of each sub-segment text, the first title sequence is compared with the sub-segment text sequence, and the sub-segment text containing any sub-use case title in the first title sequence is used as a candidate sub-segment text.

[0046] In specific implementation, in order to improve the accuracy of the subsequent comparison between the first title sequence and the sub-segment text sequence, in the process of identifying the sub-segment text under the sub-segment title, for the table data existing in the sub-segment text, the text data contained in the table data can be extracted, and the table data can be replaced with the text data. Specifically, it can be first identified whether there is a header in the table data. If there is a header, the header and the cells corresponding to each remaining row of data are spliced ​​to obtain the text data. If there is no header, each row of data in the table is spliced ​​to obtain the text data. If merged cells are involved, the common data of the row where the merged cells are located needs to be automatically filled in and spliced. In addition, for specific nouns contained in the sub-segment text, the glossary of the specific noun can be queried and the glossary can be written into the sub-segment text.

[0047] Furthermore, in the process of comparing the first title sequence with the sub-segment text sequence, it can be detected whether the text field of each segment text contains a candidate text field that is consistent with any sub-use case title in the first title sequence; if so, the segment text where the candidate text field is located is used as the candidate segment text; if not, no processing is performed.

[0048] For example, the first title sequence of test case 1 is A / B / C, and the sub-segment text sequence 1 is XXA / XBX / XXX, where the first-level sub-segment text XXA contains the text field "A" that is consistent with the first-level sub-case title in the first title sequence, then the sub-segment text XXA is used as the candidate sub-segment text.

[0049] Step S208, screening the data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by comparison to obtain training data segments.

[0050] After comparing the first title sequence with the second title sequence to obtain the candidate segment titles, in this step, in order to further improve the accuracy of the mapping between test cases and data segments, the data segments corresponding to the candidate segment titles are screened based on the title levels of the candidate segment titles, so as to use the candidate data segments corresponding to the sub-segment titles containing the target level as training data segments.

[0051] In the specific execution process, there may be multiple candidate segment titles obtained based on the comparison between the first title sequence and the second title sequence. For example, the test case 1 with the first title sequence of A / D can be successfully compared with the data segment 1 with the second title sequence of A / B and the data segment 2 with the second title sequence of C / D. At this time, the candidate segment title in the data segment 1 is A, and the candidate segment title in the data segment 2 is D. Further, based on the corresponding title levels of the candidate segment titles A and D in the test case 1, the data segment 1 and the data segment 2 can be screened to obtain the training data segment corresponding to the test case 1. In an optional implementation manner provided by this embodiment, the data segment corresponding to the candidate segment title is screened based on the title level of the candidate segment title obtained by comparison to obtain the training data segment:

[0052] Determining a title level of the candidate segment title in the first title sequence;

[0053] The candidate data segment where the candidate segment title of the target title level is located is used as the training data segment.

[0054] Continuing with the above example, it can be seen that the title levels of candidate segment titles A and D in the first title sequence are respectively the first level and the second level, and the candidate data segment 1 corresponding to the first level candidate segment title A can be used as a training data segment.

[0055] Further, if the number of the candidate data segments is greater than a segment number threshold, based on the number of identical titles of the first title sequence and the third title sequence of the candidate data segments, the training data segments are screened to obtain target data segments. Optionally, using the training data segments as training samples includes: using the target data segments as training samples.

[0056] For example, the candidate data segments corresponding to the sub-use case title A of the first level in the first title sequence A / B / C include data segment 1 and data segment 4. When the segment number threshold is 1, the data of the candidate data segments is greater than the segment number threshold. The number of identical titles between the first title sequence A / B / C and the third title sequence A / C / D of data segment 1 is 2, and the number of identical titles between the first title sequence A / B / C and the third title sequence A / B / C / D of data segment 4 is 3. Data segment 4, which has 3 identical titles, can be used as the target data segment.

[0057] It should be noted that, in the case where the title comparison is performed based on the sub-use case titles of each level in the first title sequence, if at least two candidate fragment titles are obtained through title comparison based on the sub-use case titles of the first level in the first title sequence, that is, the data of the candidate data fragment is greater than the fragment number threshold, then the title comparison can be performed on the sub-use case titles of other levels in the first title sequence according to the title level of the first title sequence until the target data fragment is obtained.

[0058] For example, Figure 4 As shown in the target data segment comparison diagram, taking the first title sequence C / D / E of test case 3 as a benchmark, firstly, a title comparison is performed based on the first-level title C to obtain data segment 5 with a second title sequence of B / C / D / E containing title C, and data segment 6 with a second title sequence of B / C / D / F. Then, data segment 5 and data segment 6 are compared based on the second-level title D. As a result, data segment 5 and data segment 6 also contain the second-level title D. Then, data segment 5 and data segment 6 are compared based on the third-level title E. As a result, data segment 5 contains title E, so data segment 5 is used as the target data segment.

[0059] In addition, in the case where the first title sequence is compared with the sub-segment text sequence to obtain a candidate sub-segment text, this embodiment provides an optional implementation in which a training data segment is selected from the candidate data segment where the candidate sub-segment text is located according to the text level of the candidate sub-segment text.

[0060] For example, the first title sequence of test case 1 is A / B / C, and the sub-segment text sequence 1 is XXA / XBX / XXX, wherein the first-level sub-segment text XXA contains a text field "A" that is consistent with the sub-use case title of the first level in the first title sequence, then the sub-segment text XXA is used as a candidate sub-segment text, and the sub-segment text sequence 2 is XXX / XBX / XXX, wherein the second-level sub-segment text XBX contains a text field "B" that is consistent with the sub-use case title of the second level in the first title sequence, then the sub-segment text XBX is also used as a candidate sub-segment text. At this time, the text field "A" in the candidate sub-segment text XXA corresponds to the sub-use case title of the first level, and the text field "B" in the candidate sub-segment text XBX corresponds to the sub-use case title of the second level, and the candidate data segment corresponding to the sub-segment text sequence 1 where the candidate sub-segment text XXA of the corresponding higher level is located is preferentially selected as the training data segment.

[0061] Furthermore, if the number of the training data segments is greater than a segment number threshold, the training data segments are screened to obtain target data segments based on the number of identical fields between the first title sequence and the candidate segment body.

[0062] For example, the candidate data segments corresponding to the sub-use case title A of the first level in the first title sequence A / B / C include data segment 1 and data segment 4. When the segment number threshold is 1, the data of the candidate data segments is greater than the segment number threshold, the number of identical fields between the first title sequence A / B / C and the segment text AXX / XCX / DXX of data segment 1 is 2, and the number of identical fields between the first title sequence A / B / C and the segment text AXX / BXX / XCX / DXX of data segment 4 is 3. Data segment 4, which has 3 identical titles, can be used as the target data segment.

[0063] Step S210, using the training data segments as training samples and each test case as a sample label, training the pre-trained model to obtain a test case generation model.

[0064] After the data segments corresponding to the candidate segment titles are screened based on the title levels of the candidate segment titles obtained by comparison to obtain the training data segments, in this step, the training data segments are used as training samples and the test cases corresponding to the training data segments are used as sample labels to train the pre-trained model to obtain a test case generation model.

[0065] In this embodiment, in the model training process of the test case generation model, the test case generation model is trained on the basis of a pre-trained model. The pre-trained model refers to a natural language model obtained by pre-training. The pre-trained model can adopt a neural network architecture containing a large number of parameters. The pre-trained model can adopt a pre-trained large language model (Large Language Model, LLM), such as chatGPT (chat Generative Pre-trainedTransformer, generative pre-trained transformation model) and other open source large language models.

[0066] On the basis of the pre-trained model, the pre-trained model is fine-tuned for specific tasks to obtain a corresponding processing model that can handle specific tasks to adapt to specific fields or task requirements. This embodiment further trains the pre-trained model in the field of test case generation to obtain a test case generation model that can generate test cases.

[0067] In the case where the pre-trained model is a large language model, the pre-trained model is trained to obtain a test case generation model by using the training data segments as training samples and the test cases corresponding to the training data segments as sample labels. In an optional implementation manner provided in this embodiment, the pre-trained model is trained in the following manner:

[0068] Inputting the training samples and the training labels into the pre-training model to generate test cases to obtain output test cases;

[0069] A training loss is determined based on the output test case and the training label, and parameters of the pre-trained model are adjusted based on the training loss.

[0070] Specifically, in order to enable the trained test case generation model to acquire the ability to take requirement description data as input and test cases as output, the training data segments are used as training samples, and the test cases corresponding to the training data segments are used as sample labels. The training data segments are input into a pre-trained model to generate test cases to obtain output test cases. The training loss is determined based on the output test cases and the training labels, and the parameters of the pre-trained model are adjusted based on the training loss to obtain a test case generation model.

[0071] It should be noted that in order to improve the training effect of the pre-trained model, each optional implementation method for each step in step S202 to step S210 provided above can be combined and referenced with each other, and this embodiment is not specifically limited here.

[0072] In summary, the training method of the test case generation model provided in the present embodiment obtains multiple test cases and requirement description data corresponding to each test case, splits the requirement description data to obtain each data segment corresponding to each test case, compares a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment, screens the data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by the comparison, obtains training data segments, uses the training data segments as training samples and uses each test case as a sample label, trains a pre-trained model to obtain a test case generation model;

[0073] Furthermore, a title comparison is performed between each sub-case title in the first title sequence and each sub-segment title in the second title sequence. If any sub-segment title in each sub-segment title is consistent with any sub-case title in each sub-case title, any sub-segment title is used as a candidate segment title. By determining the title level of the candidate segment title in the first title sequence, the candidate data segment where the candidate segment title of the target title level is located is used as the training data segment, so as to improve the quality of training samples and the training effect of the pre-trained model, so that the test case generation model obtained through training has the ability to generate test cases with higher quality.

[0074] The following takes the application of a test case generation model training method provided in this embodiment in a test case generation scenario as an example, combined with Figure 5 , the training method of the test case generation model provided in this embodiment is further described, see Figure 5 , a training method for a test case generation model applied to a test case generation scenario specifically includes the following steps.

[0075] Step S502, obtaining multiple test cases and product requirement documents corresponding to each test case.

[0076] Step S504, split the product requirement document according to the catalog of the product requirement document to obtain various data segments.

[0077] Step S506, performing title comparison between each sub-case title in the first title sequence of each test case and each sub-segment title in the second title sequence of each data segment.

[0078] Step S508: If any sub-segment title among the sub-segment titles is consistent with any sub-use case title among the sub-use case titles, any sub-segment title is used as a candidate segment title.

[0079] In addition, if the candidate segment title obtained after performing the title comparison operation on each sub-case title in the first title sequence of each test case and each sub-segment title in the second title sequence of each data segment is empty, identify each sub-segment text under the sub-segment title, and form a sub-segment text sequence based on the text level of each sub-segment text, compare the first title sequence with the sub-segment text sequence, and obtain the candidate sub-segment text.

[0080] Step S510, determining the title level of the candidate segment title in the first title sequence, and taking the candidate data segment where the candidate segment title with the first title level is located as the training data segment.

[0081] In addition, a training data segment is selected from the candidate data segments where the candidate sub-segment body is located according to the body level of the candidate sub-segment body.

[0082] Step S512: if the number of candidate data segments is greater than the segment number threshold, based on the number of identical titles between the first title sequence and the third title sequence of the candidate data segments, the training data segments are screened to obtain target data segments.

[0083] In addition, if the number of training data segments is greater than the segment number threshold, the training data segments are screened to obtain target data segments based on the number of identical fields between the first title sequence and the candidate segment body.

[0084] Step S514, using the target data segment as a training sample and each test case as a sample label, the training sample and the training label are input into the pre-training model to generate a test case to obtain an output test case.

[0085] Step S516, determining the training loss based on the output test case and the training label, and adjusting the parameters of the pre-trained model based on the training loss to obtain a test case generation model.

[0086] An embodiment of a training device for a test case generation model provided in this specification is as follows:

[0087] In the above-mentioned embodiment, a method for training a test case generation model is provided, and correspondingly, a device for training a test case generation model is also provided, which will be described below in conjunction with the accompanying drawings.

[0088] Reference Figure 6 , which shows a schematic diagram of a training device for a test case generation model provided in this embodiment.

[0089] Since the device embodiment corresponds to the method embodiment, the description is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above. The device embodiment described below is only illustrative.

[0090] This embodiment provides a training device for a test case generation model, including:

[0091] The data acquisition module 602 is configured to acquire multiple test cases and requirement description data corresponding to each test case;

[0092] The data splitting module 604 is configured to split the requirement description data to obtain data segments corresponding to the test cases;

[0093] A comparison module 606 is configured to compare a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment;

[0094] A screening module 608 is configured to screen the data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by comparison to obtain training data segments;

[0095] The model training module 610 is configured to train the pre-trained model using the training data segments as training samples and each test case as a sample label to obtain a test case generation model.

[0096] An embodiment of a training device for a test case generation model provided in this specification is as follows:

[0097] Corresponding to the training method of a test case generation model described above, based on the same technical concept, one or more embodiments of this specification also provide a training device for a test case generation model, and the training device for the test case generation model is used to execute the training method for the test case generation model provided above. Figure 7 A schematic diagram of the structure of a training device for a test case generation model provided in one or more embodiments of this specification.

[0098] This embodiment provides a test case generation model training device, including:

[0099] like Figure 7 As shown, the training device of the test case generation model may have relatively large differences due to different configurations or performances, and may include one or more processors 701 and memory 702, and one or more storage applications or data may be stored in the memory 702. Among them, the memory 702 may be a short-term storage or a persistent storage. The application stored in the memory 702 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the training device of the test case generation model. Further, the processor 701 may be configured to communicate with the memory 702, and execute a series of computer executable instructions in the memory 702 on the training device of the test case generation model. The training device of the test case generation model may also include one or more power supplies 703, one or more wired or wireless network interfaces 704, one or more input / output interfaces 705, one or more keyboards 706, etc.

[0100] In a specific embodiment, the training device for the test case generation model includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the training device for the test case generation model, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following:

[0101] Obtain multiple test cases and the requirement description data corresponding to each test case;

[0102] Splitting the requirement description data to obtain data segments corresponding to the test cases;

[0103] Comparing a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment;

[0104] Based on the title levels of the candidate segment titles obtained by comparison, the data segments corresponding to the candidate segment titles are screened to obtain training data segments;

[0105] The training data segments are used as training samples and the test cases are used as sample labels to train the pre-trained model to obtain a test case generation model.

[0106] An embodiment of a computer-readable storage medium provided in this specification is as follows:

[0107] Corresponding to the training method of a test case generation model described above, based on the same technical concept, one or more embodiments of this specification also provide a computer-readable storage medium.

[0108] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, and the computer-executable instructions implement the following process when executed:

[0109] Obtain multiple test cases and the requirement description data corresponding to each test case;

[0110] Splitting the requirement description data to obtain data segments corresponding to the test cases;

[0111] Comparing a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment;

[0112] Based on the title levels of the candidate segment titles obtained by comparison, the data segments corresponding to the candidate segment titles are screened to obtain training data segments;

[0113] The training data segments are used as training samples and the test cases are used as sample labels to train the pre-trained model to obtain a test case generation model.

[0114] It should be noted that the embodiment of a computer-readable storage medium in this specification and the embodiment of a training method for a test case generation model in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding method mentioned above, and the repeated parts will not be repeated.

[0115] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments. For example, the device embodiment, equipment embodiment and computer-readable storage medium embodiment are similar to the method embodiment, so the description is relatively simple. To read the relevant contents in the device embodiment, equipment embodiment and computer-readable storage medium embodiment, please refer to the partial description of the method embodiment.

[0116] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0117] In the 1930s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many of today's method flow improvements can be regarded as direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. The designer can "integrate" a digital system on a PLD by programming it himself, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs. The original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Technical users in this field should also be aware that only by slightly programming the method flow in the above-mentioned hardware description languages ​​and programming it into the integrated circuit, the hardware circuit that implements the logic method flow can be easily obtained.

[0118] The controller can be implemented in any suitable manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Users of the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0119] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by commodities with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0120] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0121] It should be understood by technical users in this field that one or more embodiments of this specification may be provided as a method, system or computer program commodity. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program commodity implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0122] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0123] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0124] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0125] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0126] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0127] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0128] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0129] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0130] The above description is only an embodiment of this document and is not intended to limit this document. For users of this technical field, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.

Claims

1. A training method for a test case generation model, comprising: Obtain multiple test cases and the requirement description data corresponding to each test case; Splitting the requirement description data to obtain data segments corresponding to the test cases; Comparing a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment; Based on the title levels of the candidate segment titles obtained by comparison, the data segments corresponding to the candidate segment titles are screened to obtain training data segments; The training data segments are used as training samples and the test cases are used as sample labels to train the pre-trained model to obtain a test case generation model.

2. The training method for the test case generation model according to claim 1, wherein the comparing the first title sequence composed of the sub-case titles in each of the test cases with the second title sequence composed of the sub-segment titles in each of the data segments comprises: Performing a title comparison between each sub-use case title in the first title sequence and each sub-segment title in the second title sequence; If any sub-segment title among the sub-segment titles is consistent with any sub-use case title among the sub-use case titles, the any sub-segment title is used as the candidate segment title.

3. The training method for the test case generation model according to claim 2, wherein the step of screening the data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by comparison to obtain the training data segments comprises: Determine the title level of the candidate segment title in the first title sequence; The candidate data segment where the candidate segment title of the target title level is located is used as the training data segment.

4. The training method for the test case generation model according to claim 3, after the sub-step of using the data segments corresponding to the candidate segment titles of the target title level as the training data segments is executed, it also includes: If the number of the candidate data segments is greater than the segment number threshold, based on the number of identical titles of the first title sequence and the third title sequence of the candidate data segments, the training data segments are screened to obtain target data segments; Correspondingly, taking the training data segment as a training sample includes: taking the target data segment as a training sample.

5. According to the training method of the test case generation model of claim 1, if the candidate segment title obtained after performing the title comparison operation of the first title sequence composed of the sub-case titles in each test case and the second title sequence composed of the sub-segment titles in each data segment is empty, perform the following operation: Identify each sub-segment text under the sub-segment title, and compose a sub-segment text sequence based on the text level of each sub-segment text; The first title sequence is compared with the sub-segment text sequence to obtain a candidate sub-segment text.

6. The test case generation model training method according to claim 5, wherein the identifying the text of each segment under the sub-segment title comprises: Identifying tabular data and specific nouns contained in the body of each sub-segment; The text data contained in the table data is extracted according to a preset text extraction rule and the table data is replaced with the text data, and the glossary of the specific noun is searched and the glossary is written into the text of each sub-segment.

7. The test case generation model training method according to claim 5, wherein comparing the first title sequence with the sub-segment text sequence to obtain a candidate sub-segment text comprises: Detecting whether the text field of each sub-segment text contains a candidate text field that is consistent with any sub-use case title in the first title sequence; If so, the sub-segment text where the candidate text field is located is used as the candidate sub-segment text.

8. The method for training a test case generation model according to claim 7, after the operation of taking the segment text where the candidate text field is located as the candidate segment text is performed, further comprising: Selecting a training data segment from the candidate data segment where the candidate sub-segment body is located according to the body level of the candidate sub-segment body; If the number of the training data segments is greater than the segment number threshold, the training data segments are screened to obtain target data segments based on the number of identical fields between the first title sequence and the candidate segment body.

9. According to the test case generation model training method of claim 1, the training of the pre-trained model comprises: Inputting the training samples and the training labels into the pre-training model to generate test cases to obtain output test cases; A training loss is determined based on the output test case and the training label, and parameters of the pre-trained model are adjusted based on the training loss.

10. The training method for a test case generation model according to claim 1, wherein the step of obtaining a plurality of test cases and requirement description data corresponding to each test case comprises: Obtaining use case labels obtained by respectively labeling the multiple test cases, and the requirement description data corresponding to the use case labels; Accordingly, the step of splitting the requirement description data to obtain the data segments corresponding to the test cases includes: The requirement description data are split to obtain multiple data segments, and the data segments corresponding to the test cases are determined according to the use case labels.

11. The training method for a test case generation model according to claim 1, wherein the step of splitting the requirement description data to obtain the data segments corresponding to the test cases comprises: Determine the index list contained in the requirement description data; The demand description data is split according to the index list to obtain the data segments.

12. A training device for a test case generation model, comprising: A data acquisition module is configured to acquire multiple test cases and requirement description data corresponding to each test case; A data splitting module is configured to split the requirement description data to obtain data segments corresponding to each test case; A comparison module, configured to compare a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment; A screening module is configured to screen data segments corresponding to the candidate segment titles based on the title levels of the candidate segment titles obtained by comparison, so as to obtain training data segments; The model training module is configured to train the pre-trained model using the training data segments as training samples and the test cases as sample labels to obtain a test case generation model.

13. A training device for a test case generation model, comprising: processor; and a memory configured to store computer executable instructions that, when executed, cause the processor to: Obtain multiple test cases and the requirement description data corresponding to each test case; Splitting the requirement description data to obtain data segments corresponding to the test cases; Comparing a first title sequence consisting of sub-case titles in each test case with a second title sequence consisting of sub-segment titles in each data segment; Based on the title levels of the candidate segment titles obtained by comparison, the data segments corresponding to the candidate segment titles are screened to obtain training data segments; The training data segments are used as training samples and the test cases are used as sample labels to train the pre-trained model to obtain a test case generation model.

14. A computer-readable storage medium for storing computer-executable instructions, wherein the computer-executable instructions implement the steps of the method of claim 1 when executed.