Test script generation method and device, electronic equipment and storage medium
By automatically generating test scripts, the problem of low efficiency in writing automatic driving simulation test scripts in the existing technology is solved, efficient test coverage and highly adaptable test scripts are achieved, and the rapid iteration needs of automatic driving simulation testing are met.
Patent Information
- Application Number
- CN202310315960.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2024-10-01
AI Technical Summary
The writing efficiency of existing automatic driving simulation test scripts is low and cannot meet the needs of rapid iteration, resulting in insufficient test coverage and poor adaptability.
By obtaining seed scripts and generalization scenario files, test scripts are automatically generated according to the preset generalization direction, scripts corresponding to test requirements are screened out, generalization parameters are modified, and test scripts with strong adaptability are generated.
It greatly improves the preparation efficiency and test coverage of autonomous driving simulation tests, improves the adaptability and portability of scripts, reduces the need for manual writing, and avoids inconsistent development styles and human errors.
Smart Images

Figure CN118733419A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of autonomous driving simulation testing technology, and in particular to a test script generation method, device, electronic device and storage medium. Background Art
[0002] As an important means of verifying autonomous driving algorithms, autonomous driving simulation testing has received more and more attention and development. Among them, test scripts are widely used in autonomous driving simulation testing due to their high efficiency and lack of human intervention.
[0003] In order to improve the effectiveness of autonomous driving simulation testing, it is necessary to fully expand the application of existing test scripts. At present, according to the simulation testing requirements of the functional logic of the autonomous driving system, test scripts that match the test requirements are manually written. With the update and iteration of autonomous driving simulation testing, the writing of test scripts obviously cannot keep up with the speed of iteration, and it is time-consuming and inefficient to manually write script codes according to simulation testing requirements, which cannot meet the requirements of simulation testing. Summary of the invention
[0004] One of the purposes of the present invention is to provide a test script generation method to solve the problem in the prior art that the script code is time-consuming and inefficient and cannot meet the simulation test requirements; the second purpose is to provide a test script generation device; the third purpose is to provide an electronic device; and the fourth purpose is to provide a computer-readable storage medium.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0006] A test script generation method, the method comprising:
[0007] Obtain a seed script, and determine the seed script to be generalized according to a preset generalization direction;
[0008] Determine the corresponding generalized scene file according to the seed script to be generalized;
[0009] Obtaining generalized parameter information of the generalized scene file;
[0010] A generalized test script is generated according to the generalized parameter information, wherein the test script is used for executing an autonomous driving simulation test.
[0011] According to the above technical means, test scripts are automatically generated from a large number of seed scripts in the generalization direction, which greatly improves the preparation efficiency and test coverage of simulation tests. After seed script screening, generalization scenario selection, and generalization parameter modification, the generalized test scripts have strong adaptability and portability, and can be modified and adapted according to different simulation script frameworks to further meet the needs of autonomous driving simulation testing.
[0012] Further, the step of obtaining the seed script and determining the seed script to be generalized according to a preset generalization direction includes:
[0013] Obtain a seed script and an associated scene file corresponding to the seed script;
[0014] According to a preset generalization direction, the associated scene files are screened to determine a seed scene to be generalized;
[0015] Extracting and processing the seed scene to be generalized to obtain a seed number of the seed scene;
[0016] According to the seed number, the seed script is traversed to determine the seed script to be generalized.
[0017] According to the above technical means, by determining the seed scripts to be generalized from a large number of seed scripts according to the preset generalization direction, the test scripts corresponding to the test requirements can be screened out, avoiding processing a large number of irrelevant script files, occupying resources, and improving the efficiency of automatically generating test scripts.
[0018] Further, determining the corresponding generalized scene file according to the seed script to be generalized includes:
[0019] According to the seed number of the seed script to be generalized, determine the storage path of the scene file corresponding to the seed number;
[0020] Determine the target scene file according to the storage path of the scene file;
[0021] According to the target scene file, the acquired associated scene files are filtered to determine the generalized scene file corresponding to the seed script to be generalized.
[0022] According to the above technical means, based on the seed number to be generalized, the generalized scenario file corresponding to the seed script to be generalized is screened out from a large number of simulation scenarios to avoid interference from irrelevant scenarios and improve the efficiency of automatically generating test scripts.
[0023] Further, the obtaining of generalized parameter information of the generalized scene file includes:
[0024] Obtaining parameter information in the generalized scene file, and comparing the parameter information with the seed scene to be generalized;
[0025] If the parameter information is consistent with the seed scene to be generalized, the generalized parameter information of the generalized scene file is obtained according to a preset text information matching method.
[0026] According to the above technical means, by comparing the generalized scene file with the information in the seed scene, it is determined that the generalized scene file is generalized based on the seed scene, thereby improving the accuracy of the generalized parameter information of the generalized scene file, so as to generate a test script that adapts to the test requirements.
[0027] Furthermore, if the parameter information is consistent with the seed scene to be generalized, after obtaining the generalized parameter information of the generalized scene file according to a preset text information matching method, the method further includes:
[0028] Verifying the generalized parameter information of the generalized scene file to generate a verification result; wherein the verifying the generalized parameter information of the generalized scene file includes verifying the generalized parameters and specific values in the generalized parameter information;
[0029] If there is a deviation in the verification result, the generalization parameter information is obtained again.
[0030] According to the above technical means, the generalized parameter information of the generalized scenario file is verified. If there is a deviation in the verification result, the generalized parameter information is re-acquired, which greatly improves the generation quality of the generalized test script.
[0031] Further, generating a generalized test script according to the generalized parameter information, wherein the test script is used for executing the autonomous driving simulation test, including:
[0032] According to the generalized parameter information, the generalized parameters and the specific parameters are modified to generate specific generalized information;
[0033] Generate a generalized test script according to the generated specific generalized information;
[0034] The generalized test scripts are stored so that the autonomous driving simulation test executes the generalized test scripts.
[0035] According to the above technical means, by modifying the generalized parameters and specific parameters, a generalized test script is generated and stored. In the subsequent test development process, when the technical personnel need to use the test case with the same function, they can directly call the corresponding test script without manually writing the script. On the one hand, this greatly improves the development efficiency of the technical personnel; on the other hand, it greatly improves the uniformity of the test script, avoiding the technical problem of reduced readability due to inconsistent development style caused by manual development, and at the same time can effectively avoid errors or deviations caused by human factors; further, by modifying the corresponding parameters in the entire test script, the efficiency of modification is improved, and the accuracy and completeness of the modification are improved.
[0036] Furthermore, the step of obtaining the seed script, before determining the seed script to be generalized according to the preset generalization direction, further includes:
[0037] Obtain scene files and organize related scene files;
[0038] Determine the generalization direction of autonomous driving simulation testing based on the organized associated scenario files.
[0039] Beneficial effects of the present invention:
[0040] The test script generation method provided by the embodiment of the present invention obtains a seed script, determines the seed script to be generalized according to a preset generalization direction, determines the corresponding generalized scene file according to the seed script to be generalized, obtains the generalized parameter information of the generalized scene file, and generates a generalized test script according to the generalized parameter information, wherein the test script is used for the execution of the autonomous driving simulation test. The embodiment of the present invention determines the seed script to be generalized from the seed script by presetting the generalization direction, and modifies the parameter information inside the file according to the scene file corresponding to the script, automatically generates a generalized test script, and automatically generates the test script according to the generalization direction from a large number of seed scripts, greatly improving the preparation efficiency and test coverage of the simulation test. After seed script screening, generalization scene selection, and generalization parameter modification, the generalized test script has strong adaptability and portability, and can be modified and adapted according to different simulation script frameworks to further meet the needs of autonomous driving simulation testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 This is one of the step flow charts of a test script generation method provided by an embodiment of the present invention;
[0042] Figure 2 yes Figure 1 A method flow chart of step 101 of the test script generation method provided in an embodiment of the present invention;
[0043] Figure 3 yes Figure 1 A method flow chart of step 102 of the test script generation method provided in an embodiment of the present invention;
[0044] Figure 4 yes Figure 1 A method flow chart of step 103 of the test script generation method provided in an embodiment of the present invention;
[0045] Figure 5 yes Figure 1 A method flow chart of step 104 of the test script generation method provided in an embodiment of the present invention;
[0046] Figure 6 This is a second step flow chart of a test script generation method provided by an embodiment of the present invention;
[0047] Figure 7 is a flow chart of a test script generation method provided by an embodiment of the present invention;
[0048] Figure 8 It is a structural schematic diagram of a test script generating device provided by an embodiment of the present invention;
[0049] Fig. 9 It is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.
[0051] Reference Figure 1 , shows one of the step flow charts of the test script generation method provided by an embodiment of the present invention, the method may include:
[0052] Step 101, obtain a seed script, and determine the seed script to be generalized according to a preset generalization direction.
[0053] In the embodiment of the present invention, in order to realize the automatic driving simulation test, on the basis of some existing test case scripts, the test scripts are fully, comprehensively and effectively generalized, so as to efficiently and comprehensively utilize the previous test technology and experience, and quickly and automatically generate test scripts suitable for generalization of multiple parameters. This embodiment transforms a large number of manual generalization script working modes into automatic generation of test scripts according to the expected requirements, greatly improving the number and efficiency of generalized script generation. This embodiment can execute the executable module stored in the storage module through the automatic driving simulation test script generation device, including at least one software function module that can be stored in the storage module in the form of software or firmware or solidified in the operating system of the automatic driving simulation test script generation device, which is not specifically limited here.
[0054] It should be noted that the embodiment of the present invention pre-acquires the seed script and the associated scene file corresponding to the seed script, wherein the associated scene file is a scene file obtained by classifying and organizing all the scene files, thereby sorting out the correlation between the scene files, summarizing and refining the corresponding scene change rules of the autonomous driving simulation test, and combining the scenes in actual production life and reasonable assumptions to derive the expected generalization direction within the application scope of the autonomous driving simulation test, and determine the seed script to be generalized according to the preset generalization direction obtained.
[0055] Specifically, scene files corresponding to all scripts to be generalized that meet the preset generalization direction are screened out from seed scripts and associated scene files, all associated scene files to be generalized are obtained by traversing the screened out scene files, seed scenes that meet the generalization direction are screened out from the obtained associated scene files to be generalized, seed numbers of seed scripts to be generalized are extracted according to the seed scenes, and traversing the seed script folder according to the seed numbers to determine the seed scripts to be generalized.
[0056] In this embodiment, the seed scripts to be generalized are determined from a large number of seed scripts according to the preset generalization direction, and the test scripts corresponding to the test requirements can be screened out, avoiding processing a large number of irrelevant script files, occupying resources, and improving the efficiency of automatically generating test scripts.
[0057] Step 102: Determine a corresponding generalized scene file according to the seed script to be generalized.
[0058] It should be noted that after the desired generalization direction is determined in advance, the automatic generalization of the script is performed. First, the seed number needs to be obtained. After the script file to be generalized is determined, since there are many scenarios available for generalization, it is impossible to completely generalize all working conditions in practice, and it is not necessary to generalize all working conditions. Therefore, it is necessary to screen the appropriate scenarios. For example, from a large number of simulation scenarios, combined with the quality and effectiveness of the simulation scenarios in the automated test, the appropriate generalization scenario files can be selected. On this basis, the generalization scenario file numbers are specially named to distinguish other scenarios.
[0059] In an embodiment of the present invention, a corresponding generalized scene file is determined based on a seed script to be generalized. Specifically, it is necessary to first select a specific scene library folder, and filter the scene files in the scene library folder based on the seed number of the seed script to be generalized. At the same time, the storage path of the scene file is obtained, and a readable and executable scene file is obtained based on the storage path and the scene file. On this basis, the preliminarily filtered scene files are filtered, and other interfering scenes such as seed scenes or other scenes are excluded according to the naming rules of the generalized scene files, and finally the corresponding generalized scene file is determined.
[0060] It should be noted that the naming rules for generalized scenario files are not specifically limited in this embodiment. In actual use, the file number can be set as needed. For example, the name may include test conditions, file path, case number information, etc., and each case will not be described one by one here.
[0061] In this embodiment, by comparing the generalized scenario file with the information in the seed scenario, it is determined that the generalized scenario file is generalized based on the seed scenario, thereby improving the accuracy of the generalized parameter information of the generalized scenario file, so as to generate a test script that adapts to the test requirements.
[0062] Step 103: Obtain generalized parameter information of the generalized scene file.
[0063] In the embodiment of the present invention, based on the generalized scene files that are readable and executable that are screened out, it is necessary to read the parameters inside them efficiently and quickly, and obtain the generalized parameter information of the generalized scene files, that is, the generalized parameters and specific parameters. Specifically, a list of generalized scene files to be read can be established, and the content of each generalized scene file to be read can be read, and the scene file information that meets the generalization direction can be quickly and effectively extracted. Preferably, the generalized scene files are screened for content through regular expressions, and the screened generalized parameters and specific parameters are returned. Among them, this embodiment uses a regular expression matching method for text information, and obtains specific parameters corresponding to the generalized parameters through a regular expression matching method, and stores the specific parameters and corresponding values for subsequent generalization use.
[0064] It should be noted that the generalized scene file needs to be verified before obtaining the generalized parameter information of the generalized scene file. Specifically, the information in the generalized scene file is first read and compared with the information in the corresponding seed scene file selected previously to determine whether the information in the generalized scene file is generalized based on the seed scene. If it is found during the verification that these scenes do not correspond to the seed scene, they are directly ignored without further processing. If the verification passes, it is determined that the scene file corresponding to the seed scene is placed in the generalized scene library for subsequent use.
[0065] Step 104: Generate a generalized test script based on the generalized parameter information, wherein the test script is used for executing the autonomous driving simulation test.
[0066] In the embodiment of the present invention, the generalized specific parameters are modified according to the generalized parameter information, so as to generate a generalized test script. Specifically, first, the corresponding number of the scene file is modified, which is a scheduling mechanism corresponding to the associated application scenario, and the consistency between them must be ensured; secondly, the generalized parameters are modified, which is a specific presentation of the generalization direction, reflecting the generalization process and the specific differences between each generalized scenario and script; finally, the specific values of the generalized parameters are modified, which is a clear definition of the generalized parameters, generating specific generalized information of multiple generalized parameter combinations, and generating a generalized test script according to the specific generalized information, wherein the test script is used for the execution of the autonomous driving simulation test, and all the generated test scripts are stored and archived according to different test contents or test times for use in the autonomous driving simulation test.
[0067] The test script generation method provided by the embodiment of the present invention obtains a seed script, determines the seed script to be generalized according to a preset generalization direction, determines the corresponding generalized scene file according to the seed script to be generalized, obtains the generalized parameter information of the generalized scene file, and generates a generalized test script according to the generalized parameter information, wherein the test script is used for the execution of the autonomous driving simulation test. The embodiment of the present invention determines the seed script to be generalized from the seed script by presetting the generalization direction, and modifies the parameter information inside the file according to the scene file corresponding to the script, automatically generates a generalized test script, and automatically generates the test script according to the generalization direction from a large number of seed scripts, greatly improving the preparation efficiency and test coverage of the simulation test. After seed script screening, generalization scene selection, and generalization parameter modification, the generalized test script has strong adaptability and portability, and can be modified and adapted according to different simulation script frameworks to further meet the needs of autonomous driving simulation testing.
[0068] Further, see Figure 2 , Figure 2 yes Figure 1 The method flow chart of step 101 of the test script generation method provided by the embodiment of the present invention, step 101 includes:
[0069] Step 1011, obtain the seed script and the associated scene file corresponding to the seed script.
[0070] Step 1012: Screen the associated scene files according to the preset generalization direction to determine the seed scene to be generalized.
[0071] In this embodiment, according to the preset generalization direction, the obtained seed script and the associated scene file corresponding to the seed script, a suitable scene is screened out from the associated scene file as a seed scene. Among them, there are many scenes available for generalization, and it is impossible to completely generalize all working conditions in practice, nor is it necessary to generalize all working conditions, so it is necessary to screen suitable scenes as seed scenes. Specifically, appropriate generalized scene seeds can be selected from a large number of simulation scenes, combining quality and effectiveness. On this basis, the scene number is specially named to distinguish other scenes.
[0072] Step 1013: extract the seed scene to be generalized to obtain the seed number of the seed scene.
[0073] Specifically, for each generalized seed number, a corresponding generalized scene can be found, and all basic information in each scene to be generalized is extracted. In this embodiment, the seed number of the seed scene is obtained by extracting the seed scene to be generalized, so as to obtain the scene reference. On this basis, other desired generalization directions are retained as specific scene parameters, and a series of scene sequences with parameters based on the generalization directions are obtained.
[0074] Step 1014, traverse the seed scripts according to the seed number to determine the seed script to be generalized.
[0075] It should be noted that, in the above steps 1011 to 1014, by obtaining the seed script and the associated scene file corresponding to the seed script, according to the preset generalization direction and the obtained seed script and the associated scene file corresponding to the seed script, a suitable scene is screened out from the associated scene file as the seed scene, the seed scene to be generalized is extracted and processed to obtain the seed number of the seed scene, the seed script is traversed, and the seed script to be generalized is determined. By determining the seed script to be generalized from a large number of seed scripts according to the preset generalization direction, the test script corresponding to the test requirements can be screened out, avoiding processing of a large number of irrelevant script files, occupying resources, and improving the efficiency of automatically generating test scripts.
[0076] Further, see Figure 3 , Figure 3 yes Figure 1 The method flow chart of step 102 of the test script generation method provided in the embodiment of the present invention, step 102 includes:
[0077] Step 1021, according to the seed number of the seed script to be generalized, determine the storage path of the scene file corresponding to the seed number.
[0078] Step 1022: Determine the target scene file according to the storage path of the scene file.
[0079] Step 1023: Filter the acquired associated scene files according to the target scene file to determine the generalized scene file corresponding to the seed script to be generalized.
[0080] In this embodiment, according to the seed number of the seed script to be generalized, the storage path of the scene file corresponding to the seed number is determined, thereby determining the target scene file corresponding to the storage path, and then filtering the obtained associated scene files to determine the generalized scene file corresponding to the seed script to be generalized. Specifically, it is necessary to first select a specific scene library folder, and filter the scene files in the scene library folder according to the seed number of the seed script to be generalized. At the same time, the storage path of the scene file is obtained, and the readable and executable scene file is obtained according to the storage path and the scene file. On this basis, the initially screened associated scene files are filtered, and according to the naming rules of the generalized scene files, other interfering scenes such as seed scenes or other scenes are excluded, and finally the corresponding generalized scene file is determined.
[0081] Further, see Figure 4 , Figure 4 yes Figure 1 The method flow chart of step 103 of the test script generation method provided in the embodiment of the present invention, step 103 includes:
[0082] Step 1031 , obtaining parameter information in the generalized scene file, and comparing the parameter information with the seed scene to be generalized.
[0083] In this embodiment, the screened generalized scene files are verified by an automated program. The generalized parameter information of the generalized scene files is obtained, and the generalized scene files are verified. Specifically, the information in the generalized scene files is first read and compared with the information in the corresponding seed scenes selected previously to determine whether the information in the generalized scene files is generalized from the seed scenes. If it is found during the verification that these scenes do not correspond to the seed scenes, they are directly ignored without further processing. If the verification passes, it is determined that the scene files corresponding to the seed scenes are placed in the generalized scene library for subsequent use.
[0084] Step 1032: If the parameter information is consistent with the seed scene to be generalized, obtain the generalized parameter information of the generalized scene file according to a preset text information matching method.
[0085] Specifically, if the parameter information is consistent with the seed scene to be generalized in step 1032, after obtaining the generalized parameter information of the generalized scene file according to the preset text information matching method, the following is further included:
[0086] Verifying the generalized parameter information of the generalized scene file and generating a verification result; wherein verifying the generalized parameter information of the generalized scene file includes verifying the generalized parameters and specific values in the generalized parameter information;
[0087] If there is a deviation in the verification result, the generalization parameter information is obtained again.
[0088] This embodiment compares the generalized scenario file with the information in the seed scenario to determine that the generalized scenario file is generalized based on the seed scenario, thereby improving the accuracy of the generalized parameter information of the generalized scenario file, so as to generate a test script that adapts to the test requirements.
[0089] Further, see Figure 5 , Figure 5 yes Figure 1 The method flow chart of step 104 of the test script generation method provided in the embodiment of the present invention, step 104 includes:
[0090] Step 1041, modifying the generalization parameters and specific parameters according to the generalization parameter information to generate specific generalization information;
[0091] It should be noted that modifying the generalized parameters and specific parameters according to the generalized parameter information includes: verifying the generalized parameters and specific parameters. If the verification passes, modifying the generalized parameters and specific parameters to generate specific generalized information. Specifically, it is necessary to verify whether the number of parameters is consistent with the expected number, and then verify whether the specifications of the parameters are consistent with the expected specifications of the design, and finally verify whether the corresponding specific parameters are reasonable. If there is a deviation in the verification result, it indicates that there are imperfections or inaccuracies in the entire extraction process from the scene to the parameters, and return to re-extract the generalized parameter information and verify. If the verification passes, further parameter modification can be prepared.
[0092] In this embodiment, when the generalization parameters and specific values are determined, the generalization parameters and specific parameters are modified to generate specific generalization information, which specifically includes modification of the generalization scene number, modification of the generalization parameters and modification of the specific parameters, and generates specific generalization information of a combination of multiple generalization parameters.
[0093] Step 1042, generating a generalized test script according to the generated specific generalized information;
[0094] Step 1043, storing the generalized test script so that the autonomous driving simulation test executes the generalized test script.
[0095] In this embodiment, by modifying the generalized parameters and specific parameters, the required test script is written according to the generated specific generalized information, and the generalized test script is used for the actual autonomous driving simulation test execution. In particular, the automatic generation and writing of the script uses the automation program in the present invention to archive all the generated test scripts according to different test contents or test times for use in the autonomous driving simulation test.
[0096] Reference Figure 6 , shows a second step flow chart of a test script generation method provided by an embodiment of the present invention, which method is basically the same as the test script generation method provided by the first embodiment of the present invention, the difference being that, with reference to Figure 6 ,include:
[0097] Step 105, obtaining scene files, and organizing the associated scene files.
[0098] In an embodiment of the present invention, in order to filter out seed scripts to be generalized from a large number of script files according to the desired generalization direction, this embodiment obtains and collects scene files, classifies and organizes all scene files as necessary, sorts out the correlation between scene files, determines the corresponding scene change rules of the autonomous driving simulation test, and combines the phenomena in actual production life and reasonable assumptions to derive the desired generalization direction within the application scope of the autonomous driving simulation test.
[0099] Step 106: Determine the generalization direction of the autonomous driving simulation test based on the sorted associated scenario files.
[0100] It should be noted that the generalization direction of autonomous driving simulation testing is to support users in writing corresponding logic, which is conducive to the generalization of autonomous driving simulation scenarios and to ensure the consistency of autonomous driving simulation scenarios, so as to ensure that the regenerated configuration scenarios and contents are legal and have application value that meets design requirements.
[0101] Step 101, obtain a seed script, and determine the seed script to be generalized according to a preset generalization direction.
[0102] Step 102: Determine a corresponding generalized scene file according to the seed script to be generalized.
[0103] Step 103: Obtain generalized parameter information of the generalized scene file.
[0104] Step 104: Generate a generalized test script based on the generalized parameter information, wherein the test script is used for executing the autonomous driving simulation test.
[0105] The above steps 101 - 104 refer to the first embodiment of the present invention and are not described in detail here.
[0106] Compared with the prior art, the embodiments of the present invention obtain a seed script according to a determined generalization direction of an autonomous driving simulation test, determine a seed script to be generalized according to a preset generalization direction, determine a corresponding generalized scene file according to the seed script to be generalized, obtain generalized parameter information of the generalized scene file, and generate a generalized test script according to the generalized parameter information, wherein the test script is used for autonomous driving simulation test execution. The embodiments of the present invention determine the seed script to be generalized from the seed script by presetting a generalization direction, and modify the parameter information inside the file according to the scene file corresponding to the script, automatically generate a generalized test script, and automatically generate a test script from a large number of seed scripts according to the generalization direction, greatly improving the preparation efficiency and test coverage of the simulation test. After seed script screening, generalization scene selection, and generalization parameter modification, the generalized test script has strong adaptability and portability, and can be modified and adapted according to different simulation script frameworks to further meet the needs of autonomous driving simulation testing.
[0107] In order to enable those skilled in the art to more clearly understand the overall process of the test script generation method disclosed in the first and second embodiments of the present invention, refer to Figure 7 The flowchart of the test script generation method is used as an example to illustrate.
[0108] Step 201, determine the generalization direction of the autonomous driving simulation test.
[0109] In an embodiment of the present invention, relevant scene files are collected, all scene files are classified and organized as necessary, the correlation between the scene files is sorted out, the scene change rules corresponding to the autonomous driving simulation test are summarized and refined, and combined with the phenomena in actual production life and reasonable assumptions, the expected generalization direction within the application scope of the autonomous driving simulation test is obtained.
[0110] Step 202, obtaining the seed number of the seed script to be generalized.
[0111] Step 203: Determine whether it is a seed number to be generalized
[0112] Specifically, the seed number of the seed script to be generalized is verified, and the basic information such as scene size, scene type, and scene adaptation method in the scene file is read and compared with the list of generalization directions to confirm whether it is the seed number that needs to be generalized. If the seed number screening is incorrect, it will be directly ignored, and the confirmed accurate seed number will be uniformly stored in the target seed number library for subsequent use.
[0113] Step 204: determine the generalized scene file corresponding to the seed script to be generalized.
[0114] Specifically, according to the determined seed number to be generalized, the next step of scene generalization is performed. Each generalized seed number finds the corresponding generalized scene, extracts all the basic information in each scene to be generalized, and determines the generalized scene file corresponding to the seed script to be generalized, so as to obtain the scene benchmark.
[0115] Step 205: determine whether it is a generalized scene file.
[0116] In this embodiment, the generalized scene file corresponding to the generalized seed script is verified. Specifically, the information of the generalized scene file is read and compared with the information in the previous seed scene to determine whether it is generalized from the seed scene. If it is found that these scenes are not relative to the seed scene during the traversal check process, they are directly ignored, and the scene files that can correspond to the seed scene are put into the generalized target scene library for subsequent use.
[0117] Step 206: Obtain generalized parameter information of the generalized scene file.
[0118] Step 207, determine whether the generalization parameters and specific parameters are expected by generalization
[0119] Verify the extracted generalized parameters and specific values. Specifically, first, verify whether the number of parameters is consistent with the expected number, then verify whether the specifications of the parameters are consistent with the expected specifications of the design, and finally verify whether the corresponding specific values are reasonable. If there is a deviation in the verification result, it indicates that there are imperfections or inaccuracies in the entire extraction process from the scene to the parameter. At this time, it is necessary to return to the seed number library for re-extraction and verification, and enter step 204 to determine the generalized scene file corresponding to the seed script to be generalized. If the verification process is smooth and correct, enter step 208, modify the generalized parameters and specific parameters, and generate a generalized test script.
[0120] Step 208, modify the generalized parameters and specific parameters to generate a generalized test script.
[0121] Step 209: store the generalized test script.
[0122] Compared with the prior art, the embodiments of the present invention determine the seed script that needs to be generalized from the seed script by presetting the generalization direction, and modify the parameter information inside the file according to the scenario file corresponding to the script, and automatically generate a generalized test script. The test script is automatically generated from a large number of seed scripts according to the generalization direction, which greatly improves the preparation efficiency and test coverage of the simulation test. After seed script screening, generalization scenario selection, and generalization parameter modification, the generalized test script has strong adaptability and portability, and can be modified and adapted according to different simulation script frameworks to further meet the needs of autonomous driving simulation testing.
[0123] Reference Figure 8 , shows a schematic diagram of the structure of a test script generating device provided by an embodiment of the present invention, the device may include:
[0124] The first acquisition module 301 is used to acquire a seed script and determine the seed script to be generalized according to a preset generalization direction;
[0125] A first determination module 302 is used to determine a corresponding generalized scene file according to the seed script to be generalized;
[0126] The second acquisition module 303 is used to acquire generalized parameter information of the generalized scene file;
[0127] The first generation module 304 is used to generate a generalized test script according to the generalized parameter information, wherein the test script is used for executing an autonomous driving simulation test.
[0128] Furthermore, the first acquisition module 301 includes:
[0129] A first acquisition submodule is used to acquire a seed script and an associated scene file corresponding to the seed script;
[0130] A first processing submodule, configured to screen the associated scene files according to a preset generalization direction to determine a seed scene to be generalized;
[0131] The second processing submodule is used to extract and process the seed scene to be generalized to obtain the seed number of the seed scene;
[0132] The third processing submodule is used to traverse the seed script according to the seed number to determine the seed script to be generalized.
[0133] Furthermore, the first determining module 302 includes:
[0134] A first determination submodule is used to determine the storage path of the scene file corresponding to the seed number according to the seed number of the seed script to be generalized;
[0135] A second determination submodule is used to determine a target scene file according to a storage path of the scene file;
[0136] The third determination submodule is used to filter the acquired associated scene files according to the target scene file to determine the generalized scene file corresponding to the seed script to be generalized.
[0137] Furthermore, the second acquisition module 303 includes:
[0138] A second acquisition submodule is used to acquire parameter information in the generalized scene file and compare the parameter information with the seed scene to be generalized;
[0139] The third acquisition submodule acquires the generalized parameter information of the generalized scene file according to a preset text information matching method if the parameter information is consistent with the seed scene to be generalized.
[0140] Furthermore, the second acquisition module 303 further includes:
[0141] A verification submodule, configured to verify the generalized parameter information of the generalized scene file and generate a verification result; wherein the verification of the generalized parameter information of the generalized scene file includes verifying the generalized parameters and specific values in the generalized parameter information;
[0142] The fourth acquisition submodule is used to re-acquire the generalization parameter information if there is a deviation in the verification result.
[0143] Furthermore, the first generating module 304 includes:
[0144] A first generating submodule, used for modifying the generalization parameters and specific parameters according to the generalization parameter information to generate specific generalization information;
[0145] A first generating submodule, used for generating a generalized test script according to the generated specific generalized information;
[0146] The storage submodule is used to store generalized test scripts so that the autonomous driving simulation test executes the generalized test scripts.
[0147] Furthermore, the device also includes:
[0148] The third acquisition module is used to acquire scene files and organize the associated scene files;
[0149] The second determination module is used to determine the generalization direction of the autonomous driving simulation test based on the sorted associated scenario files.
[0150] The test script generation device provided by the embodiment of the present invention obtains a seed script, determines the seed script to be generalized according to a preset generalization direction, determines the corresponding generalized scene file according to the seed script to be generalized, obtains the generalized parameter information of the generalized scene file, and generates a generalized test script according to the generalized parameter information, wherein the test script is used for the execution of the autonomous driving simulation test. The embodiment of the present invention determines the seed script to be generalized from the seed script by presetting the generalization direction, and modifies the parameter information inside the file according to the scene file corresponding to the script, automatically generates a generalized test script, and automatically generates the test script according to the generalization direction from a large number of seed scripts, greatly improving the preparation efficiency and test coverage of the simulation test. After seed script screening, generalization scene selection, and generalization parameter modification, the generalized test script has strong adaptability and portability, and can be modified and adapted according to different simulation script frameworks to further meet the needs of autonomous driving simulation testing.
[0151] The embodiment of the present invention further provides an electronic device, such as Fig. 9 As shown, it includes a processor 401, a communication interface 402, a memory 403 and a communication bus 404, wherein the processor 401, the communication interface 402, and the memory 403 communicate with each other through the communication bus 404.
[0152] Memory 403, used for storing computer programs;
[0153] The processor 401, when used to execute the program stored in the memory 403, can implement the following steps:
[0154] Obtain a seed script, and determine the seed script to be generalized according to a preset generalization direction;
[0155] Determine the corresponding generalized scene file according to the seed script to be generalized;
[0156] Obtaining generalization parameter information of the generalization scene file;
[0157] A generalized test script is generated according to the generalized parameter information, wherein the test script is used for executing an autonomous driving simulation test.
[0158] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0159] The communication interface is used for communication between the above terminal and other devices.
[0160] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0161] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can 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, discrete hardware components.
[0162] In another embodiment provided by the present invention, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the component data monitoring method described in any of the above embodiments.
[0163] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). 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 includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0164] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0165] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0166] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A test script generation method, characterized in that: The method comprises: Obtain a seed script, and determine the seed script to be generalized according to a preset generalization direction; Determine the corresponding generalized scene file according to the seed script to be generalized; Obtaining generalized parameter information of the generalized scene file; A generalized test script is generated according to the generalized parameter information, wherein the test script is used for executing an autonomous driving simulation test.
2. The method according to claim 1, characterized in that The step of obtaining a seed script and determining a seed script to be generalized according to a preset generalization direction includes: Obtain a seed script and an associated scene file corresponding to the seed script; According to a preset generalization direction, the associated scene files are screened to determine a seed scene to be generalized; Extracting and processing the seed scene to be generalized to obtain a seed number of the seed scene; According to the seed number, the seed script is traversed to determine the seed script to be generalized.
3. The method according to claim 1, characterized in that The step of determining a corresponding generalized scene file according to the seed script to be generalized includes: According to the seed number of the seed script to be generalized, determine the storage path of the scene file corresponding to the seed number; Determine the target scene file according to the storage path of the scene file; According to the target scene file, the acquired associated scene files are filtered to determine the generalized scene file corresponding to the seed script to be generalized.
4. The method according to claim 1, characterized in that: The obtaining of generalized parameter information of the generalized scene file includes: Obtaining parameter information in the generalized scene file, and comparing the parameter information with the seed scene to be generalized; If the parameter information is consistent with the seed scene to be generalized, the generalized parameter information of the generalized scene file is obtained according to a preset text information matching method.
5. The method according to claim 4, characterized in that If the parameter information is consistent with the seed scene to be generalized, after obtaining the generalized parameter information of the generalized scene file according to a preset text information matching method, the method further includes: Verifying the generalized parameter information of the generalized scene file to generate a verification result; wherein the verifying the generalized parameter information of the generalized scene file includes verifying the generalized parameters and specific values in the generalized parameter information; If there is a deviation in the verification result, the generalization parameter information is obtained again.
6. The method according to claim 1, characterized in that Generating a generalized test script according to the generalized parameter information, wherein the test script is used for executing an autonomous driving simulation test, including: According to the generalized parameter information, the generalized parameters and the specific parameters are modified to generate specific generalized information; Generate a generalized test script according to the generated specific generalized information; The generalized test scripts are stored so that the autonomous driving simulation test executes the generalized test scripts.
7. The method according to claim 1, characterized in that The step of obtaining the seed script, before determining the seed script to be generalized according to the preset generalization direction, further includes: Obtain scene files and organize related scene files; Determine the generalization direction of autonomous driving simulation testing based on the organized associated scenario files.
8. A test script generating device, characterized in that: The device comprises: A first acquisition module is used to acquire a seed script and determine the seed script to be generalized according to a preset generalization direction; A first determination module, used to determine a corresponding generalized scene file according to a seed script to be generalized; A second acquisition module, used to acquire generalized parameter information of the generalized scene file; The first generation module is used to generate a generalized test script according to the generalized parameter information, wherein the test script is used for executing an autonomous driving simulation test.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor is used to implement the method for generating a test script as described in any one of claims 1-7 when executing a program stored in a memory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for generating a test script as described in any one of claims 1 to 7 is implemented.
