Test case generation method and device and electronic equipment

By obtaining target function information and target test cases from the knowledge graph and generating test cases for vehicle functions, the problems of low efficiency and poor accuracy of generating vehicle functional test cases in the prior art are solved, and more efficient and accurate test case generation is achieved.

CN120234244APending Publication Date: 2025-07-01DEEPAL AUTOMOBILE TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510357030.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

Currently, when testing the functions of the vehicle, the test cases for generating vehicle functions are less efficient and have poor accuracy.

Method used

By obtaining target function information and target test cases from the knowledge graph, the test cases to be detected are generated based on the test case generation request. The knowledge graph includes the correspondence between reference function information and reference test cases, and the target function information and target test cases are associated with the functions to be detected.

Benefits of technology

The accuracy and efficiency of generating test cases to be detected is improved, so that the generated test cases more in line with actual needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120234244A_ABST
    Figure CN120234244A_ABST
Patent Text Reader

Abstract

The invention relates to a test case generation method and device and electronic equipment, and relates to the technical field of vehicle function testing. The technical problems that the efficiency is low and the accuracy is poor when the vehicle function is tested and the test case of the vehicle function is generated are at least solved. Comprising the steps that based on a test case generation request, target function information and a target test case are obtained from a knowledge graph, the test case generation request is used for requesting to generate a test case of a to-be-detected function of a to-be-detected vehicle, and the knowledge graph comprises a corresponding relation between reference function information and a reference test case; the target function information and the target test case are associated with the to-be-detected function; and based on the test case generation request, the target function information and the target test case, generating a test case of the to-be-detected function. The efficiency and the accuracy of generating the test case of the vehicle function are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of vehicle function testing, and particularly relates to a test case generation method, device, and electronic device. Background Art

[0002] With the rapid development of new energy vehicles, the functions of new energy vehicles are becoming increasingly complex. Consequently, higher requirements are imposed on the testing work for various vehicle functions. Currently, generating test cases for vehicle functions mainly relies on manual design and empirical judgment. However, this way of generating test cases has problems such as low test efficiency, incomplete coverage of test cases, and significant differences in test cases designed by different personnel.

[0003] In related technologies, by collecting scenario description text data related to intelligent vehicle scenario testing and intelligent vehicle technologies, the text to form a knowledge base is sorted out. And by fine-tuning a pre-trained model, a scenario knowledge base construction and call chain design are carried out, and the labeled and sorted scenario data is imported into the knowledge base management system to form a structured and queryable knowledge resource. Thereby, the required simulation software, test management tools, and the overall architecture of the design tool chain are determined, the data flow, control flow, and interface specifications between components are clarified, and the structure and content template of the test report, as well as the report file generation tool chain, are designed. Based on this, the intelligent vehicle scenario is tested, and a practical link is given to conduct experiments and evaluations on the tasks. This technical solution tests the intelligent vehicle scenario through a large language model, rather than generating test cases for vehicle functions. In another related technology, by obtaining the original statement of work (SOW) of the target project and the product information of the software product to be tested associated with the target project, according to the product information, the product documentation of the software product to be tested and the target historical test cases are obtained. And by splitting the original SOW, multiple shard SOWs are obtained, and according to the multiple shard SOWs, product documentation, and target historical test cases, test cases for the software product to be tested are generated. This technical solution is for generating test cases for software products, not for generating test cases for vehicle functions. Therefore, currently, when testing vehicle functions and generating test cases for vehicle functions, the efficiency is low and the accuracy is poor. Summary of the Invention

[0004] This application provides a test case generation method, device, and electronic device. The purpose of this application is to at least solve the technical problems of low efficiency and poor accuracy in testing vehicle functions and generating test cases for vehicle functions in related technologies.

[0005] To achieve the above object, the technical solution adopted in this application is as follows:

[0006] According to the first aspect provided by the present application, a test case generation method is provided. The method includes: obtaining target function information and target test cases from a knowledge graph based on a test case generation request, where the test case generation request is used to request the generation of test cases for a function to be detected of a vehicle to be detected, the knowledge graph includes the correspondence between reference function information and reference test cases, and the target function information and target test cases are associated with the function to be detected; generating test cases for the function to be detected based on the test case generation request, the target function information, and the target test cases.

[0007] According to the above technical means, when the present application receives a request for generating test cases for a function to be detected of a vehicle to be detected, it can obtain target function information and target test cases associated with the function to be detected from a knowledge graph including the correspondence between reference function information and reference test cases. Furthermore, test cases for the function to be detected can be generated based on the test case generation request, the target function information, and the target test cases. In this way, when test cases for the function to be detected need to be generated, the function information and test cases related to the function to be detected in the knowledge graph can be referred to, making the generated test cases for the function to be detected more accurate. Thus, when generating test cases for the function to be detected, the efficiency and accuracy of generating test cases can be improved.

[0008] In a possible implementation manner, the above step of generating test cases for the function to be detected based on the test case generation request, the target function information, and the target test cases includes: determining model input information of the test case generation request based on the target function information and the target test cases; inputting the model input information, the target function information, and the target test cases into a test case generation model to generate test cases for the function to be detected.

[0009] According to the above technical means, the present application can first determine the model input information of the test case generation request based on the target function information and the target test cases, so as to determine the accurate information input into the model with reference to the target function information and the target test cases. Furthermore, the determined model input information, the target function information, and the target test cases are input into the test case generation model to generate test cases for the function to be detected. In this way, test cases for the function to be detected can be accurately generated.

[0010] In a possible implementation manner, the above test case generation model is obtained by the following method: determining an encoding information matrix of the reference function information and the reference test cases; adjusting the parameters of a pre-trained model through a Low-Rank Adaptation (LoRA) fine-tuning technique based on the encoding information matrix and a preset low-rank matrix to obtain the test case generation model, where the pre-trained model is obtained by training a base model.

[0011] According to the above technical means, the present application can determine the coding information matrix of the reference function information and the reference test cases, and fine-tune the coding information matrix based on the low-rank matrix through the LoRA fine-tuning technology, so as to adjust the parameters of the pre-trained model and obtain the test case generation model. In this way, through the low-rank matrix and the LoRA fine-tuning technology, the pre-trained model can be optimized to obtain a test case generation model with higher accuracy.

[0012] In a possible implementation manner, the above pre-trained model is obtained by the following method: obtaining a training data set, where the training data set includes vehicle knowledge information, and the vehicle knowledge information includes at least one of the following: vehicle usage information, vehicle maintenance information, vehicle maintenance information; based on the training data set, pre-training the base model to obtain the pre-trained model.

[0013] According to the above technical means, the present application can obtain a training data set including vehicle knowledge information, and thus pre-train the base model through the training data set to obtain the pre-trained model. In this way, the base model can be trained based on the vehicle knowledge information to obtain a pre-trained model with the ability to understand vehicle knowledge. Thus, when generating test cases for vehicle functions subsequently, the accuracy of generating test cases can be improved.

[0014] In a possible implementation manner, the above obtaining the training data set includes: obtaining initial vehicle knowledge information; preprocessing the initial vehicle knowledge information to obtain the processed vehicle knowledge information, and the preprocessing includes at least one of the following: data cleaning, data format verification, data normalization processing, data parsing; selecting a preset number of data from the processed vehicle knowledge information as the training data set.

[0015] According to the above technical means, the present application can first obtain the initial vehicle knowledge information to preprocess the initial vehicle knowledge information to obtain the processed vehicle knowledge information. In this way, by selecting a preset number of data from the processed vehicle knowledge information as the training data set, a more accurate pre-trained model can be obtained when training the base model.

[0016] In a possible implementation manner, the above pre-training the base model based on the training data set to obtain the pre-trained model includes: determining training parameters based on the data volume of the training data set and the model characteristics of the base model, and the training parameters include at least one of the following: learning rate, batch size, warm-up steps, number of iterations; based on the training parameters and the training data set, iteratively training the base model to obtain the pre-trained model.

[0017] According to the above technical means, the present application can determine training parameters based on the data volume of the training dataset and the model characteristics of the base model, and then iteratively train the base model based on the training parameters and the training dataset to obtain a pre-trained model. In this way, based on the data volume characteristics and model characteristics of the training dataset, accurate training parameters can be determined, and when training the base model, a more accurate pre-trained model can be obtained.

[0018] In a possible implementation manner, the above-mentioned iterative training of the base model based on the training parameters and the training dataset to obtain a pre-trained model includes: determining a training metric, where the training metric is used to indicate the convergence degree of the base model, and the training metric includes at least one of the following: loss value, accuracy, recall rate; adjusting the training parameters based on the training metric, and training the base model based on the adjusted training parameters and the training dataset to obtain a trained base model; when the convergence degree of the trained base model meets a preset convergence degree, determining the trained base model as the pre-trained model.

[0019] According to the above technical means, the present application can determine a training metric when training the base model to determine the convergence degree of the trained base model. Then, adjust the training parameters based on the training metric, and iteratively train the base model based on the adjusted training parameters and the training dataset to obtain a pre-trained model whose convergence degree meets the preset convergence degree. In this way, the convergence degree of the model is judged through the training metric, and a pre-trained model that meets the expected conditions is trained, and a more accurate model can be trained.

[0020] In a possible implementation manner, the above knowledge graph is obtained through the following method: obtaining initial function information and initial test cases; removing the error data in the initial function information and the initial test cases, and removing the initial function information that has no corresponding relationship with any initial test case to obtain reference function information and reference test cases; constructing a knowledge graph based on the reference function information and the reference test cases.

[0021] According to the above technical means, the present application can perform data processing on the obtained initial function information and initial test cases to remove error data and function information that has no corresponding relationship with the test cases. Thus, a knowledge graph including accurate data can be obtained by constructing a knowledge graph based on the obtained reference function information and reference test cases.

[0022] In a possible implementation manner, the above method further includes: optimizing the knowledge graph and the test case generation model based on the test cases of the function to be detected.

[0023] According to the above technical means, after generating test cases for the function to be detected, the present application can optimize the knowledge graph and the test case generation model based on the generated test cases, so as to further improve the accuracy of the generated test cases when generating test cases subsequently.

[0024] According to the second aspect provided by the present application, there is provided a test case generation device, including: an acquisition module and a processing module; the acquisition module is configured to obtain target function information and target test cases from the knowledge graph based on a test case generation request, where the test case generation request is used to request the generation of test cases for the function to be detected of a vehicle to be detected, the knowledge graph includes the correspondence between reference function information and reference test cases, and the target function information and the target test cases are associated with the function to be detected; the receiving module is configured to generate test cases for the function to be detected based on the test case generation request, the target function information, and the target test cases.

[0025] In a possible implementation manner, the processing module is specifically configured to determine the model input information of the test case generation request based on the target function information and the target test cases; the processing module is specifically configured to input the model input information, the target function information, and the target test cases into the test case generation model to generate test cases for the function to be detected.

[0026] In a possible implementation manner, the processing module is further configured to determine the encoding information matrix of the reference function information and the reference test cases; the processing module is further configured to adjust the parameters of the pre-trained model through the low-rank adaptation LoRA fine-tuning technology based on the encoding information matrix and a preset low-rank matrix to obtain the test case generation model, where the pre-trained model is obtained by training the base model.

[0027] In a possible implementation manner, the acquisition module is further configured to obtain a training data set, where the training data set includes vehicle knowledge information, and the vehicle knowledge information includes at least one of the following: vehicle usage information, vehicle maintenance information, vehicle maintenance information; the processing module is further configured to pre-train the base model based on the training data set to obtain the pre-trained model.

[0028] In a possible implementation manner, the acquisition module is specifically configured to obtain initial vehicle knowledge information; the processing module is further configured to preprocess the initial vehicle knowledge information to obtain the processed vehicle knowledge information, and the preprocessing includes at least one of the following: data cleaning, data format verification, data normalization processing, data parsing; the processing module is further configured to select a preset number of data from the processed vehicle knowledge information as the training data set.

[0029] In one possible implementation, the processing module is specifically used to determine the training parameters based on the data volume of the training data set and the model characteristics of the base model, and the training parameters include at least one of the following: learning rate, batch size, number of warm-up steps, and number of iterations; the processing module is specifically used to iteratively train the base model based on the training parameters and the training data set to obtain a pre-trained model.

[0030] In one possible implementation, a processing module is specifically used to determine a training indicator, where the training indicator is used to indicate the degree of convergence of the base model, and the training indicator includes at least one of the following: loss value, accuracy, and recall rate; the processing module is specifically used to adjust the training parameters based on the training indicators, and train the base model based on the adjusted training parameters and the training data set to obtain a trained base model; the processing module is specifically used to determine the trained base model as a pre-trained model when the degree of convergence of the trained base model meets a preset convergence degree.

[0031] In one possible implementation, the acquisition module is also used to acquire initial functional information and initial test cases; the processing module is also used to eliminate erroneous data in the initial functional information and initial test cases, and eliminate initial functional information that has no corresponding relationship with any initial test case, to obtain reference functional information and reference test cases; the processing module is also used to construct a knowledge graph based on the reference functional information and reference test cases.

[0032] In a possible implementation, the processing module is also used to optimize the knowledge graph and the test case generation model based on the test cases of the functions to be tested.

[0033] According to the third aspect provided by the present application, an electronic device is provided, comprising: a processor; a memory for storing processor executable instructions; wherein the processor is configured to execute instructions to implement the method of the above-mentioned first aspect and any possible implementation manner thereof.

[0034] According to the fourth aspect provided by the present application, a computer-readable storage medium is provided. When the computer execution instructions stored in the computer-readable storage medium are executed by the processor of an electronic device, the electronic device executes the method of the above-mentioned first aspect and any possible implementation method thereof.

[0035] According to the fifth aspect provided by the present application, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method of the above-mentioned first aspect and any possible implementation manner thereof, or the second aspect and any possible implementation manner thereof.

[0036] According to a sixth aspect provided by the present application, a vehicle is provided. The vehicle includes the test case generation device as in the second aspect, and the vehicle is used to implement the method in the above first aspect and any possible implementation manners thereof.

[0037] It should be noted that for the technical effects brought by any implementation manner in the second aspect to the sixth aspect, reference can be made to the technical effects brought by the corresponding implementation manner in the first aspect, which will not be elaborated herein.

[0038] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application, and do not constitute an improper limitation to the present application.

[0040] Figure 1 It is a schematic structural diagram of a test case generation system shown according to an exemplary embodiment;

[0041] Figure 2 It is a flowchart of a test case generation method shown according to an exemplary embodiment;

[0042] Figure 3 It is a flowchart of another test case generation method shown according to an exemplary embodiment;

[0043] Figure 4 It is a flowchart of another test case generation method shown according to an exemplary embodiment;

[0044] Figure 5 It is a flowchart of another test case generation method shown according to an exemplary embodiment;

[0045] Figure 6 It is a flowchart of another test case generation method shown according to an exemplary embodiment;

[0046] Figure 7 It is a block diagram of a test case generation device shown according to an exemplary embodiment;

[0047] Figure 8 It is a block diagram of an electronic device (server) shown according to an exemplary embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0048] In order to enable those of ordinary skill in the art to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings.

[0049] It should be noted that the terms "first", "second", etc. in the description, claims and above-mentioned drawings of this application are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. On the contrary, they are only examples of devices and methods consistent with some aspects of this application as detailed in the appended claims.

[0050] With the rapid development of new energy vehicles, new energy vehicles involve multiple key technical fields such as intelligent cockpits and intelligent driving, and the functions of vehicles are becoming more and more numerous and intelligent. On the one hand, due to the rapid development of large language model technology, large language model technology has greatly enhanced the computer's ability in natural language understanding and human-computer interaction, but the basic large language model cannot meet the personalized needs of vertical applications. By fine-tuning the large language model, it can be optimized for specific tasks or fields, thereby improving the performance of the model. Therefore, for the function testing of new energy vehicles, by combining specific data for fine-tuning the large language model, test cases that are more in line with the actual test requirements can be generated, improving the pertinence and effectiveness of the test. On the other hand, as a data structure representing entities and relationships, a knowledge graph can effectively integrate and organize domain knowledge, helping to improve the semantic understanding and reasoning ability of the system. Therefore, in the field of new energy vehicle function testing, the knowledge graph can also help the system better understand and interpret relevant information in the function requirement description, thereby improving the accuracy of generating test cases.

[0051] A test case is a description of the test tasks for a specific software product, reflecting the test plan, methods, techniques and strategies. Its content includes test objectives, test environment, input data, test steps, expected results, test scripts, etc., and finally forms a document. Simply put, a test case is a set of test inputs, execution conditions and expected results prepared for a specific goal, used to verify whether a specific software requirement is met.

[0052] A test case mainly includes four contents: test case title, precondition, test steps and expected results. The test case title mainly describes the test of a certain function; the precondition means that the test case title needs to meet this condition; the test steps mainly describe the operation steps of the test case; the expected result refers to meeting the requirements as expected (development specification, requirement document, user requirements, etc.). A test case does not include the actual result. A test case is generated before the test. Only during the test will there be an actual result, so it is impossible for the actual result to be generated synchronously with the test case.

[0053] The test case generation method provided by the embodiments of this application can be applied to a test case generation system. Figure 1 FIG. shows a schematic structural diagram of a test case generation system. As Figure 1 shown, the test case generation system 10 includes: an electronic device 11, a test case generation model 12, and a knowledge graph 13.

[0054] Optionally, the test case generation model 12 and the knowledge graph 13 can be installed in the electronic device 11, or the electronic device can remotely call the test case generation model 12 and the knowledge graph 13 in the server. That is, the test case generation model 12 and the knowledge graph 13 can be deployed in the electronic device 11 or in other devices (such as a server or other electronic devices).

[0055] Optionally, when the test case generation model 12 and the knowledge graph 13 are deployed in other devices, the test case generation model 12 and the knowledge graph 13 can be deployed in the same device or in different devices.

[0056] Optionally, the electronic device 11 can call the test case generation model 12 to generate test cases for the function to be detected based on the received test case generation request.

[0057] Optionally, the knowledge graph 13 is used to provide data support (such as providing target function information and target test cases) when generating test cases for the function to be detected.

[0058] Specifically, the electronic device 11 can obtain the target function information and the target test cases from the knowledge graph 13, and thus generate test cases for the function to be detected through the test case generation model 12 based on the test case generation request, the target function information, and the target test cases.

[0059] For ease of understanding, the following specifically introduces the test case generation method provided by this application with reference to the accompanying drawings.

[0060] Figure 2 is a flowchart of a test case generation method shown according to an exemplary embodiment. As Figure 2 shown, the test case generation method includes: S201 - S202:

[0061] S201. Based on the test case generation request, obtain the target function information and the target test cases from the knowledge graph.

[0062] Among them, the test case generation request is used to request the generation of test cases for the function to be detected of the vehicle to be detected. The knowledge graph includes the correspondence between the reference function information and the reference test cases, and the target function information and the target test cases are associated with the function to be detected.

[0063] In an embodiment of the present application, when it is necessary to test the functions of a vehicle to be detected, for each function included in the vehicle to be detected (the function to be detected), it is necessary to generate test cases for the function to be detected, so as to determine whether the function to be detected of the vehicle to be detected is normal based on the test cases. Therefore, a test case generation request can be generated for the function to be detected, and based on the test case generation request, combined with the knowledge graph and the test case generation model, test cases for the function to be detected can be generated.

[0064] It should be noted that a corresponding test case generation model can be constructed in advance based on vehicle knowledge, and moreover, a knowledge graph can be constructed in advance based on existing vehicle functions and test cases corresponding to the vehicle functions.

[0065] In this way, when the electronic device receives an input request for generating test cases for the function to be detected of the vehicle to be detected, the electronic device can generate corresponding test cases by calling the test case generation model and combining the knowledge graph.

[0066] Optionally, the test case generation request can be determined based on the vehicle model item (vehicle model information) asked by the user. The vehicle model item includes the following information: vehicle model, vehicle year, vehicle manufacturer, functions of the vehicle, etc. The functions of the vehicle can specifically be: air-conditioning zone adjustment function, seat adjustment function, audio adjustment function, lighting adjustment function, etc.

[0067] Exemplarily, the target function information and target test cases associated with the function to be detected can be: for example, if the function to be detected is to turn off the air conditioner in the back row of the vehicle, the target function information and target test cases related to the air conditioner can be obtained from the knowledge graph. For example, the target function information related to the air conditioner can be: turn off (turn on) the air conditioner in the front row of the vehicle, turn off (turn on) the entire vehicle air conditioner, etc., and the target test cases are the test cases corresponding to the target function information.

[0068] In some embodiments, the knowledge graph can be constructed based on the existing vehicle model information, function information, and test cases in the database. Specifically, the knowledge graph can be obtained through the following methods:

[0069] First, obtain the initial function information and initial test cases from the database. The initial function information is the functions of existing vehicle models stored in the database. That is to say, the function information can be understood as the function requirements of the vehicle, that is, what functions the vehicle needs to have. The initial test cases can be test cases manually written for the existing function information (function requirements).

[0070] Furthermore, the initial function information and initial test cases obtained from the database can be processed to remove the incorrect data in the initial function information and initial test cases, and remove the initial function information that has no corresponding relationship with any initial test case, so as to obtain the reference function information and reference test cases. Then, based on the reference function information and reference test cases, a knowledge graph is constructed.

[0071] It can be understood that the data processing of the initial function information and initial test cases is specifically to perform data cleaning and preprocessing on the text data in the initial function information and initial test cases, so as to remove some irrelevant or obviously incorrect information in the initial function information and initial test cases. And the data with initial function information but no corresponding initial test case is removed.

[0072] Optionally, the standard formats of the reference function information and reference test cases can also be unified. For example, the standard format of the test case should include: pre-test status, test operation steps, test expected results, etc.

[0073] It should be noted that a knowledge graph is a graphical model used to represent information and knowledge, expressing entities and their relationships through nodes and edges. Specifically, nodes represent entities (such as people, places, organizations, etc.) or abstract concepts (such as events, topics, etc.), and each node can contain rich attribute descriptions of its characteristics. Edges are used to connect two nodes, representing the relationship between the two nodes. These relationships can be diverse, such as "belong to", "be located in", "affect", etc. The relationship depends on the entity type and application scenario described. Therefore, the knowledge graph can effectively capture and display the semantic relationships between data, thus supporting more intelligent information retrieval.

[0074] In a possible implementation, a knowledge graph can be specifically constructed based on the obtained vehicle model information, reference function information, reference test cases, and hardware parameters (i.e., the hardware parameters of the vehicle). By using the vehicle model information, reference function information, and reference test cases as the core nodes of the knowledge graph, and defining the relationships between the nodes. For example, the relationship between the vehicle model information node and the reference function information node is an inclusion relationship (i.e., the vehicle model information includes the reference function information, such as the various functions of a specific vehicle model); the relationship between the reference function information node and the reference test case node is a corresponding relationship (i.e., the reference function information corresponds to the reference test case, such as the set of test cases corresponding to each piece of reference function information); the relationship between the reference test case node and the hardware parameter node is a dependency relationship (i.e., the reference test case can be implemented only by relying on the hardware parameters, such as the hardware configuration required for testing). And there may also be similarities between nodes and nodes (used to discover the similarities between reference function information to optimize the test strategy). For example, there is a similarity between one reference function information node and another reference function information node, which indicates that the similarity between these two pieces of reference function information is relatively high (for example, one piece of reference function information is to turn off the air conditioner in the back row of the vehicle, and another piece of reference function information is to turn off the air conditioner in the front row of the vehicle. These two pieces of reference function information are both functions of turning off the air conditioner, and the only difference is whether to turn off the air conditioner in the front row or the back row).

[0075] Optionally, for the constructed knowledge graph, a graph database (such as Neo4j) can be used to store the structured relationships, and an unstructured text can be stored through a vector database (such as the search server Elasticsearch).

[0076] Specifically, each vehicle model information (model item) can be used as an independent node to obtain a vehicle model information node. The vehicle model information node can include information such as the model name and model year. Each piece of reference function information is used as a node, such as the front row air conditioner control node, battery management system node, etc. These reference function information nodes can include attributes such as detailed description information, priority, associated standards or regulations, etc. Each reference test case is used as a node, and the reference test case node can include information such as the pre-test state, case brief description, operation steps, and expected results. The key hardware components involved and their specifications are used as hardware parameter nodes, such as the battery capacity node, motor power node, etc.

[0077] Exemplarily, the vehicle model information node is: A689, and the included attributes are: model name (A689), model year (2025), and manufacturer (Deep Blue Automobile). The reference function information node is: Front_Air_Conditioning_Control, and the included attributes are: description information (control the turning on and off of the front air conditioner), priority (high), and standard or regulation (ISO_XXXXX). The reference test case node is: TC_Front_AC_On, and the included attributes are: pre-test status (the vehicle is in the start state and the front air conditioner is in the off state), operation steps (turn on the front air conditioner), and expected result (the front air conditioner is in the working state). The relevant hardware parameter is: the battery capacity (Battery Level) is greater than 30%, and the corresponding hardware parameter node is: Battery Specs, and the included attributes are: capacity (80kWh), power (250kW).

[0078] In the embodiment of the present application, the present application can perform data processing on the obtained initial function information and initial test cases, and eliminate error data and function information that has no corresponding relationship with the test cases. Thus, based on the reference function information and reference test cases obtained after processing, a knowledge graph can be constructed, and a knowledge graph including accurate data can be obtained.

[0079] S202. Generate test cases for the function to be detected based on the test case generation request, target function information, and target test cases.

[0080] In a specific implementation manner, test cases for the function to be detected can be generated based on the test case generation request, target function information, and target test cases through a test case generation model.

[0081] In the embodiment of the present application, when the present application receives a request to generate test cases for the function to be detected of the vehicle to be detected, it can obtain the target function information and target test cases associated with the function to be detected from the knowledge graph including the corresponding relationship between the reference function information and the reference test cases. Furthermore, test cases for the function to be detected can be generated based on the test case generation request, target function information, and target test cases. In this way, when test cases for the function to be detected need to be generated, the function information and test cases related to the function to be detected in the knowledge graph can be referred to, so that the accuracy of the generated test cases for the function to be detected is higher. In this way, when generating test cases for the function to be detected, the efficiency and accuracy of generating test cases can be improved.

[0082] In some embodiments, such as Figure 3As shown in the figure, in a test case generation method provided by an embodiment of the present application, the above S202 may specifically include S301 - S302:

[0083] S301. Determine the model input information of the test case generation request based on the target function information and the target test case.

[0084] Among them, the model input information is used to indicate the function to be detected.

[0085] Optionally, after obtaining the target function information and the target test case from the knowledge graph, the model input information (also called the prompt word) can be constructed according to the target function information and the target test case, and then the test case generation model is called to generate the test case of the function to be detected.

[0086] Exemplarily, the function to be detected is: the seat adjustment function, the obtained target function information is: turning off the air conditioner of the rear seats of the vehicle, and the corresponding target test case is: when the air conditioners of the front seats and the rear seats of the vehicle are both in the on state, based on the operation of turning off the air conditioner of the rear seats, turn off the air conditioner of the rear seats and keep the air conditioner of the front seats on. Based on the target function information and the target test case, the model input information corresponding to the test case generation request of the function to be detected can be: generating the test case of the seat adjustment function of the vehicle.

[0087] S302. Input the model input information, the target function information, and the target test case into the test case generation model to generate the test case of the function to be detected.

[0088] Exemplarily, the test case of the function to be detected includes the following content: the state before the test (the vehicle is in a stopped state), the operation steps (adjust the front seat to the most forward position or the last position, or adjust the angle of the seat back to ensure that the seat back can be fully upright or tilted backward to the maximum extent), and the expected result (the seat moves smoothly within the specified range, without jamming or abnormality).

[0089] In the embodiment of the present application, the present application can first determine the model input information of the test case generation request based on the target function information and the target test case, so as to determine the accurate information input into the model with reference to the target function information and the target test case. Then, the determined model input information, the target function information, and the target test case are input into the test case generation model to generate the test case of the function to be detected. In this way, the test case of the function to be detected can be accurately generated.

[0090] In some embodiments, as Figure 4 shown, in a test case generation method provided by an embodiment of the present application, the test case generation model is obtained through the following method, including S401 - S402:

[0091] S401. Determine the coding information matrix of the reference function information and the reference test cases.

[0092] Optionally, instruction data can be constructed based on the reference function information and the reference test cases.

[0093] It should be noted that for tasks such as generating test cases, when fine-tuning the model, the required structural data (i.e., instruction data) needs to be constructed. The format of constructing the instruction data is: instruction - input information - output information, where the input information can be the reference function information.

[0094] Optionally, since the knowledge graph includes the correspondence between the reference function information and the reference test cases, including: one reference function information corresponds to one reference test case, or one reference function information corresponds to multiple reference test cases. Therefore, the instruction data for one reference function information and the corresponding one reference test case can be constructed respectively; and the instruction data for one reference function information and the corresponding multiple reference test cases can be constructed.

[0095] Optionally, the instruction is used to trigger the model to generate test cases. For example, the instruction can be: Please generate the corresponding test cases according to the functional requirements of the vehicle.

[0096] Exemplarily, the instruction can specifically be: You are an assistant for generating functional test cases for new energy vehicles. You need to generate one or more corresponding test cases based on the <function information> of the vehicle test input by the user and the requirement decomposition of this function information, combined with the knowledge of new energy vehicles you know. The instruction also specifically indicates the content that the generated test cases should include: pre-test status (the relevant status of the vehicle before the test starts), brief description of the test case (a general description of the test case), specific operation content (the operation steps that the tester should perform), and expected output results (the corresponding expected results after each operation). It should be noted that when the expected result corresponding to a certain step is empty, it means that the corresponding expected result does not need to be described for this step.

[0097] Exemplarily, the input information can be: The air conditioner in the front row seats is in the on state, and the air conditioner in the rear row seats is in the on state. When the user clicks the air conditioner on / off button for the rear row seats on the rear touch screen, the vehicle should turn off the air conditioner in the rear row seats, while the state of the air conditioner in the front row seats remains unchanged. For this input information (reference function information), the following information can be obtained by splitting: 1. The air conditioner in the front row seats is in the on state, 2. The air conditioner in the rear row seats is in the on state, 3. The user clicks the air conditioner on / off button for the rear row seats on the rear touch screen, 4. The vehicle turns off the air conditioner in the rear row seats, 5. The state of the air conditioner in the front row seats remains unchanged.

[0098] Exemplarily, the output information may include:

[0099] Status before testing: The air conditioner for the front row seats is in the on state, and the air conditioner for the rear row seats is in the on state.

[0100] Brief description of the test case: Verify that when the user clicks the air conditioner on / off button for the rear row seats on the rear touch screen, whether the vehicle can correctly turn off the air conditioner for the rear row seats while ensuring that the status of the air conditioner for the front row seats remains unchanged.

[0101] Specific operation content: Confirm that the air conditioner for the front row seats is on and the air conditioner for the rear row seats is also on. The user enters the rear area of the vehicle and finds the air conditioner on / off button for the rear row seats on the rear touch screen, and the user clicks the air conditioner on / off button for the rear row seats.

[0102] Expected output result: The air conditioner for the rear row seats switches from the on state to the off state, and the status of the air conditioner for the front row seats remains on.

[0103] In one possible implementation, the parameters of the pre-trained model can be adjusted through the LoRA fine-tuning technique.

[0104] It should be noted that the LoRA fine-tuning technique is a parameter-efficient fine-tuning method. Its core lies in efficiently adjusting the parameters of the model by introducing low-rank matrices, thereby significantly reducing the computational and storage costs while maintaining the model performance. And, current large language models are all implemented based on the Transformer architecture, which is composed of an encoder Encoder and a decoder Decoder, and both the Encoder and the Decoder contain 6 blocks.

[0105] Optionally, based on the constructed instruction data, the embedding vectors of the words included in the instruction data can be obtained. The embedding vector is composed of a word vector and a position vector.

[0106] Optionally, the word vector in the embedding vector can be pre-trained using the word2vec algorithm, and the position vector PE can be calculated using the following formula: PE(pos, 2i) = sin(pos / 1000 ^ (2i / d)), PE(pos, 2i + 1) = cos(pos / 1000 ^ (2i / d)). Where pos represents the position.

[0107] Optionally, by obtaining the word vectors of each word included in the instruction data, the word representation vector matrix of the entire instruction data can be obtained, and then passed into the Encoder. After passing through 6 blocks, the encoded information matrix C of all words in the instruction data can be obtained.

[0108] Optionally, the multi-head attention mechanism can also be combined. The multi-head attention mechanism consists of multiple self-attention mechanisms. The self-attention mechanism takes the word vector as the input matrix X, or takes the output of the previous block as the input matrix X. Then, the query Q vector, key K vector, and value V vector are calculated using the linear transformation matrices WQ, WK, and WV, and the output of the self-attention mechanism is calculated: where QK T represents the transpose matrix of Q multiplied by K, and k represents the dimension of the vector.

[0109] It can be understood that the multi-head attention mechanism contains multiple self-attention layers. First, the input matrix X is respectively passed into multiple different self-attention mechanisms to calculate multiple output matrices Z, and the multiple output matrices Z are concatenated together, and then passed into a linear layer to obtain the final output Z of the multi-head attention mechanism.

[0110] Optionally, the problem of multi-layer network training can also be solved based on residual connection, which allows the network to only focus on the different parts. And based on layer normalization, the inputs of each layer of neurons are converted into the same mean and variance, which can accelerate the convergence of the model.

[0111] Optionally, the parameters of the model can also be adjusted based on the feed-forward neural network. The feed-forward neural network is a two-layer fully connected layer. The activation function of the first layer is Relu, and the second layer does not use an activation function. The corresponding formula is: max(0, XW1 + b1)W2 + b2, where X is the input, W1 and W2 are weight matrices, and b1 and b2 are bias terms.

[0112] In this way, through the above multi-head attention mechanism, feed-forward neural network, residual connection, and layer normalization, an Encoder block can be constructed, and multiple Encoder blocks stacked together can form an Encoder. For the Decoder part, different from the Encoder, the first multi-head attention of the Decoder uses a Masked operation, and such an autoregressive masking method can generate the next word based on the previous words.

[0113] S402. Based on the encoded information matrix and the preset low-rank matrix, the parameters of the pre-trained model are adjusted through the low-rank adaptation LoRA fine-tuning technology to obtain a test case generation model.

[0114] Among them, the pre-trained model is obtained by training the base model.

[0115] In a possible implementation, the LoRA fine-tuning technique adds a bypass matrix (low-rank matrix) on the basis of the above structure. Specifically, the core of the LoRA fine-tuning technique lies in the fact that the neural network weight matrix can be approximated by a low-rank matrix. For each weight matrix W in the pre-trained model, the LoRA fine-tuning technique can introduce a pair of trainable small matrices A and B (i.e., the preset low-rank matrix) such that W + A×B can be used as an effective approximate weight of the original weight.

[0116] It should be noted that the low-rank matrices A and B here have dimensions much smaller than the weight matrix W, thus significantly reducing the number of parameters to be trained.

[0117] Specifically, before starting to fine-tune the model, it is first necessary to freeze all the weights of the pre-trained model. Furthermore, for each layer to be fine-tuned, a correction term consisting of two parts (i.e., A×B) is added on the basis of its original weight matrix. Then, during the process of fine-tuning the model, only the newly added low-rank matrices A and B are updated, while the weight matrices of the original model remain unchanged.

[0118] Optionally, an appropriate initialization strategy and optimization algorithm can also be selected to ensure that the low-rank matrix can effectively learn the adjustment parameters required to adapt the model to the new task.

[0119] In the embodiments of the present application, the present application can determine the encoding information matrix of the reference function information and the reference test case, and based on the low-rank matrix, fine-tune the encoding information matrix through the LoRA fine-tuning technique, so as to adjust the parameters of the pre-trained model and obtain a test case generation model. In this way, through the low-rank matrix and the LoRA fine-tuning technique, the pre-trained model can be optimized to obtain a test case generation model with higher accuracy.

[0120] In some embodiments, as Figure 5 shown, in a test case generation method provided by the embodiments of the present application, the pre-trained model is obtained through the following steps, including S501 - S502:

[0121] S501. Obtain a training data set.

[0122] Among them, the training data set includes vehicle knowledge information, and the vehicle knowledge information includes at least one of the following: vehicle usage information, vehicle maintenance information, and vehicle servicing information.

[0123] S502. Based on the training data set, pre-train the base model to obtain a pre-trained model.

[0124] Optionally, the vehicle knowledge information included in the training data set can be the processed vehicle knowledge information obtained by preprocessing the initial vehicle knowledge information.

[0125] In some embodiments, the initial vehicle knowledge information may be obtained first; then, the initial vehicle knowledge information is preprocessed to obtain the processed vehicle knowledge information, and a preset number of data are selected from the processed vehicle knowledge information as the training data set.

[0126] Among them, the preprocessing includes at least one of the following: data cleaning, data format verification, data normalization processing, and data parsing.

[0127] Optionally, the initial vehicle knowledge information can be specifically obtained by collecting knowledge about vehicle use, vehicle maintenance, vehicle servicing, fault handling, etc. The data sources include but are not limited to automotive manuals, repair guides, online forums, user manuals, etc.

[0128] Optionally, for the obtained initial vehicle knowledge information, a large-scale vehicle knowledge corpus can be constructed, and then the large-scale corpus is preprocessed to clean the initial vehicle knowledge information in the large-scale corpus, removing noise and duplicate data, etc. And the processed vehicle knowledge information is used to construct the vehicle knowledge corpus.

[0129] In the embodiments of the present application, the present application may first obtain the initial vehicle knowledge information to preprocess the initial vehicle knowledge information to obtain the processed vehicle knowledge information. Thus, by selecting a preset number of data from the processed vehicle knowledge information as the training data set, a more accurate pre-trained model can be obtained when training the base model.

[0130] Optionally, the training data set can be composed of data obtained from the constructed vehicle industry knowledge corpus. Based on the training data set, the base model is pre-trained, so that the large language model (base model) can have the ability to understand the semantics and syntactic structures of vehicle knowledge.

[0131] Optionally, the base model can be an open-source pre-trained base model. Considering that the base model should have good generalization ability and performance, as well as the domain characteristics and resource situation of the model, the open-source Qwen2.5-32B-Base model can be selected as the base model for training. As the open-source large model is updated, a more suitable open-source large model can be selected as the base model for training.

[0132] In some embodiments, the training parameters are determined based on the data volume of the training data set and the model characteristics of the base model, and the base model is iteratively trained based on the training parameters and the training data set to obtain the pre-trained model.

[0133] Among them, the training parameters include at least one of the following: learning rate, batch size, warm-up steps, and number of iterations.

[0134] In the embodiments of the present application, the present application can determine training parameters based on the data volume of the training dataset and the model characteristics of the base model, and then iteratively train the base model based on the training parameters and the training dataset to obtain a pre-trained model. In this way, based on the data volume characteristics and model characteristics of the training dataset, accurate training parameters can be determined, and thus a more accurate pre-trained model can be obtained when training the base model.

[0135] In some embodiments, iteratively training the base model based on the training parameters and the training dataset to obtain a pre-trained model includes: determining a training metric, adjusting the training parameters based on the training metric, and training the base model based on the adjusted training parameters and the training dataset to obtain a trained base model. When the convergence degree of the trained base model meets a preset convergence degree, the trained base model is determined as the pre-trained model.

[0136] Among them, the training metric is used to indicate the convergence degree of the base model, and the training metric includes at least one of the following: loss value, accuracy, recall rate.

[0137] In the embodiments of the present application, the present application can determine a training metric when training the base model to determine the convergence degree of the trained base model. Then, the training parameters are adjusted based on the training metric, and the base model is iteratively trained based on the adjusted training parameters and the training dataset to obtain a pre-trained model whose convergence degree meets the preset convergence degree. In this way, the convergence degree of the model is judged through the training metric, and a pre-trained model that meets the expected conditions is trained, and a more accurate model can be trained.

[0138] In the embodiments of the present application, the present application can obtain a training dataset including vehicle knowledge information, so as to pre-train the base model through the training dataset to obtain a pre-trained model. In this way, the base model can be trained based on the vehicle knowledge information to obtain a pre-trained model with the ability to understand vehicle knowledge. Thus, when generating test cases for vehicle functions subsequently, the accuracy of generating test cases can be improved.

[0139] In some embodiments, the knowledge graph and the test case generation model can also be optimized based on the test cases of the function to be detected.

[0140] Exemplarily, according to the feedback and satisfaction of the user with the test cases of the function to be detected, the system (knowledge graph and test case generation model) can be optimized and updated. Specifically, the problem parsing algorithm can be improved, new vehicle knowledge entries can be added, the answer generation strategy can be optimized, etc. At the same time, the large pre-trained model can be updated regularly to adapt to the continuous update and development of vehicle knowledge.

[0141] In an embodiment of the present application, after generating test cases for the function to be detected, the present application can optimize the knowledge graph and the test case generation model based on the generated test cases, so as to further improve the accuracy of the generated test cases when generating test cases subsequently.

[0142] In a complete embodiment, as Figure 6 shown, knowledge in aspects such as vehicle usage information, vehicle maintenance information, vehicle servicing information, and fault handling information can be obtained first, and based on the obtained knowledge, a vehicle knowledge corpus can be constructed. Then, the data information included in the vehicle knowledge corpus can be subjected to data cleaning and preprocessing, and based on the data information included in the processed vehicle knowledge corpus, the large language model can be incrementally trained to obtain a pre-trained model. Further, the function information of the vehicle and the test cases corresponding to the function information can be obtained, and the obtained function information and test cases can be subjected to data cleaning and preprocessing to obtain the processed function information and test cases. Then, instruction data can be constructed based on the processed function information and test cases, and the pre-trained model can be fine-tuned by LoRA based on the instruction data to obtain the required test case generation model. At the same time, the processed function information and test cases, as well as the obtained vehicle model projects, can be analyzed to construct entity relationships and stored in the database. Thus, a knowledge graph can be constructed based on the data stored in the database.

[0143] In this way, based on the above process, when a test case generation request is obtained, relevant knowledge (i.e., the target function information and target test cases corresponding to the request) can be retrieved from the knowledge graph, and model input information (prompt words) can be constructed according to the retrieved relevant knowledge. Thus, based on the constructed model input information, the test case generation model can be called to generate test cases. And the system can be optimized and updated based on the generated test cases.

[0144] The method provided by the embodiment of the present application is used to generate test cases for the functions of new energy vehicles. The purpose of this method is to enhance the understanding ability of the large language model for vehicle domain knowledge through incremental pre-training, knowledge graph construction, LoRA fine-tuning technology, etc., so as to achieve accurate function analysis, realize efficient and accurate automatic generation of test cases, and thus improve the R & D efficiency and product quality of new energy vehicles. And by introducing the knowledge graph, relevant knowledge and information in the new energy vehicle field can be systematically integrated, thus providing a comprehensive and accurate information basis for the design of test cases. In addition, the fine-tuning technology can further refine the test cases according to specific function requirements to ensure a high degree of fit between the test cases and the actual situation, thereby improving the accuracy and comprehensiveness of the test.

[0145] Through automated and intelligent means, test cases for the functions of new energy vehicles can be quickly generated. This can greatly reduce labor costs and improve the efficiency of test case generation. Moreover, the test cases generated based on the knowledge graph and fine-tuning of the large language model have good reusability and scalability. The entities and relationships in the knowledge graph can be continuously updated as new energy vehicles continue to develop, and the large language model can also adapt to new test requirements through continuous learning and fine-tuning. Therefore, the test cases generated by this method can be continuously updated and improved with the iteration of technology, maintaining their long-term effectiveness.

[0146] The above mainly introduced the solution provided by the embodiments of the present application from the perspective of the method. To implement the above functions, the test case generation device or electronic device includes the corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving the hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0147] The embodiments of the present application can, according to the above method, exemplarily divide the functional modules of the test case generation device or electronic device. For example, the test case generation device or electronic device may include each functional module corresponding to each functional division, or two or more functions may be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiments of the present application is illustrative, only a logical functional division, and there may be other division methods in actual implementation.

[0148] Figure 7 is a block diagram of a test case generation device shown according to an exemplary embodiment. Referring to Figure 7 , the test case generation device 700 includes: an acquisition module 701 and a processing module 702; the acquisition module 701 is configured to obtain target function information and target test cases from the knowledge graph based on a test case generation request, the test case generation request is used to request the generation of test cases for the to-be-detected function of the to-be-detected vehicle, the knowledge graph includes the corresponding relationship between reference function information and reference test cases, and the target function information and target test cases are associated with the to-be-detected function; the receiving module is configured to generate test cases for the to-be-detected function based on the test case generation request, target function information, and target test cases.

[0149] In a possible implementation, the processing module 702 is specifically configured to determine the model input information of the test case generation request based on the target function information and the target test case, and the model input information is used to indicate the function to be detected; the processing module 702 is specifically configured to input the model input information, the target function information, and the target test case into the test case generation model to generate the test case of the function to be detected.

[0150] In a possible implementation, the processing module 702 is further configured to determine the coding information matrix of the reference function information and the reference test case; the processing module 702 is further configured to adjust the parameters of the pre-trained model through the low-rank adaptation LoRA fine-tuning technique based on the coding information matrix and the preset low-rank matrix to obtain the test case generation model, and the pre-trained model is obtained by training the base model.

[0151] In a possible implementation, the acquisition module 701 is further configured to acquire a training data set, and the training data set includes vehicle knowledge information, and the vehicle knowledge information includes at least one of the following: vehicle usage information, vehicle maintenance information, vehicle maintenance information; the processing module 702 is further configured to pre-train the base model based on the training data set to obtain the pre-trained model.

[0152] In a possible implementation, the acquisition module 701 is specifically configured to acquire the initial vehicle knowledge information; the processing module 702 is further configured to preprocess the initial vehicle knowledge information to obtain the processed vehicle knowledge information, and the preprocessing includes at least one of the following: data cleaning, data format verification, data normalization processing, data parsing; the processing module 702 is further configured to select a preset number of data from the processed vehicle knowledge information as the training data set.

[0153] In a possible implementation, the processing module 702 is specifically configured to determine the training parameters based on the data volume of the training data set and the model characteristics of the base model, and the training parameters include at least one of the following: learning rate, batch size, warm-up steps, number of iterations; the processing module 702 is specifically configured to iteratively train the base model based on the training parameters and the training data set to obtain the pre-trained model.

[0154] In a possible implementation, the processing module 702 is specifically configured to determine the training metrics, and the training metrics are used to indicate the convergence degree of the base model, and the training metrics include at least one of the following: loss value, accuracy, recall rate; the processing module 702 is specifically configured to adjust the training parameters based on the training metrics, and based on the adjusted training parameters and the training data set, train the base model to obtain the trained base model; the processing module 702 is specifically configured to determine the trained base model as the pre-trained model when the convergence degree of the trained base model meets the preset convergence degree.

[0155] In a possible implementation, the obtaining module 701 is further configured to obtain initial function information and initial test cases; the processing module 702 is further configured to eliminate error data in the initial function information and the initial test cases, and eliminate initial function information that has no corresponding relationship with any of the initial test cases, so as to obtain reference function information and reference test cases; the processing module 702 is further configured to construct a knowledge graph based on the reference function information and the reference test cases.

[0156] In a possible implementation, the processing module 702 is further configured to optimize the knowledge graph and the test case generation model based on the test cases of the function to be detected.

[0157] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.

[0158] Figure 8 It is a block diagram of an electronic device (server) shown according to an exemplary embodiment. As Figure 8 shown, the electronic device 800 includes but is not limited to: a processor 801 and a memory 802.

[0159] Among them, the above-mentioned memory 802 is used to store executable instructions of the above-mentioned processor 801. It can be understood that the above-mentioned processor 801 is configured to execute instructions to implement the test case generation method in the above embodiments.

[0160] It should be noted that those skilled in the art can understand that Figure 8 the structure of the electronic device shown in Figure 8 does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than

[0161] shown, or combine some components, or arrange different components.

[0162] The memory 802 can be used to store software programs and various data. The memory 802 mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required by at least one functional module (such as a processing module, etc.). In addition, the memory 802 can include high-speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0163] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as the memory 802 including instructions. The above instructions can be executed by the processor 801 of the electronic device 800 to implement the test case generation method in the above embodiment.

[0164] In actual implementation, Figure 7 the functions of the acquisition module 701 and the processing module 702 in Figure 8 can be implemented by the processor 801 in

[0165] calling a computer program stored in the memory 802. The specific execution process can refer to the description in the test case generation method part of the above embodiment, which will not be elaborated here.

[0166] Optionally, the computer-readable storage medium can be a non-transitory computer-readable storage medium. For example, the non-transitory computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0167] It should be noted that when the instructions in the above computer-readable storage medium or the one or more instructions in the computer program product are executed by the processor of the electronic device, each process of the test case generation method embodiment is implemented, and the same technical effects as the above test case generation method can be achieved. To avoid repetition, it will not be elaborated here.

[0168] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0169] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.

[0170] The units described as separate components may or may not be physically separated. The components displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0171] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0172] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks or optical discs that can store program codes.

[0173] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A test case generation method, characterized in that: The method comprises: Based on a test case generation request, obtaining target function information and target test cases from a knowledge graph, wherein the test case generation request is used to request generation of a test case for a function to be detected of a vehicle to be detected, the knowledge graph includes a correspondence between reference function information and reference test cases, and the target function information and the target test case are associated with the function to be detected; A test case for the function to be tested is generated based on the test case generation request, the target function information and the target test case.

2. The test case generation method according to claim 1, characterized in that: The step of generating a test case for the function to be tested based on the test case generation request, the target function information and the target test case includes: Determining model input information of the test case generation request based on the target function information and the target test case; The model input information, the target function information and the target test case are input into a test case generation model to generate a test case for the function to be tested.

3. The test case generation method according to claim 2, characterized in that: The test case generation model is obtained in the following way: Determining a coding information matrix of the reference functional information and the reference test case; Based on the coding information matrix and the preset low-rank matrix, the parameters of the pre-trained model are adjusted through the low-rank adaptive LoRA fine-tuning technology to obtain the test case generation model, and the pre-trained model is obtained by training the base model.

4. The test case generation method according to claim 3, characterized in that: The pre-trained model is obtained in the following way: Acquire a training data set, wherein the training data set includes vehicle knowledge information, and the vehicle knowledge information includes at least one of the following: vehicle use information, vehicle maintenance information, and vehicle care information; Based on the training data set, the base model is pre-trained to obtain the pre-trained model.

5. The test case generation method according to claim 4, characterized in that: The step of obtaining a training data set includes: Acquire initial vehicle knowledge information; Preprocessing the initial vehicle knowledge information to obtain processed vehicle knowledge information, wherein the preprocessing includes at least one of the following: data cleaning, data format verification, data normalization processing, and data analysis; A preset amount of data is selected from the processed vehicle knowledge information as the training data set.

6. The test case generation method according to claim 4, characterized in that: The pre-training of the base model based on the training data set to obtain the pre-trained model includes: Determining training parameters based on the data volume of the training data set and the model characteristics of the base model, wherein the training parameters include at least one of the following: learning rate, batch size, number of warm-up steps, and number of iterations; Based on the training parameters and the training data set, the base model is iteratively trained to obtain the pre-trained model.

7. The test case generation method according to claim 6, characterized in that: The iterative training of the base model based on the training parameters and the training data set to obtain the pre-trained model includes: Determine a training indicator, where the training indicator is used to indicate the convergence degree of the base model, and the training indicator includes at least one of the following: loss value, accuracy, and recall rate; Adjusting the training parameters based on the training indicators, and training the base model based on the adjusted training parameters and the training data set to obtain a trained base model; When the convergence degree of the trained base model meets the preset convergence degree, the trained base model is determined as the pre-trained model.

8. The test case generation method according to claim 1, characterized in that: The knowledge graph is obtained in the following way: Get initial functional information and initial test cases; Eliminating erroneous data in the initial function information and the initial test case, and eliminating initial function information that has no corresponding relationship with any of the initial test cases, to obtain the reference function information and the reference test case; Based on the reference function information and the reference test cases, the knowledge graph is constructed.

9. The test case generation method according to claim 1, characterized in that: The method further comprises: Based on the test cases of the function to be tested, the knowledge graph and the test case generation model are optimized.

10. A test case generating device, characterized in that: The test case generation device comprises: an acquisition module and a processing module; The acquisition module is used to acquire target function information and target test cases from the knowledge graph based on a test case generation request, wherein the test case generation request is used to request generation of a test case for a function to be detected of a vehicle to be detected, the knowledge graph includes a correspondence between reference function information and reference test cases, and the target function information and target test cases are associated with the function to be detected; The receiving module is used to generate a test case for the function to be tested based on the test case generation request, the target function information and the target test case.

11. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the test case generation method as described in any one of claims 1-9.

12. A computer-readable storage medium, characterized in that: When the computer-executable instructions stored in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the test case generating method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Method and device for remotely testing vehicle machine in different places and medium

    CN120849298A

  • Test case generation method and device, equipment and computer program product

    CN121070344A