Search

CN-121979796-A - Test case generation method, device, computer device and storage medium

CN121979796ACN 121979796 ACN121979796 ACN 121979796ACN-121979796-A

Abstract

The present disclosure relates to a test case generating method, a test case generating device, a computer device and a storage medium. The method relates to the whole vehicle electronic and electric appliance testing technology, and solves the problems of poor adaptability and low construction efficiency caused by the fact that the test case depends on manual operation construction. The method comprises the steps of obtaining a natural language demand file, carrying out deep semantic analysis on the natural language demand file, obtaining a test semantic graph, wherein the test semantic graph comprises test elements carried by the self-language demand file and logic relations among the test elements, and generating a test case script according to the test semantic graph. The technical scheme provided by the disclosure is suitable for test case construction of whole vehicle test, and realizes automatic, efficient and comprehensive scene coverage test case generation.

Inventors

  • ZHANG YANYU
  • ZHANG SHENGFENG
  • HUANG JIANFENG
  • YE XIAOPING
  • NI ZEYOU

Assignees

  • 奇瑞汽车股份有限公司

Dates

Publication Date
20260505
Application Date
20260129

Claims (10)

  1. 1. A test case generation method, comprising: acquiring a natural language requirement file; Deep semantic analysis is carried out on the natural language requirement file, and a test semantic graph is obtained, wherein the test semantic graph comprises test elements carried by the self-language requirement file and logic relations among the test elements; and generating a test case script according to the test semantic graph.
  2. 2. The test case generating method according to claim 1, wherein the step of performing deep semantic analysis on the natural language requirement file to obtain a test semantic graph includes: deep semantic analysis is carried out on the natural language requirement file through a large language model, at least one test element is obtained, and the test element is any one of the following: test objects, operation actions, preconditions, expected results, performance indicators; and constructing a structured test semantic graph according to the logical relationship among the test elements, wherein the test semantic graph takes the test elements as nodes and takes the logical relationship among the test elements as edges.
  3. 3. The test case generation method according to claim 1, wherein the step of generating a test case script according to the test semantic graph includes: obtaining a test case template matched with the test semantic graph; And filling the test elements into the test case template according to the test semantic graph to generate the test case script.
  4. 4. The test case generating method according to claim 3, wherein the step of filling the test element into the test case template according to the test semantic graph to generate the test case script comprises: mapping the test elements indicating the operation actions and/or the expected results to bus signals and/or service interfaces of the vehicle to be tested, and filling the test elements into the test case templates; For the other test elements indicating the operation actions and the expected results, directly filling the test case templates; and generating the test case script.
  5. 5. The test case generation method according to claim 1, further comprising: analyzing and evaluating the test case script by any one or more of the following modes: rule checking and model scoring.
  6. 6. The test case generation method according to claim 1, further comprising: Collecting execution data of at least one test case script, wherein the execution data at least comprises any one or more of the following information: Executing passing results, executing failure results, code coverage rate and labeling feedback; And constructing a fine tuning data set based on the execution data, performing incremental fine tuning training on the large language model, and updating the large language model.
  7. 7. The test case generation method according to claim 1, further comprising: and synchronizing the test case script to a test management platform and/or continuously integrating and continuously deploying a pipeline test environment.
  8. 8. A test case generating apparatus, comprising: The natural language demand acquisition module is used for acquiring natural language demand files; the semantic analysis module is used for carrying out deep semantic analysis on the natural language requirement file to obtain a test semantic graph, wherein the test semantic graph comprises test elements carried by the self-language requirement file and logic relations among the test elements; and the script generation module is used for generating test case scripts according to the test semantic graph.
  9. 9. A computer apparatus, comprising: A processor; A memory for storing processor-executable instructions; wherein the processor is configured to perform the test case generation method of any of claims 1-7.
  10. 10. A non-transitory computer-readable storage medium, wherein instructions in the storage medium, when executed by a processor of a computer, enable the computer to perform the test case generation method of any one of claims 1-7.

Description

Test case generation method, device, computer device and storage medium Technical Field The present disclosure relates to a whole vehicle electronic apparatus (ECU) testing technology, and in particular, to a test case generating method, a device, a computer device, and a storage medium. Background Along with the continuous improvement of the complexity of the whole vehicle software system, the traditional method for manually writing the test cases has low efficiency, low coverage rate and high maintenance cost. The existing automatic test tools generate test cases based on rules or templates, lack deep understanding of demand semantics, and are difficult to deal with complex business logic and continuously-changing system behaviors. The test generation tools Selenium IDE, junit and the like based on code analysis rely on preset scripts, and can not automatically generate test logic according to natural language requirements, while the test generation method based on model driving, such as UML model, depends on manual modeling, has complex flow and poor adaptability. In summary, the test cases are mainly constructed by manually preset rules, and have poor adaptability. Disclosure of Invention In order to overcome the problems in the related art, the present disclosure provides a test case generating method, apparatus, computer apparatus, and storage medium. The test semantic graph is obtained by semantic analysis of the natural language requirement file, the test case script is automatically generated based on the semantic, the problems of poor adaptability and low construction efficiency caused by the fact that the test case depends on manual operation construction are solved, and the automatic, efficient and comprehensive scene coverage test case generation is realized. According to a first aspect of an embodiment of the present disclosure, there is provided a test case generating method, including: acquiring a natural language requirement file; Deep semantic analysis is carried out on the natural language requirement file, and a test semantic graph is obtained, wherein the test semantic graph comprises test elements carried by the self-language requirement file and logic relations among the test elements; and generating a test case script according to the test semantic graph. Further, the step of performing deep semantic analysis on the natural language requirement file to obtain a test semantic graph includes: deep semantic analysis is carried out on the natural language requirement file through a large language model, at least one test element is obtained, and the test element is any one of the following: test objects, operation actions, preconditions, expected results, performance indicators; and constructing a structured test semantic graph according to the logical relationship among the test elements, wherein the test semantic graph takes the test elements as nodes and takes the logical relationship among the test elements as edges. Further, the step of generating a test case script according to the test semantic graph includes: obtaining a test case template matched with the test semantic graph; And filling the test elements into the test case template according to the test semantic graph to generate the test case script. Further, the step of filling the test elements into the test case template according to the test semantic graph, and generating the test case script includes: mapping the test elements indicating the operation actions and/or the expected results to bus signals and/or service interfaces of the vehicle to be tested, and filling the test elements into the test case templates; For the other test elements indicating the operation actions and the expected results, directly filling the test case templates; and generating the test case script. Further, the method further comprises: analyzing and evaluating the test case script by any one or more of the following modes: rule checking and model scoring. Further, the method further comprises: Collecting execution data of at least one test case script, wherein the execution data at least comprises any one or more of the following information: Executing passing results, executing failure results, code coverage rate and labeling feedback; And constructing a fine tuning data set based on the execution data, performing incremental fine tuning training on the large language model, and updating the large language model. Further, the method further comprises: and synchronizing the test case script to a test management platform and/or continuously integrating and continuously deploying a pipeline test environment. According to a second aspect of embodiments of the present disclosure, there is provided a test case generating apparatus including: The natural language demand acquisition module is used for acquiring natural language demand files; the semantic analysis module is used for carrying out deep semantic analysis on the natural language requirem