Automobile software test script generation method and device, electronic equipment and storage medium

By breaking down test steps into structured elements of actions, objects, and parameters, and combining them with business logic from the automotive testing domain, the system filters interfaces from an API knowledge base to generate accurate executable test scripts. This solves the problem of inaccurate API mapping in traditional tools and enables highly efficient automated testing.

CN121858445APending Publication Date: 2026-04-14NEUSOFT REACH AUTOMOBILE TECH (SHENYANG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-30
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Traditional automotive software test script generation tools cannot effectively handle the diversity and complexity of natural language, resulting in inaccurate API mapping and poor accuracy of the generated automated test scripts.

Method used

By using natural language processing technology, the test steps are broken down into structured elements of actions, objects, and parameters. Combined with the business logic of the automotive testing field, the most matching interfaces are selected from the API knowledge base to generate executable test scripts.

Benefits of technology

It significantly improves the accuracy of API mapping and its adaptability to natural language variability, and generates accurate test scripts, solving the problem of poor accuracy in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121858445A_ABST
    Figure CN121858445A_ABST
Patent Text Reader

Abstract

The invention provides an automobile software test script generation method and device, electronic equipment and a storage medium, in the method, a test step is decomposed into three structured elements of action-object-parameter through a natural language processing technology, and context association analysis is carried out in combination with service logic in the automobile test field; according to the method, the API interface corresponding to the structured element is screened from the API knowledge base, the leap from character matching to semantic understanding is achieved, the accuracy of API mapping and the adaptive capacity to natural language variability are greatly improved, the corresponding API interface obtained through mapping is accurate, and then the accuracy of the executable test script finally generated according to the corresponding API interface is good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of automotive automated testing, and in particular to a method, apparatus, electronic device, and storage medium for generating automotive software test scripts. Background Technology

[0002] In the field of automotive software testing, with the rapid development of vehicle intelligence and electrification, test case libraries are growing increasingly large, typically containing thousands of test cases to verify the functionality, message interaction, and system stability of electronic control units (ECUs). These test cases are often described in natural language and stored in libraries in formats such as Excel, covering aspects such as vehicle diagnostics, software upgrades, and system verification. Traditional test script generation relies on manual methods, mapping test case steps to API calls (such as setting signal values ​​or waiting for message responses), which is inefficient and prone to errors.

[0003] In existing technologies, some automation tools achieve limited API mapping through keyword matching, but they cannot handle the variability of natural language descriptions (such as the semantic equivalence between "simulating sending a 101A message" and "triggering vehicle communication signals"). Especially in complex scenarios in the automotive field (such as ECU diagnostic session establishment and vehicle state transitions), existing methods struggle to achieve accurate automated script generation.

[0004] Traditional automated tools for generating automotive software test scripts have the following drawbacks: Natural language variability: The same operation in the automotive use case library has multiple forms of expression, and existing tools cannot accurately match the API interface, requiring a lot of manual intervention; Low efficiency in prompt generation: Existing methods rely on manually designing prompt templates, making it difficult to automatically extract common patterns from validated scripts, which limits the automated processing of large-scale test case libraries; Inaccurate API filtering: Lacking semantic analysis capabilities, it is unable to filter the most matching API interfaces based on automotive business logic (such as vehicle diagnostic processes), and the generated scripts often need to be modified multiple times; Limited applicability: Existing technologies are limited to specific automotive testing frameworks (such as OTA upgrades) and are difficult to extend to other automotive fields (such as ECU diagnostics and vehicle network testing). Large-scale processing bottleneck: When faced with thousands of use cases, existing methods cannot efficiently generate scripts in batches and lack parallel processing and iterative optimization mechanisms.

[0005] In summary, traditional keyword matching cannot handle the diversity and complexity of natural language, resulting in inaccurate API mapping and ultimately poor accuracy in the generated automated test scripts. Summary of the Invention

[0006] In view of this, the purpose of the present invention is to provide a method, apparatus, electronic device and storage medium for generating automotive software test scripts, so as to alleviate the technical problem that traditional keyword matching cannot handle the diversity and complexity of natural language, resulting in inaccurate API mapping and poor accuracy of the generated automated test scripts.

[0007] In a first aspect, the present invention provides a method for generating automotive software test scripts, comprising: Read and parse test cases from the automotive test case library to obtain structured test case data, wherein the structured test case data includes: test case ID, test case description, preconditions, test steps and expected results; The test steps in the structured test case data are decomposed into three structured elements: action, object, and parameter using natural language processing technology. Based on a pre-built API knowledge base and business logic in the automotive testing field, the decomposed structured elements are mapped to the corresponding API interfaces. Generate an executable test script containing the corresponding API calls based on the corresponding API interface.

[0008] Furthermore, the method also includes: The system receives at least one pair of verified test cases and their corresponding correct test scripts as input. It analyzes the API call sequence in the correct test scripts, reverse-engineers a general prompt word template that can generate the API call sequence, and uses the general prompt word template to optimize the API knowledge base.

[0009] Furthermore, natural language processing technology is used to decompose the test steps in the structured use case data into three structured elements: actions, objects, and parameters, including: Named entity recognition or dependency parsing techniques are used to identify action elements representing operation types, object elements representing operation targets, and parameter elements representing operation constraints from the test steps.

[0010] Furthermore, based on a pre-built API knowledge base and business logic in the automotive testing domain, the decomposed structured elements are mapped to corresponding API interfaces, including: Calculate the semantic similarity between the structured element and each API interface in the API knowledge base to obtain a semantic matching score; Based on the business logic of the automotive testing field, the degree of conformity of each API interface to the test steps is verified to obtain the business logic confidence level; The comprehensive score of each API interface is calculated based on the semantic matching score and the business logic confidence score, and the API interface with the highest comprehensive score is selected as the API interface corresponding to the structured element.

[0011] Furthermore, the method also includes: Receive user feedback on the generated executable test scripts; The API knowledge base is optimized based on the feedback information.

[0012] Furthermore, the automotive software test script generation method executes multiple test cases in parallel to achieve batch generation of executable test scripts from the test case library.

[0013] Furthermore, the API knowledge base is a structured document in JSON or XML format, wherein each record contains: API function name, function description, parameter list, and associated automotive business logic tag.

[0014] Secondly, the present invention also provides an automotive software test script generation device, comprising: The reading and parsing unit is used to read and parse test cases in the automotive test case library to obtain structured test case data, wherein the structured test case data includes: test case ID, test case description, preconditions, test steps and expected results; The decomposition unit is used to decompose the test steps in the structured use case data into three structured elements: action, object, and parameter, using natural language processing technology. The mapping unit is used to map the decomposed structured elements to the corresponding API interfaces based on a pre-built API knowledge base and business logic in the automotive testing field. The generation unit is used to generate an executable test script containing the corresponding API interface calls based on the corresponding API interface.

[0015] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the method described in the first aspect.

[0016] Fourthly, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the method described in the first aspect.

[0017] This invention provides a method for generating automotive software test scripts, comprising: reading and parsing test cases in an automotive test case library to obtain structured test case data, wherein the structured test case data includes: test case ID, test case description, preconditions, test steps, and expected results; decomposing the test steps in the structured test case data into three structured elements: actions, objects, and parameters using natural language processing technology; mapping the decomposed structured elements to corresponding API interfaces based on a pre-built API knowledge base and business logic in the automotive testing domain; and generating an executable test script containing corresponding API interface calls based on the corresponding API interfaces. As described above, the automotive software test script generation method of the present invention decomposes the test steps into three structured elements—"action-object-parameter"—using natural language processing technology. It also performs contextual analysis based on the business logic of the automotive testing field, selecting the corresponding API interfaces from the API knowledge base. This achieves a leap from "character matching" to "semantic understanding," significantly improving the accuracy of API mapping and its adaptability to the variability of natural language. The mapped API interfaces are accurate, resulting in highly accurate executable test scripts generated based on these API interfaces. This alleviates the technical problem of traditional keyword matching being unable to handle the diversity and complexity of natural language, leading to inaccurate API mapping and ultimately poor accuracy in the generated automated test scripts. Attached Figure Description

[0018] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 A flowchart illustrating a method for generating automotive software test scripts according to an embodiment of the present invention; Figure 2 This is a diagram illustrating the reverse prompt word generation architecture provided in an embodiment of the present invention. Figure 3 This is a schematic diagram of the prompt word segmentation structure provided in an embodiment of the present invention; Figure 4 A complete flowchart from use case parsing to script generation is provided for embodiments of the present invention; Figure 5 A schematic diagram illustrating API knowledge base matching provided in an embodiment of the present invention; Figure 6 A schematic diagram illustrating a new use case in Python format provided in an embodiment of the present invention; Figure 7A schematic diagram of an automotive software test script generation device provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0020] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] Traditional keyword matching cannot handle the diversity and complexity of natural language, resulting in inaccurate API mapping and ultimately poor accuracy in the generated automated test scripts.

[0022] Based on this, the automotive software test script generation method of the present invention decomposes the test steps into three structured elements, namely "action-object-parameter", through natural language processing technology, and performs contextual analysis in conjunction with the business logic of the automotive testing field. It selects the API interfaces corresponding to the structured elements from the API knowledge base, realizing a leap from "character matching" to "semantic understanding", which greatly improves the accuracy of API mapping and the ability to adapt to the variability of natural language. The corresponding API interfaces obtained by mapping are accurate, and the executable test scripts generated based on the corresponding API interfaces are ultimately accurate.

[0023] To facilitate understanding of this embodiment, a method for generating automotive software test scripts disclosed in this embodiment of the invention will first be described in detail.

[0024] Example 1: According to an embodiment of the present invention, an embodiment of a method for generating automotive software test scripts is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0025] Figure 1 This is a flowchart of a method for generating automotive software test scripts according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps: Step S102: Read and parse the test cases in the automotive test case library to obtain structured test case data. The structured test case data includes: test case ID, test case description, preconditions, test steps, and expected results. Specifically, this process is implemented by the test case parsing module. It reads test cases from the automotive test case library in Excel format, parses them into standard JSON format (i.e., structured test case data), and extracts the test case ID, test case description, preconditions, test steps, and expected results, supporting automotive-specific test cases (such as ECU message interaction).

[0026] Step S104: Using natural language processing technology, the test steps in the structured use case data are decomposed into three structured elements: actions, objects, and parameters. Specifically, this process is implemented by the prompt word segmentation module. Through natural language processing (NLP) technology, the test steps in the structured test case data are decomposed into structured elements (i.e. prompt words): actions (such as "simulate sending", "diagnostic session establishment"), objects (such as "101A message", "ECU signal"), and parameters (such as "3 seconds", "timeout 60 seconds").

[0027] Step S106: Based on the pre-built API knowledge base and the business logic of the automotive testing field, map the decomposed structured elements to the corresponding API interfaces. Specifically, this process is implemented by the API filtering module. Based on a domain-independent API knowledge base (JSON format) and semantic analysis of business logic in the automotive testing domain (such as vehicle diagnostic sequence), it automatically filters and decomposes the structured elements to find the most matching API interfaces (i.e., the corresponding API interfaces), supporting automotive-related APIs (such as set_value for signal settings).

[0028] Step S108: Generate an executable test script containing the corresponding API interface calls based on the corresponding API interface.

[0029] Specifically, this process is implemented by the script generation module. It concatenates the matched API interfaces, objects, and parameters to generate executable test script code that conforms to the syntax rules (such as set_value("SendDataTCP_101A", 1)).

[0030] This invention provides a method for generating automotive software test scripts, comprising: reading and parsing test cases in an automotive test case library to obtain structured test case data, wherein the structured test case data includes: test case ID, test case description, preconditions, test steps, and expected results; decomposing the test steps in the structured test case data into three structured elements: actions, objects, and parameters using natural language processing technology; mapping the decomposed structured elements to corresponding API interfaces based on a pre-built API knowledge base and business logic in the automotive testing domain; and generating an executable test script containing corresponding API interface calls based on the corresponding API interfaces. As described above, the automotive software test script generation method of the present invention decomposes the test steps into three structured elements—"action-object-parameter"—using natural language processing technology. It also performs contextual analysis based on the business logic of the automotive testing field, selecting the corresponding API interfaces from the API knowledge base. This achieves a leap from "character matching" to "semantic understanding," significantly improving the accuracy of API mapping and its adaptability to the variability of natural language. The mapped API interfaces are accurate, resulting in highly accurate executable test scripts generated based on these API interfaces. This alleviates the technical problem of traditional keyword matching being unable to handle the diversity and complexity of natural language, leading to inaccurate API mapping and ultimately poor accuracy in the generated automated test scripts.

[0031] The above provides a brief overview of the automotive software test script generation method of the present invention. The specific details involved are described in detail below.

[0032] In an optional embodiment of the present invention, the method further includes the following steps: It receives at least one pair of verified test cases and the corresponding correct test script as input, analyzes the API call sequence in the correct test script, reverse-engineers a general prompt word template that can generate API call sequences, and uses the general prompt word template to optimize the API knowledge base.

[0033] Specifically, this process is implemented by the reverse prompt word generation module. For example... Figure 2 As shown, starting from a pair of verified inputs (test case, correct test script), the API call sequence (such as set_value, wait_canframe) in the correct test script is analyzed, and a general prompt word template is generated by reverse inference. This template is then optimized into a reusable template across test cases, thus optimizing the API knowledge base.

[0034] In an alternative embodiment of the present invention, reference is made to... Figure 3 By using natural language processing technology, the test steps in structured use case data are decomposed into three structured elements: actions, objects, and parameters. Specifically, the steps include the following: Named entity recognition or dependency parsing techniques are used to identify action elements representing operation types, object elements representing operation targets, and parameter elements representing operation constraints from the test steps, thereby obtaining three structured elements: action, object, and parameter.

[0035] In an optional embodiment of the present invention, based on a pre-built API knowledge base and business logic in the automotive testing field, the decomposed structured elements are mapped to corresponding API interfaces, specifically including the following steps: (1) Calculate the semantic similarity between the structured elements and each API interface in the API knowledge base to obtain the semantic matching score; (2) Verify the degree of conformity of each API interface to the test steps based on the business logic of the automotive testing field, and obtain the business logic confidence level; (3) Calculate the comprehensive score of each API interface based on the semantic matching score and business logic confidence, and select the API interface with the highest comprehensive score as the API interface corresponding to the structured element.

[0036] In an optional embodiment of the present invention, the method further includes the following steps: (1) Receive feedback from users on the generated executable test scripts; (2) Optimize the API knowledge base based on feedback information.

[0037] Specifically, this process is implemented by an iterative optimization module. It collects user feedback on the generated executable test scripts through a multi-turn dialogue mechanism, dynamically adjusts prompts (i.e., the three structured elements of action, object, and parameter) and API mapping, and optimizes the API knowledge base (an API knowledge base is a structured database (commonly in JSON format in this invention), which is the "brain" or "dictionary" of the entire system. This knowledge base stores information on all available API interfaces, as well as natural language descriptions and applicable scenarios for each API, serving as the bridge and basis for mapping "prompts" to "API interfaces"), supporting adaptive testing in the automotive field (e.g., extending from vehicle diagnostics to software upgrade testing).

[0038] In an optional embodiment of the present invention, the automotive software test script generation method executes multiple test cases in parallel to achieve batch generation of executable test scripts from a test case library.

[0039] Specifically, this process is implemented by a parallel processing module. It employs Python multithreading technology to accelerate the batch processing of a large-scale test case library (thousands of cases).

[0040] In an optional embodiment of the present invention, the API knowledge base is a structured document in JSON or XML format, wherein each record contains: API function name, function description, parameter list and associated automotive business logic tag.

[0041] The above process will be further illustrated with a specific example below, such as... Figure 4 As shown: 1. Use Case Parsing: Read the Excel use case library and convert it to JSON format. For example, the automotive use cases "simulate IVI sending 101A message" and "diagnose ECU status" are parsed into a structured list of steps.

[0042] 2. Cue word segmentation: AI extracts common elements through NLP analysis steps:

[0043] 3. API Filtering: Matching is performed using an API knowledge base. For API knowledge bases in JSON format, the matching process is as follows: Figure 5 As shown.

[0044] Output: Car use cases are mapped to set_value, and diagnostic use cases are mapped to wait_canframe.

[0045] 4. Reverse suggestion word generation: Input a pair (use case, script), such as: Car script: set_value("SendDataTCP_101A",1) AI inference: The general template "simulates sending a {message ID} message" Diagnostic script: wait_canframe("ECU_status",60) AI inference: General template "Diagnose {object} state, wait {time} seconds" 5. Iterative optimization: User feedback "Vehicle timeout verification needs to be supported", AI generates a new template "Wait for {time} to verify {condition}" → wait_for_element(timeout={time}).

[0046] 6. Cross-domain script generation: Apply optimized templates to new use cases, such as new use cases in Python format. Figure 6 As shown.

[0047] Through reasoning analysis and comparison with applications in the automotive field, the present invention achieves the following beneficial effects, listed in order of importance: 1. Improve script generation accuracy: Through prompt word segmentation and semantic analysis, accurately match API interfaces (such as set_value corresponding to "simulated sending"), reducing manual correction workload by 80%.

[0048] 2. Improve the efficiency of large-scale test case processing: Parallel processing and batch generation support thousands of test cases, which is more than 10 times more efficient than traditional manual writing (assuming that it takes 5 minutes to write a single test case manually, and 30 seconds for automation).

[0049] 3. Enhanced reusability of prompt words: The reverse-generated general prompt word templates can be directly applied to 80% of new use cases, reducing the prompt word design cost for new domain testing (such as from OTA upgrades to vehicle diagnostics).

[0050] 4. Reduce maintenance costs: Automatically update the API knowledge base and mark "pending" items for manual review, reducing the workload of later maintenance.

[0051] 5. Support for automotive applications: By integrating with automotive business logic (such as ECU diagnostic processes and message interactions), ensure that API selection meets vehicle testing requirements and improve test coverage.

[0052] The main technical features of this invention include: 1. Prompt word segmentation mechanism: By using NLP to decompose the steps of any domain use case into domain-independent structured elements (actions, objects, parameters), and combining business logic semantic analysis to filter API interfaces, a general API mapping can be achieved, which cannot be achieved by existing keyword matching technologies.

[0053] 2. Reverse generation from script to prompt words: From a pair of validated inputs (use case, script), a general prompt word template (such as "simulate {object} sending {message}") is automatically inferred. Through multiple rounds of iterative optimization, it is optimized into a template that can be reused across use cases, solving the problem that traditional methods cannot automatically generate prompt words.

[0054] 3. Adaptive API Filtering Based on Business Logic: Combines business rules in the testing domain (such as automotive ECU diagnostic sequence and vehicle network interaction logic) to dynamically filter the most suitable API interfaces, supporting domain-adaptive expansion.

[0055] 4. Large-scale use case parallel processing architecture: It adopts Python multi-threading + AI batch calling mechanism to support real-time processing of thousands of use cases and online updates of knowledge base, ensuring mapping accuracy and system stability.

[0056] Example 1: Automotive OTA Upgrade Test Application 1. Input example: "Simulate IVI sending 101A message, wait 3 seconds, and then send 100A message".

[0057] 2. Prompt word segmentation: Action "Simulate Sending" → set_value, Object "101A Message" → "SendDataTCP_101A".

[0058] 3. API filtering: Generate set_value("SendDataTCP_101A",1).

[0059] 4. Reverse generation: The template "simulates sending {message ID} message" is derived from the script and applied to other OTA use cases.

[0060] Example 2: Application of automotive vehicle diagnostic testing 1. Input test case: "Diagnose ECU status, wait 60 seconds to verify response".

[0061] 2. Prompt word segmentation: Action "Diagnosis" → wait_canframe, Object "ECU Status" → "ECU_status".

[0062] 3. API filtering: Generate wait_canframe("ECU_status",60).

[0063] 4. Reverse generation: The template "Diagnose {object} state, wait {time} seconds" can be applied to other diagnostic test cases.

[0064] Example 3: Migration in the Automotive Industry 1. In the OTA knowledge base, the "simulate sending 101A message" → set_value mapping.

[0065] 2. Migrate to vehicle diagnostic test: Generate "Diagnostic {ECU} status" → wait_canframe("{ECU}").

[0066] 3. Migrate to automotive network testing: Generate "Verify {Message} interaction" → check_value("{Message}").

[0067] Example 4: Large-scale use case processing 1. Processed 5000 Excel test cases, with 90% automatic mapping success.

[0068] 2.10% were marked "pending" and manually supplemented to achieve 100% coverage.

[0069] 3. Generate 5000 Python scripts, taking a total of 2.5 hours.

[0070] This invention is applicable to test automation scenarios in the automotive field (such as vehicle ECU diagnostic testing, software upgrade verification, system interaction testing, etc.). It can filter accurate API interfaces based on business logic and use case descriptions, and generate prompt word templates by analyzing executable Python scripts.

[0071] This invention addresses the pain point in automotive software testing: the inefficiency, error-proneness, and maintainability of manually converting massive amounts of test cases described in natural language into executable test scripts. The solution involves building an AI-driven, data-driven automated pipeline that uses Natural Language Processing (NLP) and machine learning technologies to achieve intelligent conversion and continuous optimization from test cases to scripts.

[0072] The main content is as follows: 1. Core Architecture: A Seven-Module Collaborative Intelligent Pipeline This solution designs an intelligent system consisting of seven core modules, which together form a closed loop from "understanding requirements" to "generating code" and then to "self-evolution": Test Case Parsing Module: Responsible for data access, parsing test case libraries in different formats (such as Excel) into structured data (such as JSON) that is easy for the program to process, preparing for subsequent AI processing.

[0073] Prompt word segmentation module (core AI capability 1): This is a crucial first step towards automation. It uses NLP technology to deconstruct a test step described in natural language (such as "simulate IVI sending a 101A message") into a machine-understandable structured triple: (action = "simulate sending", object = "101A message", parameter = ""). This deconstruction transforms non-standard natural language into standardized elements that can be precisely processed by a computer.

[0074] API filtering module: Internally maintains an API knowledge base (such as a JSON file). This module receives the triples output by the "prompt word segmentation module" and, based on the business logic in the automotive field (such as the diagnostic process requiring entry into a session before reading and writing data), matches the most suitable API function from the knowledge base to perform the action (e.g., matching "simulate sending" to the set_value function).

[0075] The script generation module concatenates the matched API functions, objects, and parameters to generate executable test script code that conforms to the syntax rules (such as set_value("SendDataTCP_101A", 1)).

[0076] The reverse prompt word generation module (core AI capability 2, key to self-learning): This is the innovative highlight of this solution. It implements a reverse process: given a pair of (use cases, scripts) that has been manually verified, it analyzes the API call sequence in the script and reversely derives a more general prompt word template corresponding to that script (e.g., deriving the template "simulate sending {message ID} message" from set_value("SendDataTCP_101A", 1)). This allows the system to learn from historical experience and continuously enrich and optimize its "knowledge".

[0077] Iterative optimization module: Provides a feedback loop. Users can provide feedback on the generated scripts, and the system dynamically adjusts the mapping relationship between the prompt word templates and the API based on the feedback, achieving continuous optimization that gets smarter with use.

[0078] Parallel processing module: To handle large-scale scenarios with thousands of use cases in the automotive industry, multi-threading and other technologies are used to process multiple use cases in parallel, greatly improving overall generation efficiency.

[0079] 1.2. Workflow: From handling individual use cases to achieving system self-learning Scenario 1: Handling a new field for the first time (e.g., transitioning from OTA upgrades to vehicle diagnostics) 2. Initial Phase: The system utilizes its built-in general "prompt word segmentation" capability to attempt to parse vehicle diagnostic use cases. Due to a lack of domain knowledge, API matching may be inaccurate.

[0080] 3. Manual intervention: Engineers manually correct the generated scripts and confirm a correct set of (diagnostic test cases, diagnostic scripts) pairs.

[0081] 4. System Learning: Input the correct pairing into the reverse prompt word generation module. The module automatically analyzes and extracts a special prompt word template suitable for the "vehicle diagnostics" field (such as "diagnose {object} status").

[0082] 5. Improved Efficiency: Subsequently, when the system processed similar diagnostic test cases, the accuracy of the generated scripts was greatly improved due to the dedicated template.

[0083] Scenario 2: Batch Script Generation 1. The user imports an Excel file containing 5000 test cases.

[0084] 2. The parallel processing module distributes tasks to multiple threads.

[0085] 3. Each thread independently executes the "parsing → cutting → filtering → generating" pipeline.

[0086] 4. Finally, 5000 Python test scripts are output in batches. Cases with low matching confidence are marked and handed over to manual review.

[0087] The inventive points of this invention are as follows: Invention Point 1: A precise API mapping mechanism based on NLP prompt word segmentation and business logic semantic analysis Technical problem solved: Traditional keyword matching cannot handle the diversity and complexity of natural language, resulting in inaccurate API mapping.

[0088] Technical approach: Use NLP to deconstruct use case steps into "action-object-parameter" triples, and combine them with the business logic semantics of the automotive field (such as diagnostic processes) to perform contextual association analysis, and then select the most matching interface from the API knowledge base.

[0089] Technical results: It has achieved a leap from "character matching" to "semantic understanding", which has greatly improved the accuracy of API mapping and its ability to adapt to the variability of natural language.

[0090] Invention Point Two: A self-learning mechanism based on a verified script to reverse-generate a universal prompt word template The technical problem to be solved: Prompt word templates have traditionally relied on manual design and maintenance, which is costly and difficult to expand.

[0091] Technical approach: From confirmed correct (use cases, scripts) pairs, reusable prompt word templates are derived in reverse. This is an inductive learning process "from specific to general".

[0092] Technical Results: The system has achieved self-evolution and knowledge accumulation. It can learn knowledge from a small amount of manual correction and automatically generate high-quality templates, significantly reducing the cost of deployment and maintenance in new fields and solving the problem of insufficient generalization ability of AI models.

[0093] Invention Point 3: Parallel Processing and Iterative Optimization Architecture for Large-Scale Automotive Test Case Libraries Technical problems to be solved: Traditional methods cannot handle the batch processing needs of thousands of use cases and lack a closed loop for continuous improvement.

[0094] Technical measures: A multi-threaded parallel processing architecture is adopted to improve throughput, and an iterative optimization closed loop integrating user feedback is designed to allow the system to dynamically adjust the mapping strategy based on usage results.

[0095] Technical benefits: It achieves industrial-grade production efficiency and long-term benefits of increasing accuracy with use, enabling the system to be truly applied to large-scale, high-intensity real-world testing scenarios for automotive software.

[0096] Example 2: This invention also provides an automotive software test script generation device, which is mainly used to execute the automotive software test script generation method provided in Embodiment 1 of this invention. The following is a detailed description of the automotive software test script generation device provided in this invention.

[0097] Figure 7 This is a schematic diagram of an automotive software test script generation device according to an embodiment of the present invention, such as... Figure 7 As shown, the device mainly includes: a reading and parsing unit 10, a decomposition unit 20, a mapping unit 30, and a generation unit 40, wherein: The reading and parsing unit is used to read and parse test cases in the automotive test case library to obtain structured test case data. The structured test case data includes: test case ID, test case description, preconditions, test steps, and expected results. Decomposition unit is used to decompose test steps in structured use case data into three structured elements: action, object, and parameter, using natural language processing technology. The mapping unit is used to map the decomposed structured elements to the corresponding API interfaces based on a pre-built API knowledge base and business logic in the automotive testing field. The generation unit is used to generate an executable test script containing the corresponding API calls based on the corresponding API interface.

[0098] This invention provides an automotive software test script generation device, comprising: reading and parsing test cases in an automotive test case library to obtain structured test case data, wherein the structured test case data includes: test case ID, test case description, preconditions, test steps, and expected results; decomposing the test steps in the structured test case data into three structured elements: actions, objects, and parameters using natural language processing technology; mapping the decomposed structured elements to corresponding API interfaces based on a pre-built API knowledge base and business logic in the automotive testing domain; and generating an executable test script containing corresponding API interface calls based on the corresponding API interfaces. As described above, the automotive software test script generation device of the present invention decomposes the test steps into three structured elements—"action-object-parameter"—using natural language processing technology. It also performs contextual analysis based on the business logic of the automotive testing field, selecting the corresponding API interfaces from the API knowledge base. This achieves a leap from "character matching" to "semantic understanding," significantly improving the accuracy of API mapping and its adaptability to the variability of natural language. The mapped API interfaces are accurate, resulting in highly accurate executable test scripts generated based on these API interfaces. This alleviates the technical problem of traditional keyword matching being unable to handle the diversity and complexity of natural language, leading to inaccurate API mapping and ultimately poor accuracy in the generated automated test scripts.

[0099] Optionally, the device is also used to: receive at least one pair of verified test cases and corresponding correct test scripts as input, analyze the API call sequence in the correct test script, reverse-engineer a general prompt word template that can generate API call sequences, and use the general prompt word template to optimize the API knowledge base.

[0100] Optionally, the decomposition unit is also used to: identify action elements representing operation types, object elements representing operation targets, and parameter elements representing operation constraints from the test steps using named entity recognition or dependency parsing techniques.

[0101] Optionally, the mapping unit is also used to: calculate the semantic similarity between the structured element and each API interface in the API knowledge base to obtain a semantic matching score; verify the degree of conformity of each API interface to the test steps based on the business logic of the automotive testing domain to obtain a business logic confidence score; calculate the comprehensive score of each API interface based on the semantic matching score and the business logic confidence score, and select the API interface with the highest comprehensive score as the API interface corresponding to the structured element.

[0102] Optionally, the device is also used to: receive user feedback on the generated executable test script; and optimize the API knowledge base based on the feedback.

[0103] Optionally, the automotive software test script generation method executes multiple test cases in parallel to achieve batch generation of executable test scripts from the test case library.

[0104] Optionally, the API knowledge base is a structured document in JSON or XML format, where each record contains: API function name, function description, parameter list, and associated automotive business logic tag.

[0105] The device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.

[0106] like Figure 8 As shown in the embodiment of this application, an electronic device 600 includes a processor 601, a memory 602, and a bus. The memory 602 stores machine-readable instructions executable by the processor 601. When the electronic device is running, the processor 601 communicates with the memory 602 via the bus, and the processor 601 executes the machine-readable instructions to perform the steps of the above-described automotive software test script generation method.

[0107] Specifically, the memory 602 and processor 601 mentioned above can be general-purpose memory and processor, without any specific limitations. When the processor 601 runs the computer program stored in the memory 602, it can execute the above-mentioned automotive software test script generation method.

[0108] The processor 601 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 601 or by instructions in software form. The processor 601 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 602, and processor 601 reads the information from memory 602 and, in conjunction with its hardware, completes the steps of the above method.

[0109] Corresponding to the above-described automotive software test script generation method, this application embodiment also provides a computer-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to execute the steps of the above-described automotive software test script generation method.

[0110] The automotive software test script generation device provided in this application embodiment can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this application embodiment are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.

[0111] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0112] For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0113] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0114] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0115] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the automotive software test script generation method described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0116] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0117] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A method for generating automotive software test scripts, characterized in that, include: Read and parse test cases from the automotive test case library to obtain structured test case data, wherein the structured test case data includes: test case ID, test case description, preconditions, test steps and expected results; The test steps in the structured test case data are decomposed into three structured elements: action, object, and parameter using natural language processing technology. Based on a pre-built API knowledge base and business logic in the automotive testing field, the decomposed structured elements are mapped to the corresponding API interfaces. Generate an executable test script containing the corresponding API calls based on the corresponding API interface.

2. The method according to claim 1, characterized in that, The method further includes: The system receives at least one pair of verified test cases and their corresponding correct test scripts as input. It analyzes the API call sequence in the correct test scripts, reverse-engineers a general prompt word template that can generate the API call sequence, and uses the general prompt word template to optimize the API knowledge base.

3. The method according to claim 1, characterized in that, The test steps in the structured use case data are decomposed into three structured elements—action, object, and parameter—using natural language processing technology, including: Named entity recognition or dependency parsing techniques are used to identify action elements representing operation types, object elements representing operation targets, and parameter elements representing operation constraints from the test steps.

4. The method according to claim 1, characterized in that, Based on a pre-built API knowledge base and business logic in the automotive testing domain, the decomposed structured elements are mapped to corresponding API interfaces, including: Calculate the semantic similarity between the structured element and each API interface in the API knowledge base to obtain a semantic matching score; Based on the business logic of the automotive testing field, the degree of conformity of each API interface to the test steps is verified to obtain the business logic confidence level; The comprehensive score of each API interface is calculated based on the semantic matching score and the business logic confidence score, and the API interface with the highest comprehensive score is selected as the API interface corresponding to the structured element.

5. The method according to claim 1, characterized in that, The method further includes: Receive user feedback on the generated executable test scripts; The API knowledge base is optimized based on the feedback information.

6. The method according to claim 1, characterized in that, The automotive software test script generation method executes multiple test cases in parallel to generate batch executable test scripts from the test case library.

7. The method according to claim 1, characterized in that, The API knowledge base is a structured document in JSON or XML format, where each record contains: API function name, function description, parameter list, and associated automotive business logic tag.

8. A device for generating automotive software test scripts, characterized in that, include: The reading and parsing unit is used to read and parse test cases in the automotive test case library to obtain structured test case data, wherein the structured test case data includes: test case ID, test case description, preconditions, test steps and expected results; The decomposition unit is used to decompose the test steps in the structured use case data into three structured elements: action, object, and parameter, using natural language processing technology. The mapping unit is used to map the decomposed structured elements to the corresponding API interfaces based on a pre-built API knowledge base and business logic in the automotive testing field. The generation unit is used to generate an executable test script containing the corresponding API interface calls based on the corresponding API interface.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the method of any one of claims 1 to 7.