Test case generation method, device, terminal device and storage medium
By analyzing the valid sheet table in the EXCLE file to generate structured data, the problem of low testing efficiency of electronic control unit testing software is solved, automatic test case generation is realized, and testing efficiency is improved.
Patent Information
- Application Number
- CN202311269263.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-04-01
AI Technical Summary
In the prior art, when testing using the testing software of the electronic control unit, parameters need to be input manually, resulting in low testing efficiency.
By determining the target EXCLE file based on the command parameters, determining its valid sheet tables, and analyzing these sheet tables, structured data that can be recognized by the test software of the electronic control unit, and finally generating test cases.
This reduces the workload of testers to enter parameters on the test software interface, improves the efficiency of tests, and reduces the preliminary preparation work for tests.
Smart Images

Figure CN119739620A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of testing technology, and in particular, relates to a test case generation method, apparatus, terminal device and storage medium. Background Art
[0002] The test software for electronic control units is a tool for the development of automotive ECUs, and is also gradually becoming a tool for the development of heavy machinery and industrial automation.
[0003] At present, when using the test software of the electronic control unit for testing, the tester needs to manually operate the interface of the test software of the electronic control unit to input the test data and steps in order to generate the test case. This method has the problem of low testing efficiency. Summary of the invention
[0004] The embodiments of the present application provide a test case generation method, apparatus, terminal device and storage medium, which can solve the problem of low testing efficiency caused by the need to manually input parameters to generate test cases when testing using the test software of an electronic control unit.
[0005] In a first aspect, an embodiment of the present application provides a test case generation method, comprising:
[0006] Determine the target EXCLE file based on the command parameters;
[0007] Determine a valid sheet in the target EXCLE file;
[0008] Parsing all the valid sheets to generate structured data that can be recognized by the test software of the electronic control unit;
[0009] Generate test cases based on the structured data.
[0010] In a possible implementation manner of the first aspect, determining the target EXCLE file according to the command parameters includes:
[0011] Parsing the command parameters to obtain path information;
[0012] The target EXCLE file is determined by querying according to the path information.
[0013] In a possible implementation manner of the first aspect, determining a valid sheet in the target EXCLE file includes:
[0014] Searching for a preset identifier in each sheet in the target EXCLE file;
[0015] When the sheet contains the preset identifier, it is determined that the sheet is a valid sheet.
[0016] In a possible implementation manner of the first aspect, parsing all the valid sheets to generate structured data that can be recognized by the test software of the electronic control unit includes:
[0017] Identify the Chinese symbols in each row of each valid sheet and the data content of the column where each Chinese symbol is located;
[0018] According to the preset mapping table, the Chinese identifier is converted into an English identifier that can be recognized by the test software of the electronic control unit, and the data content of each row is assigned to the corresponding English identifier to generate a test step according to the column order of the Chinese identifier, and the test steps are sorted according to the row order of the data content to form the structured data.
[0019] In a possible implementation of the first aspect, the Chinese identifier includes a Chinese time identifier, a Chinese input signal identifier, a Chinese expected identifier, and a Chinese test description identifier, the English identifier includes an English time identifier, an English input signal identifier, an English expected identifier, and an English test description identifier, and the data content includes time data, input data, expected data, and test description data;
[0020] The step of converting the Chinese identifier into an English identifier that can be recognized by the test software of the electronic control unit according to the preset mapping table, and allocating the data content of each row to the corresponding English identifier according to the column order of the Chinese identifier to generate a test step includes:
[0021] According to the preset mapping table, the Chinese time identifier is converted into an English time identifier that can be recognized by the test software of the electronic control unit, the Chinese input signal identifier is converted into an English input signal identifier that can be recognized by the test software of the electronic control unit, the Chinese expected identifier is converted into an English expected identifier that can be recognized by the test software of the electronic control unit, and the Chinese test description identifier is converted into an English test description identifier that can be recognized by the test software of the electronic control unit;
[0022] Determine a row of data contents to be allocated from the data contents in each row, allocate the time data in the data contents in the row to the English time identifier according to the column order of the Chinese time identifier, allocate the input data in the data contents in the row to the English input signal identifier according to the column order of the Chinese input signal identifier, allocate the expected data in the data contents in the row to the English expected identifier according to the column order of the Chinese expected identifier, allocate the test description data in the data contents in the row to the English test description identifier according to the column order of the Chinese test description identifier, and after all the data contents in the row are allocated, generate the test steps corresponding to the row.
[0023] In a possible implementation manner of the first aspect, generating a test case according to the structured data includes:
[0024] Accessing the API interface of the test software of the electronic control unit according to the structured data, generating a pkg file for the structured data corresponding to each valid sheet;
[0025] Aggregate all the pkg files and generate test cases in prj format.
[0026] In a possible implementation manner of the first aspect, the test case generating method further includes:
[0027] Acquire first data and second data having a mapping relationship; the first data is data in an EXCEL format, and the second data is data that can be recognized by the test software of the electronic control unit;
[0028] The preset mapping table is updated according to the first data and the second data.
[0029] In a second aspect, an embodiment of the present application provides a test case generation device, comprising:
[0030] A target EXCLE file determination module is used to determine the target EXCLE file according to command parameters;
[0031] A valid sheet determination module, used to determine a valid sheet in the target EXCLE file;
[0032] A parsing module, used to parse all the valid sheets to generate structured data that can be recognized by the test software of the electronic control unit;
[0033] The test case generation module is used to generate test cases according to the structured data.
[0034] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the methods described in the first aspect when executing the computer program.
[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and wherein the computer program implements any one of the methods described in the first aspect when executed by a processor.
[0036] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute any of the methods described in the first aspect above.
[0037] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0038] When using the test software of the electronic control unit for testing, first determine the target EXCLE file according to the command parameters, then determine the valid sheets in the target EXCLE file, and then parse all valid sheets to generate structured data that can be recognized by the test software of the electronic control unit. Finally, generate test cases based on the structured data.
[0039] Therefore, when using the test software of the electronic control unit for testing, the tester only needs to configure the parameters in the EXCLE file to generate the corresponding test cases. The tester no longer needs to input parameters on the interface of the test software of the electronic control unit, which reduces the workload of inputting data and improves the efficiency of testing.
[0040] At the same time, when conducting the test software test of the electronic control unit, the tester configured the corresponding EXCLE file. When conducting similar tests later, the tester only needs to make partial modifications to the EXCLE file, which reduces the tester's preparatory work before the test and improves the efficiency of the test.
[0041] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0043] Figure 1 It is a flowchart of a test case generation method provided by an embodiment of the present application;
[0044] Figure 2 is a flowchart of a test case generation method provided by another embodiment of the present application;
[0045] Figure 3 is a schematic diagram of a valid sheet provided by another embodiment of the present application;
[0046] Figure 4 is a flowchart of a test case generation method provided by another embodiment of the present application;
[0047] Figure 5 It is a structural schematic diagram of a test case generating device provided in an embodiment of the present application;
[0048] Figure 6 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0050] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0051] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0052] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0053] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0054] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0055] Figure 1 The flowchart of the test case generation method provided by an embodiment of the present application is shown. Figure 1 As shown, the test case generation method includes steps S101 to S104.
[0056] Step S101, determining the target EXCLE file according to the command parameters.
[0057] Specifically, the tester can create a corresponding EXCLE file according to the test parameters of each test item in advance, and then name the EXCLE file.
[0058] Exemplarily, each EXCLE file corresponds to a test item, each EXCLE file includes multiple sheets, each sheet corresponds to a sub-test item in a test item, and the data in each sheet is the test data corresponding to the sub-test item.
[0059] The data in the sheet table may include Chinese labels such as "Use Case Name Identifier", "Use Case Description Identifier", "Time Identifier", "Input Signal Identifier", "Expected Identifier" and "Test Description Identifier". Among them, the "Use Case Name Identifier" is the name of the sub-test project, which is a Chinese name. The "Use Case Description Identifier" is a general description of the sub-test project. The "Input Signal Identifier" is the data that needs to be input when performing a sub-test project, and may include multiple columns of data, each column of data is the name and specific data of various parameters that need to be set in the sub-project test project. The "Expected Identifier" is the output signal of the sub-test project test, and may include multiple columns of output, each column of data is the name and specific data of various parameters that should be output by the sub-project test project. The "Test Description Identifier" is the test description for each step.
[0060] Testers can adaptively configure the data in each sheet according to the requirements of the actual test project, so that the EXCLE file contains all the data needed for the test project. Finally, a directory is created based on all the EXCLE files, and all the EXCLE files are saved to form a database.
[0061] When the test software of the electronic control unit needs to be used for testing, the tester can send command parameters through operation. After receiving the command parameters, the command parameters are parsed to obtain path information. The path information may include directory information and name information, through which the target EXCLE file can be found, and the target EXCLE file stores the data of the project to be tested by the tester.
[0062] Exemplarily, the test software for the electronic control unit is ECU-TEST software.
[0063] Step S102, determining a valid sheet in the target EXCLE file.
[0064] Specifically, each EXCLE file includes multiple sheets, and the data in each sheet corresponds to a sub-test item in a test item. For example, if the data in the EXCLE file is the test data of temperature control, the data in the first sheet in the EXCLE file can be the test data of temperature control when the vehicle is in a parking state in winter, the data in the second sheet can be the test data of temperature control when the vehicle is in a driving state in winter, the data in the third sheet can be the test data of temperature control when the vehicle is in a parking state in summer, and the data in the fourth sheet can be the test data of temperature control when the vehicle is in a driving state in summer.
[0065] Each sheet includes some special identification information. For example, the identification information in the sheet may include Chinese labels such as "time label", "input signal label", "expected label" and "test description label".
[0066] After the target EXCLE file is determined, the preset identifier can be queried in each sheet. If the sheet contains all the preset identifiers, the sheet is determined to be a valid sheet. If the sheet does not contain all the preset identifiers, the sheet is determined to be an invalid sheet.
[0067] It should be noted that the tester can set the preset identifiers according to the test requirements to ensure that the sheet containing all the preset identifiers contains all the data of the sub-test items.
[0068] Step S103: parse all valid sheets to generate structured data that can be recognized by the test software of the electronic control unit.
[0069] Specifically, after all valid sheets in the target EXCLE file are determined, each valid sheet is parsed one by one to generate structured data that can be recognized by the test software of the electronic control unit. Exemplarily, the structured data is JSON data.
[0070] Step S104: Generate test cases based on the structured data.
[0071] Specifically, after the structured data is determined, the structured data is accessed through the API interface of the test software of the electronic control unit. The data of each valid sheet table can generate a pkg file by calling the API interface, and then the pkg files generated corresponding to all valid sheets are summarized to generate a prj file to obtain the test case.
[0072] Thus, the tester can establish the corresponding EXCLE file in advance according to the test parameters of the test item. When the test software of the electronic control unit needs to be used for testing, by executing steps S101 to S104, the target EXCLE file can be found, and then the valid sheets in the EXCLE file can be parsed to obtain structured data that can be recognized by the test software of the electronic control unit, and then the corresponding test case is generated according to the structured data, and the tester no longer needs to manually input various test parameters on the interface of the test software of the electronic control unit, which reduces the operating difficulty of the tester and improves the test efficiency.
[0073] At the same time, when conducting the test software test of the electronic control unit, the tester configured the corresponding EXCLE file. When conducting similar tests later, the tester only needs to make partial modifications to the EXCLE file, which reduces the tester's preparatory work before the test and improves the efficiency of the test.
[0074] In some embodiments, Figure 2 As shown, step S103 may include step S1031 and step S1032.
[0075] Step S1031, identifying the Chinese symbols in each row of each valid sheet and the data content of the column where each Chinese symbol is located.
[0076] Specifically, after all valid sheets in the target EXCLE file are determined, the Chinese symbols in each row of each valid sheet and the data content of the column where each Chinese symbol is located are identified.
[0077] Step S1032, according to the preset mapping table, convert the Chinese identifier into an English identifier that can be recognized by the test software of the electronic control unit, and assign each row of data content to the corresponding English identifier according to the column order of the Chinese identifier to generate a test step, and sort the test steps according to the row order of the data content to form structured data.
[0078] Specifically, the tester can translate various EXCEL format data (test parameters) into data (test instructions) that can be recognized by the test software of the electronic control unit in advance, and then associate the EXCEL format data with the translated data that can be recognized by the test software of the electronic control unit to form a mapping relationship, and then store the mapping relationship to form a mapping file, that is, to form a preset mapping table.
[0079] For example, if the data in the EXCEL file is a Chinese name, the data in the preset mapping table is the English name data corresponding to the Chinese name; if the data in the EXCEL file is control instruction information, the data in the preset mapping table is the configuration instruction corresponding to the control instruction information and can be recognized by the test software of the electronic control unit.
[0080] When new data in the EXCEL format appears later, the first data in the EXCEL format is translated into second data that can be recognized by the test software of the electronic control unit, and then the first data and the second data are associated to form a mapping relationship, and then the mapping relationship is stored in the preset mapping table to complete the update of the preset mapping table. As the preset mapping table is continuously updated, there are more and more mapping relationships in the preset mapping table, so that the preset mapping table can convert various EXCEL format data into data that can be recognized by the test software of the electronic control unit.
[0081] According to the preset mapping table, the Chinese symbols are converted into English symbols that can be recognized by the test software of the electronic control unit, and the data content of each row is assigned to the corresponding English symbol according to the column order of the Chinese symbol to generate the test steps, and the test steps are sorted according to the row order of the data content to form structured data.
[0082] The Chinese identifiers of each valid sheet include the Chinese time identifier, Chinese input signal identifier, Chinese expected identifier, and Chinese test description identifier. The English identifiers include the English time identifier, English input signal identifier, English expected identifier, and English test description identifier. The data content includes time data, input data, expected data, and test description data (such as Figure 3 shown).
[0083] According to the preset mapping table, the Chinese time identifier is converted into an English time identifier that can be recognized by the test software of the electronic control unit, the Chinese input signal identifier is converted into an English input signal identifier that can be recognized by the test software of the electronic control unit, the Chinese expected identifier is converted into an English expected identifier that can be recognized by the test software of the electronic control unit, and the Chinese test description identifier is converted into an English test description identifier that can be recognized by the test software of the electronic control unit.
[0084] Configure the time data at the corresponding position of the column where the English time identifier is located, configure the input data at the corresponding position of the column where the English input signal identifier is located, configure the expected data at the corresponding position of the column where the English expected identifier is located, and configure the test description data at the corresponding position of the column where the English test description identifier is located to form structured data.
[0085] For example, if the first column of a valid sheet is time data, the Chinese time mark in the column is converted to an English time mark, and the time data in the column is converted to WA format data, where W represents the waiting time (Wait) and A is a specific value. For example, W0.5 represents a waiting time of 0.5s or a waiting time of 0.5ms.
[0086] Columns 2-X are the data of the input signal, and the Chinese input signal identifiers therein are converted into English input signal identifiers, and corresponding values (in digital form) are assigned.
[0087] Columns X+1 to X+N are expected data, and the Chinese input signal identifiers therein are converted into English input signal identifiers, and corresponding values and waiting times are assigned.
[0088] Expected data is read data, which has four representation modes: None, Within, Least, and Cycle.
[0089] Among them, None means nothing, Within means Wait until true, and the number behind it indicates the Timeout value; Least means True for at least, and the number behind it indicates the Minimum duration value; Cycle means checking the Polling Cycle option, and the number behind it indicates the specific value of the option.
[0090] Columns X+N+1 to X+N+M are test description data, and the Chinese input signal identifiers therein are converted into English input signal identifiers, and corresponding assignments and waiting times are performed, and the corresponding input data and output data are configured at the same time.
[0091] Each row of data in a valid sheet represents a test step. Therefore, when converting data in a valid sheet, a row of data content to be assigned is determined from the content of each row of data, and the time data in the data content of the row is assigned to the English time identifier according to the column order of the Chinese time identifier, and the input data in the data content of the row is assigned to the English input signal identifier according to the column order of the Chinese input signal identifier, and the expected data in the data content of the row is assigned to the English expected identifier according to the column order of the Chinese expected identifier, and the test description data in the data content of the row is assigned to the English test description identifier according to the column order of the Chinese test description identifier. After all the data content of the row is assigned, the test step corresponding to the row is generated.
[0092] When all data in the sheet are converted, all test step data obtained after the conversion of the valid sheet are sorted in the conversion order to obtain mapping data, which is a sub-test item.
[0093] After each valid sheet in the target EXCEL file is converted, a mapping data is obtained. When all valid sheets in the EXCEL file are converted, all mapping data are summarized to form structured data.
[0094] In some embodiments, Figure 4 As shown, step S104 may include step S1041 and step S1042.
[0095] Step S1041, accessing the API interface of the test software of the electronic control unit according to the structured data, and generating a pkg file for the structured data corresponding to each valid sheet.
[0096] Specifically, after the structured data is determined, the structured data is accessed through the API interface of the test software of the electronic control unit. The mapping data generated corresponding to each valid sheet table can generate a pkg file by calling the corresponding API interface, and each pkg file corresponds to a sub-test item.
[0097] Step S1042, summarize all pkg files and generate test cases in prj format.
[0098] Specifically, all valid sheets in a target EXCLE file can generate a corresponding pkg file, and then all pkg files are aggregated and packaged to form a prj file, which contains the test data in all valid sheets in the target EXCLE file, and the data in the prj file can be recognized by the test software of the electronic control unit. The obtained prj file is a complete test case. The test software of the subsequent electronic control unit can be tested according to the test case.
[0099] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0100] Figure 5 The structure diagram of the test case generation device provided by the embodiment of the present application is shown. Figure 5 As shown, the test case generating device includes:
[0101] The target EXCLE file determination module 41 is used to determine the target EXCLE file according to the command parameters;
[0102] A valid sheet determination module 42 is used to determine a valid sheet in the target EXCLE file;
[0103] The parsing module 43 is used to parse all the valid sheets to generate structured data that can be recognized by the test software of the electronic control unit;
[0104] The test case generating module 44 is used to generate a test case according to the structured data.
[0105] In some embodiments, the target EXCLE file determination module 41 is further used to:
[0106] Parsing the command parameters to obtain path information;
[0107] The target EXCLE file is determined by querying according to the path information.
[0108] In some embodiments, the valid sheet determination module 42 is further used to:
[0109] Searching for a preset identifier in each sheet in the target EXCLE file;
[0110] When the sheet contains the preset identifier, it is determined that the sheet is a valid sheet.
[0111] In some embodiments, the parsing module 43 is further configured to:
[0112] Identify the Chinese symbols in each row of each valid sheet and the data content of the column where each Chinese symbol is located;
[0113] According to the preset mapping table, the Chinese identifier is converted into an English identifier that can be recognized by the test software of the electronic control unit, and the data content of each row is assigned to the corresponding English identifier to generate a test step according to the column order of the Chinese identifier, and the test steps are sorted according to the row order of the data content to form the structured data.
[0114] In some embodiments, the Chinese identifier includes a Chinese time identifier, a Chinese input signal identifier, a Chinese expected identifier, and a Chinese test description identifier; the English identifier includes an English time identifier, an English input signal identifier, an English expected identifier, and an English test description identifier; the data content includes time data, input data, expected data, and test description data; the parsing module 43 is further used to:
[0115] Determine a row of data contents to be allocated from the data contents in each row, allocate the time data in the data contents in the row to the English time identifier according to the column order of the Chinese time identifier, allocate the input data in the data contents in the row to the English input signal identifier according to the column order of the Chinese input signal identifier, allocate the expected data in the data contents in the row to the English expected identifier according to the column order of the Chinese expected identifier, allocate the test description data in the data contents in the row to the English test description identifier according to the column order of the Chinese test description identifier, and after all the data contents in the row are allocated, generate the test steps corresponding to the row.
[0116] In some embodiments, the test case generation module 44 is further configured to:
[0117] Accessing the API interface of the test software of the electronic control unit according to the structured data, generating a pkg file for the structured data corresponding to each valid sheet;
[0118] Aggregate all the pkg files and generate test cases in prj format.
[0119] In some embodiments, the test case generating device further comprises:
[0120] An acquisition module, used for acquiring first data and second data having a mapping relationship; the first data is data in an EXCEL format, and the second data is data that can be recognized by the test software of the electronic control unit;
[0121] An updating module is used to update the preset mapping table according to the first data and the second data.
[0122] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0123] Figure 6 This is a schematic diagram of the structure of the terminal device provided in the embodiment of the present application. Figure 6 As shown, the terminal device 5 of this embodiment may include: at least one processor 50 ( Figure 6 Only one processor 50 is shown in the figure), a memory 51, and a computer program 52 stored in the memory 51 and executable on the at least one processor 50. When the processor 50 executes the computer program 52, the steps in any of the above-mentioned method embodiments are implemented, for example Figure 1 Steps S101 to S104 in the illustrated embodiment. Alternatively, when the processor 50 executes the computer program 52, the functions of each module / unit in the above-mentioned device embodiments are implemented, for example Figure 5 The functions of the modules 41 to 44 are shown.
[0124] Exemplarily, the computer program 52 may be divided into one or more modules / units, which are stored in the memory 51 and executed by the processor 50 to implement the present invention. The one or more modules / units may be a series of computer program 52 instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program 52 in the terminal device 5.
[0125] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program 52. When the computer program 52 is executed by the processor 50, the steps in the above-mentioned method embodiments can be implemented.
[0126] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0127] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program 52, and the computer program 52 can be stored in a computer-readable storage medium. When the computer program 52 is executed by the processor 50, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program 52 includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the terminal, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0128] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0129] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0130] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0131] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0132] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A test case generation method, characterized in that: include: Determine the target EXCLE file based on the command parameters; Determine a valid sheet in the target EXCLE file; Parsing all the valid sheets to generate structured data that can be recognized by the test software of the electronic control unit; Generate test cases based on the structured data.
2. The test case generation method according to claim 1, characterized in that: Determining the target EXCLE file according to the command parameters includes: Parsing the command parameters to obtain path information; The target EXCLE file is determined by querying according to the path information.
3. The test case generation method according to claim 1, characterized in that: Determining a valid sheet in the target EXCLE file includes: Searching for a preset identifier in each sheet in the target EXCLE file; When the sheet contains the preset identifier, it is determined that the sheet is a valid sheet.
4. The test case generation method according to any one of claims 1 to 3, characterized in that: The step of parsing all the valid sheets to generate structured data that can be recognized by the test software of the electronic control unit includes: Identify the Chinese symbols in each row of each valid sheet and the data content of the column where each Chinese symbol is located; According to the preset mapping table, the Chinese identifier is converted into an English identifier that can be recognized by the test software of the electronic control unit, and the data content of each row is assigned to the corresponding English identifier to generate a test step according to the column order of the Chinese identifier, and the test steps are sorted according to the row order of the data content to form the structured data.
5. The test case generation method according to claim 4, characterized in that: The Chinese identifier includes a Chinese time identifier, a Chinese input signal identifier, a Chinese expected identifier, and a Chinese test description identifier; the English identifier includes an English time identifier, an English input signal identifier, an English expected identifier, and an English test description identifier; and the data content includes time data, input data, expected data, and test description data; The step of converting the Chinese identifier into an English identifier that can be recognized by the test software of the electronic control unit according to the preset mapping table, and allocating the data content of each row to the corresponding English identifier according to the column order of the Chinese identifier to generate a test step includes: According to the preset mapping table, the Chinese time identifier is converted into an English time identifier that can be recognized by the test software of the electronic control unit, the Chinese input signal identifier is converted into an English input signal identifier that can be recognized by the test software of the electronic control unit, the Chinese expected identifier is converted into an English expected identifier that can be recognized by the test software of the electronic control unit, and the Chinese test description identifier is converted into an English test description identifier that can be recognized by the test software of the electronic control unit; Determine a row of data contents to be allocated from the data contents in each row, allocate the time data in the data contents in the row to the English time identifier according to the column order of the Chinese time identifier, allocate the input data in the data contents in the row to the English input signal identifier according to the column order of the Chinese input signal identifier, allocate the expected data in the data contents in the row to the English expected identifier according to the column order of the Chinese expected identifier, allocate the test description data in the data contents in the row to the English test description identifier according to the column order of the Chinese test description identifier, and after all the data contents in the row are allocated, generate the test steps corresponding to the row.
6. The test case generation method according to claim 4, characterized in that: Generating a test case according to the structured data includes: Accessing the API interface of the test software of the electronic control unit according to the structured data, generating a pkg file for the structured data corresponding to each valid sheet; Aggregate all the pkg files and generate test cases in prj format.
7. The test case generation method according to claim 4, characterized in that: The test case generation method also includes: Acquire first data and second data having a mapping relationship; the first data is data in an EXCEL format, and the second data is data that can be recognized by the test software of the electronic control unit; The preset mapping table is updated according to the first data and the second data.
8. A test case generating device, characterized in that: include: A target EXCLE file determination module is used to determine the target EXCLE file according to command parameters; A valid sheet determination module, used to determine a valid sheet in the target EXCLE file; A parsing module, used to parse all the valid sheets to generate structured data that can be recognized by the test software of the electronic control unit; The test case generation module is used to generate test cases according to the structured data.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.