Automatic driving test script generation method and device, equipment and storage medium
By automating the processing of CSV, XML, and YAML files, autonomous driving test scripts are generated, solving the problems of high cost of manual parameter configuration and high error rate of multiple files, and achieving efficient and accurate test script generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-07
- Publication Date
- 2026-03-13
AI Technical Summary
In existing autonomous driving testing scenarios, manually configuring parameters is costly, and the error rate of multi-file collaboration is high, making it difficult to efficiently generate test scripts.
By acquiring test parameter files in CSV format, scenario template files in XML format, and test case files in YAML format, parameter matching and unification are performed to generate target scenario template files and target test case files, thereby achieving automated generation of test scripts.
It reduces the cost of manually configuring parameters, decreases the error rate of multi-file collaboration, and improves the accuracy and efficiency of test script generation.
Smart Images

Figure CN121658387A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of autonomous driving, and in particular to a method, apparatus, device and storage medium for generating autonomous driving test scripts. Background Technology
[0002] Autonomous vehicle testing is a crucial support for the development of autonomous driving technology. As intelligent vehicles continue to deploy automated and connected products, the reliance on testing is becoming increasingly profound. To cope with ever-changing traffic scenarios, massive amounts of data are needed to test autonomous driving, covering as many scenarios as possible, and continuously maintaining the test scenario library to ensure the safety and quality of autonomous driving.
[0003] However, most existing test scenario configurations rely on direct operation of the scenario software. The static binding between test case parameters and scenario configuration files is difficult to cope with the complex dynamic requirements in real-world applications. Manually configuring a single test case is time-consuming, and inconsistent file naming and cross-file modification errors are common.
[0004] Therefore, existing technologies suffer from technical problems such as high labor costs for manually configuring parameters and high error rates in multi-file collaboration during autonomous driving testing scenarios.
[0005] Application content The purpose of this application is to provide a method, apparatus, device, and storage medium for generating autonomous driving test scripts, so as to achieve the technical effect of accurately and efficiently generating autonomous driving test scripts.
[0006] Firstly, this application provides a method for generating autonomous driving test scripts, including: Obtain the test parameter file in CSV format, the first scenario template file in XML format, and the first test case file in YAML format; Based on the test parameter file, the parameters of the first scenario template file are matched and unified to obtain the first mapping file; based on the test parameter file, the parameters of the first test case file are matched and unified to obtain the second mapping file. Based on the test parameter file, the first mapping file, and the second mapping file, generate the target scenario template file and the target test case file. The test script includes the target scenario template file and the target test case file.
[0007] Furthermore, according to the test parameter file, the parameters of the first scene template file are matched and unified to obtain the first mapping file, including: Parse the CSV format test parameter file to obtain the target test parameter file; Obtain the first mapping file in the first scenario template file that corresponds to the first parameter in the target test parameter file; Based on the test parameter file, the first test case file is matched and unified to obtain the second mapping file, which includes: Obtain the second mapping file in the first test case file that corresponds to the second parameter in the target test parameter file.
[0008] Furthermore, obtain the first mapping file in the first scene template file that corresponds to the first parameter in the target test parameter file, including: Obtain the first content and first position in the first scene template file that have the same parameter name as the first parameter, and the second content and second position that have the same parameter name as the first parameter after variable conversion. The first mapping file includes the first content, the first position, the second content, and the second position. Obtain the second mapping file from the first test case file, which corresponds to the second parameter in the target test parameter file, including: Obtain the third content and third position in the first test case file that have the same parameter name as the second parameter, as well as the fourth content and fourth position that have the same parameter name as the second parameter after variable conversion. The second content includes the third content, the third position, the fourth content, and the fourth position.
[0009] Furthermore, after obtaining the second mapping file, it includes: Based on the first test parameter file and the first mapping file, generate the first temporary script in XML format; Generate a first version number for the first test parameter file and a second version number for the first temporary script, wherein the first version number and the second version number correspond to each other.
[0010] Furthermore, after generating the first temporary script in XML format, it includes: Replace the first parameter in the first temporary script with the first and second content to obtain the second scene template file; Verify the second scene template file; If the verification is successful, the second scene template file in XML format will be used as the target scene template file.
[0011] Furthermore, after using the second scene template file in XML format as the target scene template file, it includes: Based on the first test parameter file, the first temporary script, and the second mapping file, generate a second temporary script in YAML format; Generate a third version number for the second temporary script, where the third version number corresponds to both the first and second version numbers.
[0012] Furthermore, after generating the second temporary script in YAML format, it includes: Replace the second parameter in the second temporary script with the third and fourth content to obtain the second test case file; Verify the second test case file; If the verification is successful, the second test case file in YAML format will be used as the target test case file.
[0013] Secondly, this application also provides an autonomous driving test script generation device, comprising: The acquisition module is used to acquire test parameter files in CSV format, scenario template files in XML format, and test case files in YAML format. The scenario template files include road information and environmental information. The matching module is used to match and unify the parameters of the scenario template file according to the test parameter file to obtain the first mapping file; and to match and unify the parameters of the test case file according to the test parameter file to obtain the second mapping file. The generation module is used to generate test scripts based on the test parameter file, the first mapping file, and the second mapping file.
[0014] Thirdly, this application also provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is used to execute the above-mentioned autonomous driving test script generation method by running instructions in memory.
[0015] Fourthly, this application also provides a computer storage medium storing instructions that, when executed, implement the above-mentioned method for generating autonomous driving test scripts.
[0016] This application embodiment obtains a test parameter file in CSV format, a first scenario template file in XML format, and a first test case file in YAML format; based on the test parameter file, it performs parameter matching and unification on the first scenario template file to obtain a first mapping file; based on the test parameter file, it performs parameter matching and unification on the first test case file to obtain a second mapping file; based on the test parameter file, the first mapping file, and the second mapping file, it generates a target scenario template file and a target test case file, wherein the test script includes the target scenario template file and the target test case file. This solves the technical problems of high manpower cost and high error rate of multi-file collaboration in the prior art for autonomous driving test scenarios, and achieves the technical effect of accurately and efficiently generating autonomous driving test scripts.
[0017] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description
[0018] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating an autonomous driving test script generation method provided in this application embodiment; Figure 2 A flowchart illustrating another method for generating autonomous driving test scripts provided in this application embodiment; Figure 3 A flowchart illustrating an exemplary method for generating autonomous driving test scripts, provided in an embodiment of this application; Figure 4 A structural diagram of an autonomous driving test script generation device provided in an embodiment of this application; Figure 5 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and effect. For example, the first threshold and the second threshold are only used to distinguish different thresholds and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0020] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0021] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, a combination of a and b, a combination of a and c, a combination of b and c, or a, b, and c, where a, b, and c can be single or multiple.
[0022] To address the technical problems of high labor costs and high error rates in manual parameter configuration and multi-file collaboration in existing autonomous driving testing scenarios, this application provides an autonomous driving test script generation method, such as... Figure 1 As shown: Figure 1 A flowchart of an autonomous driving test script generation method provided in this application embodiment includes: S1010: Obtain the test parameter file in CSV format, the first scenario template file in XML format, and the first test case file in YAML format; S1020: Based on the test parameter file, perform parameter matching and unification on the first scenario template file to obtain the first mapping file; based on the test parameter file, perform parameter matching and unification on the first test case file to obtain the second mapping file; S1030: Generate a target scenario template file and a target test case file based on the test parameter file, the first mapping file, and the second mapping file. The test script includes the target scenario template file and the target test case file.
[0023] In existing simulation tests, most methods involve manually operating VTD scene software and manually modifying parameters in map software to build scenes. This embodiment directly parses the XML files generated by the scene software, extracts relevant variable paragraphs, and performs atomic variable operations to replace them, thereby automatically generating batch scenes. For example... Figure 2 As shown: Figure 2This document presents a flowchart of another autonomous driving test script generation method provided in an embodiment of this application. The embodiment also provides an automated generation method and system for autonomous driving test scenarios, comprising: a parameter mapping parsing module: receiving a CSV file containing test parameters and parsing the binding relationship between parameters and scene feature elements; a template library management module: storing VTD scene XML scene templates with placeholder tags and YAML test script templates, the module library having the function of parsing and locating template parameters; a dynamic compilation engine: matching the corresponding template according to the parameters and generating an XML scene file with version identifier and an associated YAML test script. The generation process includes a log, automatically generating the corresponding scene and test script each time it is read and parsed; a naming rule controller: automatically generating scene files and test script name files that conform to predefined rules based on parameter combinations; a linkage module: establishing version dependencies between scene files and test scripts based on test parameters to ensure version consistency during execution; and a data flow: intelligent mapping of test case parameters, XML scene tags, and YAML configuration paths; enabling cross-file cascading updates for parameter changes. The automated scenario generation based on this embodiment enables the linked generation of test case / test scenario XML and test script YAML, featuring: cross-file cascading updates for parameter changes, dynamic environment adaptation configuration generation, and bidirectional traceability between configuration and test cases. This avoids the workload of manually modifying and synchronizing multiple files (test cases / test scenarios, test scripts) when requirement parameters change. Automated scenario generation is based on test case parameter extraction and can be synchronized to test scenarios, avoiding errors introduced by manual conversion (such as unit conversion, lane overlap percentage, etc.). Test scenarios referenced in test scripts are updated synchronously during test scenario generation, avoiding manual search for test scenarios and the resulting test scenario chaos. Test scenarios and test scripts change cascadingly, with naming rules customized based on test parameters. This avoids chaotic file management.
[0024] This application embodiment obtains a test parameter file in CSV format, a first scenario template file in XML format, and a first test case file in YAML format; based on the test parameter file, it performs parameter matching and unification on the first scenario template file to obtain a first mapping file; based on the test parameter file, it performs parameter matching and unification on the first test case file to obtain a second mapping file; based on the test parameter file, the first mapping file, and the second mapping file, it generates a target scenario template file and a target test case file, wherein the test script includes the target scenario template file and the target test case file. This solves the technical problems of high manpower cost and high error rate of multi-file collaboration in the prior art for autonomous driving test scenarios, and achieves the technical effect of accurately and efficiently generating autonomous driving test scripts.
[0025] In one embodiment, the scheme of "matching and unifying the parameters of the first scene template file according to the test parameter file to obtain the first mapping file" in S1020 above has been further optimized, and an optional method is given. The specific implementation steps are as follows: S10201: Parse the CSV format test parameter file to obtain the target test parameter file; S10202: Obtain the first mapping file in the first scene template file that corresponds to the first parameter of the target test parameter file.
[0026] The above-mentioned solution in S1020, "matching and unifying the parameters of the first test case file according to the test parameter file to obtain the second mapping file," has been further optimized, and an alternative method is provided. The specific implementation steps are as follows: S10203: Obtain the second mapping file in the first test case file that corresponds to the second parameter in the target test parameter file.
[0027] In one embodiment, the scheme of "obtaining the first mapping file corresponding to the first parameter of the target test parameter file in the first scene template file" in S10202 above has been further optimized, and an optional method is given. The specific implementation steps are as follows: S102021: This involves obtaining the first content and first position in the first scene template file that have the same parameter name as the first parameter, as well as the second content and second position that have the same parameter name as the first parameter after variable conversion. The first mapping file includes the first content, the first position, the second content, and the second position. The above-mentioned solution of "obtaining the second mapping file corresponding to the second parameter of the target test parameter file in the first test case file" in S10203 has been further optimized, and an alternative method is given. The specific implementation steps are as follows: S102031: Obtain the third content and third position in the first test case file that have the same parameter name as the second parameter, and the fourth content and fourth position that have the same parameter name as the second parameter after variable conversion, wherein the second content includes the third content, the third position, the fourth content, and the fourth position.
[0028] In one embodiment, the solution after "obtaining the second mapping file" in S1020 above has been further optimized, and an optional method is provided. The specific implementation steps are as follows: S1021: Generate a first temporary script in XML format based on the first test parameter file and the first mapping file; S1022: Generate a first version number of the first test parameter file and a second version number of the first temporary script, wherein the first version number and the second version number correspond to each other.
[0029] In one embodiment, the solution following "generating a first temporary script in XML format to obtain a second mapping file" in S1021 above has been further optimized, and an alternative method is provided, with the specific implementation steps as follows: S1022: Replace the first parameter in the first temporary script with the first content and the second content to obtain the second scene template file; S1023: Verify the second scene template file; S1024: If the verification is successful, the second scene template file in XML format will be used as the target scene template file.
[0030] In one embodiment, the solution following "using the second scene template file in XML format as the target scene template file" in S1024 above has been further optimized, and an alternative method is provided. The specific implementation steps are as follows: S1025: Generate a second temporary script in YAML format based on the first test parameter file, the first temporary script, and the second mapping file; S1026: Generate a third version number for the second temporary script, wherein the third version number corresponds to the first version number and the second version number.
[0031] In one embodiment, the solution following "generating a second temporary script in YAML format" in S1025 above has been further optimized, and an alternative method is provided, with the specific implementation steps as follows: S1027: Replace the second parameter in the second temporary script with the third and fourth content to obtain the second test case file; S1028: Verify the second test case file; S1029: If the verification is successful, the second test case file in YAML format will be used as the target test case file.
[0032] In one exemplary embodiment, this application provides a method for generating autonomous driving test scripts, such as... Figure 3 As shown: Figure 3This document provides a flowchart of an exemplary autonomous driving test script generation method for embodiments of this application. The specific steps are as follows: I. Tools used for autonomous driving scenario construction: During autonomous driving simulation testing, VTD is used to build scenarios and maps, generating files including: road network description file: *.xodr (OpenDRIVE format), 3D environment model file: *.osgb (OpenSceneGraph binary format), and XML dynamic scene file. In typical test scenarios, the map files xodr and osgb are fixed, requiring modification of the scenario and test scripts to match test cases. Manually modifying scenarios is time-consuming, requires significant manpower, and may result in low accuracy. II. System description: 1. Input file: Input data sources such as CSV files. 2. Data parsing: Parse CSV data to extract parameters. 3. Parameter preprocessing: Extract parameters, perform parameter preprocessing to meet scenario parameter requirements, and align scenario parameter variables. 4. Template library management module: Store VTD typical scenario XML scene templates with marked placeholders, YAML test script templates, map xodr and osgb templates, and test case templates. The module library has the function of parsing and locating template parameters. 5. Dynamic compilation engine: Matches parameters to corresponding templates, generating version-identified XML scene files and associated YAML test scripts. Different CSV inputs correspond to different templates, matched by the dynamic compilation engine. The generation process includes logs, automatically generating corresponding scenes and test scripts each time the data is read and parsed. 6. Temporary file creation: Creates temporary scene XML and script YAML files based on the template. Validation and replacement are performed in a three-stage mode: temporary file (mktemp), content validation (finding the scene / test script variable paragraph position), and atomic write (changing only the required parameters). 8. Naming rule controller: Automatically generates scene files and test script names that conform to predefined rules based on parameter combinations. 9. File linkage module: Establishes version dependencies between scene files and test scripts based on test parameters, ensuring version consistency during execution. 10. Final file generation: Generates the final XML and YAML files.
[0033] Taking AEB as an example, the specific implementation process of Automatic Emergency Braking is briefly described. 1. Read Input File: The system reads the input file, which comes from the module management library. The file may include XML templates, CSV data, and YAML templates. The CSV file comes from AEB test cases and feature parameters extracted from the XML. 2. Parse CSV: The system attempts to parse the CSV file. If parsing is successful, it proceeds to the parameter preprocessing step. If parsing fails, an error log is recorded and the process ends. Example: num, Vego, v1, LaneOffset 1,10,0,-0.93 2,15,0,-0.93 3,20,0,-0.93 ...... 16,10,10,0.93 17,15,10,0.93 18,20,10,0.93 19,25,10,0.93 Column 1, num, represents the sequence number; Column 2, Vego, represents the vehicle's speed in km / h; Column 3, v1, represents the speed of the vehicle ahead in km / h; Column 4, LaneOffset, represents the lane offset position of the vehicle ahead in meters. The CSV file is for example only; actual parameters will be expanded based on actual test cases, such as vehicle speed trigger time, vehicle ahead position, vehicle ahead start / stop time, etc. The parameters in this embodiment are only for CCRS and CCRM scenarios, corresponding to the CCRM scenario library template and test case template. 2. Parameter Preprocessing: The first row of the CSV file is not processed; data processing begins from the second row. Each row corresponds to an XML and YAML file. The extracted parameters are preprocessed to check the boundary range of each parameter, whether the parameter is empty, and the parameter format, to meet the scenario parameter requirements. Parameters mentioned in the CSV file need to be compared with the XML file during preprocessing to find the relevant variable segments and positions in the XML. For example, the following segments represent several variables of the vehicle ahead; these variables need to be located during preprocessing for subsequent atomic substitution. <speed Value="0.0000000000000000e+00" / > <posabsolute X="1.0171588310949002e+02" Y="-1.2867596210447921e+01" Z="0.0000000000000000e+00" PermanentLaneOffset="-9.1610504630702039e-01" Direction="1.4612607890042092e-06" AlignToRoad="true" / >For example, in the test script, this section indicates the scene storage location, so AEB011.xml is the scene name. We will use the generated XML file to automatically replace the scene name in the test script template later: scenario_file: Projects / Current / Scenarios / 3.1 / test / ENCAP / AEB / AEB011.xml. 3. Typical Parameter Processing Explanation: Here are some specific parameters explained. There is a conversion between the parameters in the CSV file and the typical variables extracted from the scene, which needs to be done in preprocessing. The parsing process needs to output logs synchronously. Log output and saving: For example, the vehicle speed unit in the scene is m / s. Handling the percentage overlap of vehicles ahead (which will be used in subsequent file naming). The variable PermanentLaneOffset in the XML represents the vehicle's position in the lane (corresponding to CSVLaneOffset). Each time the scene is set, it needs to be clear whether the vehicle is centered or offset to the left or right, with left being positive and right being negative. Currently, the lane is 3.75m. For example, if PermanentLaneOffset = 0.08, then it can be considered centered. If PermanentLaneOffset = -0.916, then the car is veering to the right in the lane. The overlap percentage between the car and the preceding vehicle is calculated as: LaneOffset * 2 / 3.75; generally represented by integers, such as 25 50 75 -75 -50 -25, etc. 4. Generate Base Name: Generate a base name based on the preprocessed parameters. Scene naming format: Example scene file name: EN_CCRs_-50_10_0 (the first number is the overlap percentage, the second is the vehicle's speed, and the third is the preceding vehicle's speed), EN (prefix indicates ENCAP). Lane Offset Percentage: Determine if the lane offset is less than 0. Use a negative integer if less than 0, such as -50. Speed Type Determination: Determine if the preceding vehicle's speed is less than 0. If yes, set the prefix to CCRm. If not, set the prefix to CCRs. 5. Create Temporary XML: Create a temporary XML file based on the generated base name. To avoid the backup file and the final file existing simultaneously, a temporary file is generated here; the temporary file is deleted when the final file is generated. Generate an XML folder. Each time a CSV row is processed, the generated XML file will be placed in this folder. Each CSV file will have a version number; when extracting information from the CSV, the version number in the XML folder will be synchronized. This facilitates file cascading matching. 6. SQL Replacement Validation: Based on the positions of relevant variables in the XML, preprocessed parameters are used to replace the corresponding variable values. At this point, the SQL replacement is checked for success. If successful, the official XML is generated. If it fails, the temporary file is deleted and the process ends. This step requires synchronous logging. 7. Create Temporary YAML: First, locate the scene placement location in the test script, confirm the scene name, and create a temporary YAML file.Generate an XML folder. Each time a CSV row is processed, a generated YAML file will be created in this folder. The folder name will be concatenated with the CSV and XML version numbers. For example, if CSV is V1.2_20250401, then the XML folder name will be xml_V1.2_20250401, the YAML folder name will be yaml_V1.2_20250401, and the log file name will be stored in the current directory as get_xml_yaml_log_V1.2_20250401. Generate a YAML file based on the template. The scene references in the YAML file must match the scene file name. For example, if the scene is EN_CCRM_30_20.xml, the test script name should be pnc_worldsim_EN_CCRM_30_20.yaml, with the prefix pnc_worldsim_ (indicating Worldsim testing). 8. AWK Replacement Verification: First, search for the generated XML scene name in the XML file, extract the scene name, and use it to replace the scene file name in the temporary YAML file. Verify whether the AWK replacement was successful. If successful, generate the official YAML. At this point, the scene name in the temporary YAML has been replaced. If the process fails, delete the temporary YAML and end the process. 9. Generate official XML and YAML: Generate the final XML and YAML files. 10. Log success: Log the process, which includes each line of the CSV processing. You can find the XML and YAML filenames generated for each line of the CSV. The CSV file is extracted from the test cases, and the generated scene and YAML can be synchronized to the test cases programmatically. This achieves a closed-loop update of the test cases.
[0034] This embodiment of the solution can read CSV files, match corresponding scenarios from the database in real time, and after the program analyzes the parameters, generate scenario XML / test script YAML in batches with one click, automatically naming the generated files, which are then synchronized to the test cases. Real-world testing data shows that with a scale of 2000+ test cases, the configuration generation accuracy is improved to 97.92%, multi-environment adaptation time is reduced from 72 hours to 15 minutes, and the efficiency of change impact analysis is improved by 89 times, reducing manual operation of scenarios and test cases. This saves significant time and manpower.
[0035] Based on the same concept, this application also provides an autonomous driving test script generation device. Please refer to [link / reference]. Figure 4 The figure shows an autonomous driving test script generation device provided in an embodiment of this application, including an acquisition module 201, a matching module 202 and a first generation module 203.
[0036] The acquisition module 201 is used to acquire test parameter files in CSV format, scenario template files in XML format, and test case files in YAML format. The scenario template files include road information and environmental information. The matching module 202 is used to perform parameter matching and unification on the scenario template file according to the test parameter file to obtain the first mapping file; and to perform parameter matching and unification on the test case file according to the test parameter file to obtain the second mapping file. The first generation module 203 is used to generate test scripts based on the test parameter file, the first mapping file, and the second mapping file.
[0037] This application embodiment obtains a test parameter file in CSV format, a first scenario template file in XML format, and a first test case file in YAML format; based on the test parameter file, it performs parameter matching and unification on the first scenario template file to obtain a first mapping file; based on the test parameter file, it performs parameter matching and unification on the first test case file to obtain a second mapping file; based on the test parameter file, the first mapping file, and the second mapping file, it generates a target scenario template file and a target test case file, wherein the test script includes the target scenario template file and the target test case file. This solves the technical problems of high manpower cost and high error rate of multi-file collaboration in the prior art for autonomous driving test scenarios, and achieves the technical effect of accurately and efficiently generating autonomous driving test scripts.
[0038] The matching module 202 includes a parsing unit, a first acquisition unit, and a second acquisition unit.
[0039] The parsing unit is used to parse the CSV format test parameter file to obtain the target test parameter file; The first acquisition unit is used to acquire the first mapping file in the first scene template file that corresponds to the first parameter of the target test parameter file; The second acquisition unit is used to acquire the second mapping file in the first test case file that corresponds to the second parameter in the target test parameter file.
[0040] Furthermore, the first acquisition unit includes a first acquisition component.
[0041] The first acquisition component is used to acquire the first content and the first position in the first scene template file that have the same parameter name as the first parameter, as well as the second content and the second position that have the same parameter name as the first parameter after variable conversion. The first mapping file includes the first content, the first position, the second content, and the second position. The second acquisition unit includes a second acquisition component.
[0042] The second acquisition component is used to acquire the third content and third position in the first test case file that have the same parameter name as the second parameter, as well as the fourth content and fourth position that have the same parameter name as the second parameter after variable conversion. The second content includes the third content, the third position, the fourth content, and the fourth position.
[0043] Furthermore, the autonomous driving test script generation device also includes a second generation module and a third generation module.
[0044] The second generation module is used to generate a first temporary script in XML format based on the first test parameter file and the first mapping file after obtaining the second mapping file; The third generation module is used to generate a first version number of the first test parameter file and a second version number of the first temporary script, wherein the first version number and the second version number correspond to each other.
[0045] Furthermore, the autonomous driving test script generation device also includes a first replacement module, a first verification module, and a fourth generation module.
[0046] The first replacement module is used to generate a first temporary script in XML format, and then replace the first parameter in the first temporary script with the first content and the second content to obtain the second scene template file; The first verification module is used to verify the second scene template file; The fourth generation module is used to use the second scene template file in XML format as the target scene template file if the verification is successful.
[0047] Furthermore, the autonomous driving test script generation device also includes a fifth generation module and a sixth generation module.
[0048] The fifth generation module is used to take the second scene template file in XML format as the target scene template file, and then generate the second temporary script in YAML format according to the first test parameter file, the first temporary script, and the second mapping file. The sixth generation module is used to generate the third version number of the second temporary script, wherein the third version number corresponds to the first version number and the second version number.
[0049] Furthermore, the autonomous driving test script generation device also includes a second replacement module, a second verification module, and a seventh generation module.
[0050] The second replacement module is used to generate a second temporary script in YAML format, and then replace the second parameter in the second temporary script with the third and fourth content to obtain the second test case file. The second verification module is used to verify the second test case file; The seventh generation module is used to use the second test case file in YAML format as the target test case file if the verification is successful.
[0051] This application also provides an electronic device, please refer to... Figure 5 , Figure 5This is a structural diagram of an electronic device provided in an embodiment of this application.
[0052] like Figure 5 As shown, the electronic device 400 includes a processor 410.
[0053] like Figure 5 As shown, the processor 410 described above can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program in this application.
[0054] like Figure 5 As shown, the electronic device 400 may further include a communication line 440. The communication line 440 may include a path for transmitting information between the components.
[0055] Optional, such as Figure 5 As shown, the above-described electronic device may further include a communication interface 420. There may be one or more communication interfaces 420. The communication interface 420 may use any transceiver-like device for communicating with other devices or communication networks.
[0056] Optional, such as Figure 5 As shown, the electronic device may further include a memory 430. The memory 430 stores computer execution instructions for implementing the scheme of this application, and its execution is controlled by a processor. The processor executes the computer execution instructions stored in the memory, thereby implementing the autonomous driving test script generation method provided in the embodiments of this application.
[0057] like Figure 5As shown, memory 430 can be read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. Memory 430 can exist independently and be connected to processor 410 via communication line 440. Memory 430 can also be integrated with processor 410.
[0058] Optionally, the computer execution instructions in the embodiments of this application may also be referred to as application code, and the embodiments of this application do not specifically limit this.
[0059] In a specific implementation, as one example, such as Figure 5 As shown, processor 410 may include one or more CPUs, such as Figure 5 CPU0 and CPU1 in the CPU.
[0060] In a specific implementation, as one example, such as Figure 5 As shown, the terminal device may include multiple processors, such as Figure 5 The first processor 4101 and the second processor 4102 are included. Each of these processors can be a single-core processor or a multi-core processor.
[0061] The methods disclosed in the embodiments of this application can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an 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 can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above-mentioned autonomous driving test script generation method.
[0062] This application also provides a computer-readable storage medium storing instructions that, when executed, implement the functions performed by the terminal device in the above embodiments.
[0063] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a terminal, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive (SSD).
[0064] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0065] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
Claims
1. A method for generating autonomous driving test scripts, characterized in that, include: Obtain the test parameter file in CSV format, the first scenario template file in XML format, and the first test case file in YAML format; Based on the test parameter file, the first scenario template file is matched and unified to obtain a first mapping file; based on the test parameter file, the first test case file is matched and unified to obtain a second mapping file. Based on the test parameter file, the first mapping file, and the second mapping file, a target scenario template file and a target test case file are generated, wherein the test script includes the target scenario template file and the target test case file.
2. The method according to claim 1, characterized in that, According to the test parameter file, the first scene template file is matched and unified to obtain a first mapping file, including: Parse the CSV format test parameter file to obtain the target test parameter file; Obtain the first mapping file in the first scene template file that corresponds to the first parameter of the target test parameter file; Based on the test parameter file, the first test case file is matched and unified to obtain the second mapping file, which includes: Obtain the second mapping file in the first test case file that corresponds to the second parameter of the target test parameter file.
3. The method according to claim 2, characterized in that, Obtaining the first mapping file in the first scene template file that corresponds to the first parameter of the target test parameter file, including: Obtain the first content and first position in the first scene template file that have the same parameter name as the first parameter, and the second content and second position that have the same parameter name as the first parameter after variable conversion, wherein the first mapping file includes the first content, the first position, the second content and the second position; Obtaining the second mapping file in the first test case file that corresponds to the second parameter in the target test parameter file, including: Obtain the third content and third position in the first test case file that have the same parameter name as the second parameter, and the fourth content and fourth position that have the same parameter name as the second parameter after variable conversion, wherein the second content includes the third content, the third position, the fourth content, and the fourth position.
4. The method according to claim 3, characterized in that, After obtaining the second mapping file, it includes: Based on the first test parameter file and the first mapping file, generate a first temporary script in XML format; Generate a first version number for the first test parameter file and a second version number for the first temporary script, wherein the first version number and the second version number correspond to each other.
5. The method according to claim 4, characterized in that, After generating the first temporary script in XML format, it includes: Replace the first parameter in the first temporary script with the first content and the second content to obtain the second scene template file; Verify the second scene template file; If the verification is successful, the second scene template file in XML format will be used as the target scene template file.
6. The method according to claim 5, characterized in that, After using the second scene template file in XML format as the target scene template file, the following is included: Based on the first test parameter file, the first temporary script, and the second mapping file, generate a second temporary script in YAML format; Generate a third version number for the second temporary script, wherein the third version number corresponds to the first version number and the second version number.
7. The method according to claim 6, characterized in that, After generating the second temporary script in YAML format, it includes: Replace the second parameter in the second temporary script with the third and fourth content to obtain the second test case file; Verify the second test case file; If the verification is successful, the second test case file in YAML format will be used as the target test case file.
8. An autonomous driving test script generation device, characterized in that, include: The acquisition module is used to acquire test parameter files in CSV format, scenario template files in XML format, and test case files in YAML format, wherein the scenario template files include road information and environmental information; The matching module is used to perform parameter matching and unification on the scenario template file according to the test parameter file to obtain a first mapping file; and to perform parameter matching and unification on the test case file according to the test parameter file to obtain a second mapping file. The generation module is used to generate the test script based on the test parameter file, the first mapping file, and the second mapping file.
9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the autonomous driving test script generation method according to any one of claims 1 to 7 by running instructions in the memory.
10. A computer storage medium, characterized in that, The computer storage medium stores instructions that, when executed, implement the autonomous driving test script generation method according to any one of claims 1 to 7.