Search

CN-121979790-A - Training method of test case generation model and test case generation method

CN121979790ACN 121979790 ACN121979790 ACN 121979790ACN-121979790-A

Abstract

The application relates to a training method of a test case generation model and a test case generation method, which comprise the steps of performing first-stage reinforcement learning training on a preset model by using a first training data set to obtain a first target model, wherein the first training data set comprises a first function standard sample of a plurality of function points and a first standard test case, the preset model is used for generating a first prediction test case according to the first function standard sample, in the first-stage reinforcement learning training process, a target rewarding value is adopted to guide the prediction model to optimize and generate a strategy, and the target rewarding value is determined according to the first function standard sample, the first standard test case and the first prediction test case according to a correctness rewarding rule, a format rewarding rule and a coverage rate rewarding rule. Based on the method, the test case generation model obtained through training can reverse test scenes, test scenes corresponding to market problems, test scenes corresponding to boundary conditions and other test scenes.

Inventors

  • ZHANG XIANG
  • LI JICUN
  • HE YU
  • LI MUZI
  • ZHU HONGXIA

Assignees

  • 赛力斯汽车有限公司

Dates

Publication Date
20260505
Application Date
20260109

Claims (10)

  1. 1. A training method for a test case generation model, the training method comprising: performing first-stage reinforcement learning training on the preset model by adopting a first training data set to obtain a first target model; the first training data set comprises a first function specification sample and a first standard test case of a plurality of function points, and the preset model is used for generating a first prediction test case according to the first function specification sample; And in the first-stage reinforcement learning training process, guiding the prediction model to optimize and generate a strategy by adopting a target rewarding value, wherein the target rewarding value is determined according to the first function standard sample, the first standard test case and the first prediction test case and according to a correctness rewarding rule, a format rewarding rule and a coverage rate rewarding rule.
  2. 2. The training method of claim 1, further comprising, after the performing a first stage reinforcement learning training on the preset model using the first training data set to obtain a first target model: collecting a supervised training data set in a sampling refusal mode based on the first target model; And performing supervised fine tuning training on the first target model by adopting the supervised training data set to obtain a second target model.
  3. 3. The training method of claim 2, wherein the collecting the supervised training data set with sampling rejection based on the first objective model comprises: acquiring a prompt word set, wherein the prompt word set comprises a plurality of prompt words in the field of test case generation and a plurality of prompt words in the field of other tasks; generating a corresponding answer set for each prompt word by adopting the first target model; And combining the prompt words with the corresponding answer sets to obtain second question-answer pairs, and determining the supervised training data set according to a plurality of the second question-answer pairs.
  4. 4. The training method of claim 2, further comprising, after said supervised fine tuning training of said first target model with said supervised training dataset: Performing second-stage reinforcement learning training on the second target model by adopting a second training data set to obtain a third target model; the second training data set comprises a fourth function standard sample of a plurality of function points and a fourth standard test case.
  5. 5. The training method of claim 1, further comprising, prior to said first stage reinforcement learning training of the predetermined model using the first training data set: Performing supervised fine tuning training on the base model by adopting a cold start data set to obtain the preset model; The cold start data set comprises second function specification samples and second standard test cases of a plurality of first function points, and also comprises third function specification samples and third prediction test cases of a plurality of second function points, wherein the third prediction test cases are generated based on the second standard test cases.
  6. 6. The training method of claim 1, wherein the training method further comprises: Determining a correctness rewarding value according to a semantic comparison result between the first prediction test case and the corresponding first standard test case and/or the matching degree of the first prediction test case and the key parameters in the first function specification sample; Determining a format rewarding value according to the coincidence degree of the first prediction test case and a preset format; Determining a coverage rate rewarding value according to the coverage rate of the first prediction test case to the test point of the corresponding function specification sample; and calculating the target reward value according to the correctness reward value, the format reward value and the coverage rate reward value.
  7. 7. A method for generating test cases, the method comprising: acquiring a target function specification of a function point to be tested; generating a target test case according to the target function specification by adopting a test case generation model, wherein the test case generation model is trained by adopting the training method according to any one of claims 1-6.
  8. 8. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the method of any of claims 1-7.
  9. 9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1-7 when the computer program is executed by the processor.
  10. 10. A computer readable storage medium having stored thereon a computer program/instruction, which when executed by a processor, implements the steps of the method of any of claims 1-7.

Description

Training method of test case generation model and test case generation method Technical Field The application relates to the technical field of testing, in particular to a training method of a test case generation model and a test case generation method. Background Before the functions of the vehicle-mounted system are on line, a test engineer is required to manually develop test cases for functional test according to the functional specifications of each functional domain, the communication matrix and other documents, the development period is long, the repeatability is high, and the standardized specifications are lacking, so that the test cases are different in quality, low in test efficiency and easy to cause the problem of insufficient coverage of the functional test. In addition, as the complexity of the functions is increased, the development process of the test cases is too dependent on the experience of a test engineer and multi-source document cross verification, the test deviation is aggravated by the characteristic of experience dependence and unstructured retrieval, traceability loss is caused, and the test omission risk is amplified. Disclosure of Invention In order to solve the technical problems, the application provides a training method of a test case generation model and a test case generation method. In a first aspect, the present application provides a training method for a test case generation model, including: performing first-stage reinforcement learning training on the preset model by adopting a first training data set to obtain a first target model; the first training data set comprises a first function specification sample and a first standard test case of a plurality of function points, and the preset model is used for generating a first prediction test case according to the first function specification sample; And in the first-stage reinforcement learning training process, guiding the prediction model to optimize and generate a strategy by adopting a target rewarding value, wherein the target rewarding value is determined according to the first function standard sample, the first standard test case and the first prediction test case and according to a correctness rewarding rule, a format rewarding rule and a coverage rate rewarding rule. In one embodiment, after the performing the first stage reinforcement learning training on the preset model by using the first training data set to obtain the first target model, the method further includes: collecting a supervised training data set in a sampling refusal mode based on the first target model; And performing supervised fine tuning training on the first target model by adopting the supervised training data set to obtain a second target model. In one embodiment, the collecting the supervised training data set based on the first objective model by sampling rejection includes: acquiring a prompt word set, wherein the prompt word set comprises a plurality of prompt words in the field of test case generation and a plurality of prompt words in the field of other tasks; generating a corresponding answer set for each prompt word by adopting the first target model; And combining the prompt words with the corresponding answer sets to obtain second question-answer pairs, and determining the supervised training data set according to a plurality of the second question-answer pairs. In one embodiment, after said employing said supervised training dataset for supervised fine tuning training of said first target model, further comprising: Performing second-stage reinforcement learning training on the second target model by adopting a second training data set to obtain a third target model; the second training data set comprises a fourth function standard sample of a plurality of function points and a fourth standard test case. In one embodiment, before the first stage reinforcement learning training on the preset model using the first training data set, the method further includes: Performing supervised fine tuning training on the base model by adopting a cold start data set to obtain the preset model; The cold start data set comprises second function specification samples and second standard test cases of a plurality of first function points, and also comprises third function specification samples and third prediction test cases of a plurality of second function points, wherein the third prediction test cases are generated based on the second standard test cases. In one embodiment, the training method further comprises: Determining a correctness rewarding value according to a semantic comparison result between the first prediction test case and the corresponding first standard test case and/or the matching degree of the first prediction test case and the key parameters in the first function specification sample; Determining a format rewarding value according to the coincidence degree of the first prediction test case and a preset format; Determin