Test case generation method and device and electronic equipment

By identifying the diagnostic services and target parameters in the vehicle diagnostic parameter list, test case items are automatically generated, and the problems of low efficiency and high labor cost in generating general diagnostic test cases in the prior art are solved, and efficient and accurate test case generation is achieved.

CN120370877APending Publication Date: 2025-07-25GUANGZHOU AUTOMOBILE GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510239990.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

In the prior art, generating general diagnostic test cases is inefficient and labor costs are high, making it difficult to efficiently generate vehicle diagnostic test cases.

Method used

According to the vehicle model and controller version, the diagnostic services in the diagnostic parameter list are automatically identified, and the target parameters are obtained, multiple test case items are generated, and the complete test cases are automatically generated by combining these items.

Benefits of technology

It improves the generation efficiency of test cases, saves labor costs, and improves the generation efficiency and accuracy of test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120370877A_ABST
    Figure CN120370877A_ABST
Patent Text Reader

Abstract

The invention discloses a test case generation method and device and electronic equipment, and the method comprises the steps: obtaining a diagnosis parameter list according to the type of a vehicle and the version of a controller of the vehicle; identifying a diagnosis service included in the diagnosis parameter list; obtaining a target parameter corresponding to the diagnosis service from a diagnosis parameter list, the target parameters comprise a data identifier DID corresponding to the diagnostic service, a routine ID corresponding to the diagnostic service, an IO control parameter corresponding to the diagnostic service, a control mask corresponding to the diagnostic service, a routine control type corresponding to the diagnostic service, a control option corresponding to the diagnostic service, and a session mode supported by the diagnostic service in a factory mode; and at least one of security levels supported by the diagnostic service in a non-factory mode; generating a plurality of test case items according to the target parameters; according to the embodiment of the invention, the plurality of test case items are combined to obtain the test case, so that the test case is automatically generated, and the generation efficiency of the test case is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of vehicles, and more specifically, to a method, an apparatus, and an electronic device for generating test cases. Background Art

[0002] With the rapid development of modern automotive technologies, the functions of vehicles are becoming increasingly diverse. The realization of the functions of each subsystem of a vehicle depends on diagnostic services; whether the diagnostic services are normal and their performance will directly affect the functions and performance of the entire vehicle. Therefore, the testing of general diagnostics is becoming increasingly important for whether the entire vehicle can meet the basic standards of diagnostics and for vehicle fault diagnosis. Based on this, in related technologies, there is a challenge of how to efficiently generate test cases for general diagnostics. Summary of the Invention

[0003] In view of this, embodiments of this application propose a method, an apparatus, and an electronic device for generating test cases to improve the above problems.

[0004] In a first aspect, an embodiment of this application provides a method for generating test cases, the method including: obtaining a list of diagnostic parameters according to the vehicle model of the vehicle and the version of the controllers included in the vehicle; identifying the diagnostic services included in the list of diagnostic parameters; obtaining target parameters corresponding to the diagnostic services from the list of diagnostic parameters, where the target parameters include at least one of a data identifier DID corresponding to the diagnostic service, a routine ID corresponding to the diagnostic service, an IO control parameter corresponding to the diagnostic service, a control mask corresponding to the diagnostic service, a routine control type corresponding to the diagnostic service, a control option corresponding to the diagnostic service, a session mode supported by the diagnostic service in factory mode, and a security level supported by the diagnostic service in non-factory mode; generating a plurality of test case items according to the target parameters; and combining the plurality of test case items to obtain a test case.

[0005] Second aspect, an embodiment of the present application provides a test case generation device, the device includes: a diagnostic parameter list obtaining module, a diagnostic service identification module, a target parameter acquisition module, a test case item generation module, and a test case acquisition module. Among them, the diagnostic parameter list obtaining module is used to obtain a diagnostic parameter list according to the vehicle model and the version of the controller included in the vehicle; the diagnostic service identification module is used to identify the diagnostic services included in the diagnostic parameter list; the target parameter acquisition module is used to obtain the target parameters corresponding to the diagnostic services from the diagnostic parameter list, where the target parameters include at least one of the data identifier DID corresponding to the diagnostic service, the routine ID corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode; the test case item generation module is used to generate a plurality of test case items according to the target parameters; the test case acquisition module is used to combine the plurality of test case items to obtain a test case.

[0006] Third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, the memory is coupled to the processor, and the memory stores instructions, when the instructions are executed by the processor, the processor executes the above method.

[0007] Fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which program code is stored, and the program code can be called by a processor to execute the above method.

[0008] In the solution of the present application, a diagnostic parameter list is obtained according to the vehicle model and the version of the controller included in the vehicle, and the diagnostic services included in the diagnostic parameter list are identified, and the target parameters corresponding to the diagnostic services are obtained from the diagnostic parameter list, where the target parameters include at least one of the data identifier DID corresponding to the diagnostic service, the routine ID corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode, and a plurality of test case items are generated according to the target parameters, and the plurality of test case items are combined to obtain a test case, so as to generate a plurality of test case items according to the parameters included in the diagnostic parameter list corresponding to the vehicle model and the controller, and automatically combine the plurality of test case items to generate a complete test case, thereby improving the generation efficiency of the test case. In addition, it also saves the manpower for writing the test case and reduces the cost of generating the test case for general diagnosis. Brief Description of the Drawings

[0009] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0010] Figure 1 It shows a schematic flowchart of a method for generating test cases provided by an embodiment of the present application;

[0011] Figure 2 It shows a schematic flowchart of a method for generating test cases provided by an embodiment of the present application;

[0012] Figure 3 It shows a schematic flowchart of a method for generating test cases provided by an embodiment of the present application;

[0013] Figure 4 It shows a block diagram of a device for generating test cases provided by an embodiment of the present application;

[0014] Figure 5 It shows a block diagram of an electronic device for executing the method for generating test cases according to the embodiments of the present application;

[0015] Figure 6 It shows a storage unit for storing or carrying program codes for implementing the method for generating test cases according to the embodiments of the present application. Detailed Description of the Embodiments

[0016] To enable those skilled in the art to better understand the solutions of the present application, the following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application.

[0017] To better understand the solutions of the embodiments of the present application, the following first explains the technical terms used in the embodiments of the present application.

[0018] Diagnostic Parameter Tables, DPT, refer to a series of parameters used to evaluate and judge the status of equipment or patients during medical or automotive diagnosis. These parameters can be physical quantities, chemical quantities, or biological indicators, and they can reflect the specific status of the object being diagnosed.

[0019] The Data Identifier, DID, is an important concept in automotive diagnostic communication, mainly used to identify and obtain specific parameter data in the vehicle's ECU (Electronic Control Unit).

[0020] Services 22 (Read Data By Identifier), 2E (Write Data By Identifier), 2F (Input Output Control By Identifier), and 31 (Routine Control) are several different diagnostic services in the UDS (Unified Diagnostic Services) protocol. Each service has its specific functions and application scenarios. Among them, the function of Service 22 is to read the data stored in the ECU through the DID; the function of Service 2E is to write data into the storage area of the ECU through the DID; the function of Service 2F is to control input and output signals; the function of Service 31 is to execute a defined sequence of steps and obtain the relevant results of a specific sequence.

[0021] Support in SecurityState Locked indicates that in the UDS (Unified Diagnostic Services) protocol, when the ECU is in the locked state, it needs to be unlocked through a specific security access service (0x27) in order to access restricted services and data.

[0022] Unlocked Level1$27 01 represents the process in the UDS protocol where the client sends a $27 01 request for a seed, then uses the seed to calculate the key and sends a $27 02 request to unlock the Level1 security level of the ECU.

[0023] Unlocked Level2$27 03 represents a specific sub-function code of the SecurityAccess service in the UDS protocol. According to the UDS protocol, $27 03 is the sub-function code for security access, which means the client has sent a request for a seed (requestSeed) to unlock the Level2 security level of the ECU.

[0024] Unlocked Level3$27 21 represents a specific sub-function code of the SecurityAccess service in the UDS protocol. According to the UDS protocol, $27 21 is the sub-function code for security access, which means the client has sent a request for a seed (requestSeed) to unlock the Level3 security level of the ECU.

[0025] Unlocked Level Flash$27 11 indicates that in the UDS protocol, $27 11 is a specific security access service sub-function code used to unlock the Flash area of the ECU, that is, Level Flash. Through this process, the client can unlock the Flash area of the ECU for programming or modifying the Flash area operations.

[0026] The implementation details of the technical solutions of the embodiments of the present application are elaborated in detail below:

[0027] In the related art, the generation of test cases for general diagnosis focuses on two methods: manual writing and semi-automated writing. Due to the different formats of the diagnostic parameter list versions, the manual writing method is mostly used to generate test cases for general diagnosis according to the diagnostic parameter list; by manually checking the diagnostic parameter list, a table corresponding to DID and default values is maintained. For example, when checking new added or deleted DIDs, permission modifications, default value changes, etc., and then manually adding, deleting, and editing test cases, a huge amount of time will be consumed in checking the diagnostic parameter list and changing the test cases. In the semi-automated writing method, a default value extraction tool is used to extract the default values of each DID in the diagnostic parameter list, but test cases still need to be manually written, and the newly added or deleted DIDs cannot be checked. Therefore, in the related art, there are problems of low efficiency and high labor costs in writing general test cases.

[0028] In view of the above problems, through long-term research, the inventors proposed a test case generation method, device, and electronic device provided by the embodiments of the present application. Multiple test case items are generated according to the parameters included in the diagnostic parameter list corresponding to the vehicle model and the controller, and the multiple test case items are combined to automatically generate complete test cases, thereby improving the generation efficiency of test cases. In addition, it also saves the labor of writing test cases and reduces the cost of generating test cases for general diagnosis. The specific test case generation method is described in detail in the subsequent embodiments.

[0029] Please refer to Figure 1 , Figure 1 which shows a schematic flowchart of the test case generation method provided by an embodiment of the present application. In a specific embodiment, the test case generation method can be applied to a test case generation device 200 as shown in Figure 4 and an electronic device 100 configured with the test case generation device 200 ( Figure 5 ). The following will take the electronic device as an example to illustrate the specific process of this embodiment. Of course, it can be understood that the electronic devices to which this embodiment is applied can include devices such as desktop computers, laptop computers, vehicle terminals, and in-vehicle large screens, which are not limited here. The following will be directed to Figure 1The following steps will elaborate on the process shown. The method for generating the test case may specifically include the following steps:

[0030] Step S110: Obtain a diagnostic parameter list according to the vehicle model and the version of the controller included in the vehicle.

[0031] In some embodiments, the electronic device may obtain a diagnostic parameter list according to the vehicle model and the version of the controller included in the vehicle. Among them, different vehicle models may correspond to different diagnostic parameter lists, and different controller versions may correspond to different diagnostic parameter lists. Among them, after determining the vehicle model and the version of the controller included in the vehicle, the vehicle may obtain the diagnostic parameter list corresponding to the vehicle model and the controller version from the associated cloud or electronic device.

[0032] Among them, the diagnostic parameter list may include one or more diagnostic services (such as diagnostic services like service 22, service 2E, service 2F, service 31, etc.), sub-functions corresponding to each diagnostic service, DIDs corresponding to each diagnostic service, R / W permissions corresponding to each diagnostic service, permissions of each diagnostic service in the factory mode diagnostic session, permissions of each diagnostic service in unlocking the security level in the non-factory mode, default values of DIDs corresponding to each diagnostic service, etc. Exemplarily, the diagnostic parameter list may include service 22, whether the DID corresponding to service 22 has Write permission, and the default values of the DID of service 22 under different vehicle models.

[0033] Exemplarily, please refer to Table 1, which shows a list of diagnostic parameters provided in an embodiment of the present application. Among them, the list of diagnostic parameters may include 22 services; among them, the list of diagnostic parameters may also include the DID content (DID number) corresponding to the 22 services, such as 0x0120 in Table 1; DID description (DID description), such as DTC enable control in Table 1; the write ability (Writeable) of the DID corresponding to the diagnostic service, such as Y in Table 1; the session modes supported by the diagnostic service in the factory mode (Appsupport), such as Default session (Default), Extended session (Exended) in Table 1, and the session modes supported by the diagnostic service in the factory mode (BOOT support), such as Default session (Default), Programming session (Programming), Extended session (Exended) in Table 1; the security level supported by the diagnostic service in the non-factory mode (Support in SecurityState), the length (Length) of the DID corresponding to the diagnostic service, the byte (Byte) of the DID corresponding to the diagnostic service, the bit (bit) of the DID corresponding to the diagnostic service, the sub-information name (sub Data Name(C)) of the DID corresponding to the diagnostic service, the minimum range (Range.Min(Raw.)) of the DID corresponding to the diagnostic service, the maximum range (Range.Max(Raw.)) of the DID corresponding to the diagnostic service, and the default value (Default_T68) of the DID identified by the DID corresponding to the diagnostic service.

[0034] Table 1

[0035]

[0036] Step S120: Identify the diagnostic services included in the list of diagnostic parameters.

[0037] In some embodiments, after the electronic device obtains the list of diagnostic parameters, it can identify the diagnostic services included in the list of diagnostic parameters. Among them, the diagnostic services may include diagnostic services such as 22 services, 2E services, 2F services, and 31 services. Among them, the number of diagnostic services included in the list of diagnostic parameters may be one or more, which is not limited herein. Among them, the electronic device can identify all the diagnostic services included in the list of diagnostic parameters, or can identify a preset number of diagnostic services included in the list of diagnostic parameters.

[0038] Step S130: Obtain the target parameters corresponding to the diagnostic service from the diagnostic parameter list, where the target parameters include at least one of the data identifier DID corresponding to the diagnostic service, the routine ID corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0039] In some embodiments, after the electronic device identifies the diagnostic service included in the diagnostic parameter list, it can obtain the target parameters corresponding to the diagnostic service from the diagnostic parameter list. Among them, the number of the diagnostic services can be multiple, and the electronic device can obtain the parameters corresponding to each diagnostic service from the diagnostic parameter list as the target parameters corresponding to the diagnostic service.

[0040] Among them, the target parameters corresponding to the diagnostic service can include at least one of the DID corresponding to the diagnostic service, the routine ID corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0041] Exemplarily, the diagnostic service is service 22 or service 2E; among them, the target parameters corresponding to the diagnostic service can include the identification content of the DID corresponding to the diagnostic service, the default value and reserved value of each bit corresponding to each byte of the DID in the diagnostic service, whether the diagnostic service has sub-functions, the session mode supported by the diagnostic service in the factory mode, the security level supported by the diagnostic service in the non-factory mode, etc. Among them, the DID sub-processes of different diagnostic services are different.

[0042] Exemplarily, the diagnostic service is service 2F; among them, the target parameters corresponding to the diagnostic service can include the identification content of the DID corresponding to the diagnostic service, whether the diagnostic service has sub-functions, the IO control parameter corresponding to the DID in the diagnostic service, the control mask corresponding to the DID in the diagnostic service, the session mode supported by the diagnostic service in the factory mode, the security level supported by the diagnostic service in the non-factory mode, etc.

[0043] Exemplarily, the diagnostic service is the 31 service; wherein, the target parameters corresponding to the diagnostic service may include the routine ID corresponding to the diagnostic service, whether the diagnostic service has sub-functions, the routine control type corresponding to the routine ID in the diagnostic service, the control options corresponding to the routine ID in the diagnostic service, the session modes supported by the diagnostic service in the factory mode, and the security levels supported by the diagnostic service in the non-factory mode.

[0044] In some embodiments, the test case items may include the associated vehicle model; wherein, the electronic device may determine the associated vehicle model corresponding to the test case according to the vehicle model of the vehicle and the name of the controller included in the vehicle.

[0045] Step S140: Generate a plurality of test case items according to the target parameters.

[0046] In some embodiments, after the electronic device obtains the target parameters corresponding to the diagnostic service, it may generate a plurality of test case items according to the target parameters. Among them, the plurality of test case items may include function sub-modules, test case IDs, test key points, preset conditions, execution steps, expected results, associated vehicle models, etc. Among them, the electronic device may identify the diagnostic service according to the diagnostic parameter list of the corresponding vehicle model and controller; wherein, considering that the parameters corresponding to the diagnostic service not associated with DID in the diagnostic parameter list are the service name and the name of the sub-function, and the parameters do not change greatly. Based on this, this embodiment may generate test cases for diagnostic services associated with DID, such as 22 / 2E services, 2F services, 31 services, etc. Among them, the electronic device may identify the target parameters of the diagnostic service from the diagnostic parameter list according to the identified diagnostic service, such as the default value of DID (corresponding to 22 service / 2E service), IO control parameters and control masks (corresponding to 2F service), routine control type and control options (corresponding to 31 service), session modes supported by the factory mode and security levels supported by the non-factory mode, etc. Optionally, the electronic device may generate test case IDs and test execution steps based on the default value of DID (corresponding to 22 service / 2E service), IO control parameters and control masks (corresponding to 2F service), and routine control type and control options (corresponding to 31 service), and may generate preset conditions for the test cases based on the identified session modes supported by the factory mode and security levels supported by the non-factory mode, and may also generate test key points and expected results for the test cases based on the identified DID content.

[0047] In some embodiments, a plurality of preset use case templates corresponding to the respective test case items may be preset in the electronic device; optionally, after the electronic device obtains the target parameters corresponding to the diagnostic service, it may fill the target parameters into the respective preset use case templates of the plurality of test case items to generate a plurality of test case items.

[0048] As an implementable manner, multiple preset case templates corresponding to respective test case items written by Python tools can be preset in the electronic device. Among them, each preset case template can be of string type. Correspondingly, after the electronic device extracts the target parameters corresponding to the diagnostic service from the diagnostic parameter list, it can convert the target parameters into the string type corresponding to the preset case template, and can match the target parameters with the preset case templates set in advance to obtain multiple test case items, and can store the multiple test case items in string type. Among them, the preset case templates corresponding to the test case items corresponding to different diagnostic services can be the same or different; among them, the electronic device can determine the preset case template corresponding to the test case item according to the corresponding diagnostic service and DID.

[0049] Exemplarily, the preset case template corresponding to the functional sub-module is "(name of the diagnostic service) + read default value", where the content to be filled in the preset case template corresponding to the functional sub-module is the name of the diagnostic service. Based on this, when the electronic device recognizes that the diagnostic service included in the diagnostic parameter list is service 22, it can fill the name of the diagnostic service into the preset case template corresponding to the functional sub-module to obtain the functional sub-module "22 read default value".

[0050] Step S150: Combine the multiple test case items to obtain a test case.

[0051] In some embodiments, after the electronic device obtains multiple test case items corresponding to the diagnostic service, it can combine the multiple test case items to obtain a test case corresponding to the diagnostic service. Among them, a preset order can be set in the electronic device. Correspondingly, after the electronic device obtains multiple test case items, it can arrange the multiple test case items based on the preset order to form a complete test case.

[0052] Exemplarily, please refer to Table 2, which shows a table of test cases provided by an embodiment of the present application. Among them, the test case consists of a functional sub-module, a test case ID, test key points, preset conditions, execution steps, expected results, case level, and design method; among them, multiple test case items can form the test case based on a preset format. Among them, the case level can be preset to P0 and the design method can be equivalent class partitioning in the electronic device; correspondingly, after the electronic device obtains multiple test case items, it can fill the test case items into the table based on the preset format to form a complete test case.

[0053] Table 2

[0054]

[0055] In some embodiments, after obtaining a test case, the electronic device can perform a diagnostic test on the diagnostic service based on the test case, thereby improving the test efficiency and test accuracy of general diagnosis and saving test time.

[0056] It can be understood that in this embodiment, the electronic device can automatically identify the parameters corresponding to the diagnostic service in the diagnostic parameter list according to the diagnostic parameter list corresponding to the vehicle model and controller version, and generate test case items such as function sub-modules, test case IDs, test key points, preset conditions, execution steps, and expected results corresponding to the diagnostic service according to the parameters corresponding to the diagnostic service, and form a complete test case, thereby efficiently and reliably implementing the writing of test cases, saving manpower, enabling users to invest more time in the analysis of test scenarios, shortening the automated test development cycle, achieving the purpose of cost reduction and efficiency improvement, and improving the user experience.

[0057] The test case generation method provided by an embodiment of the present application obtains a diagnostic parameter list according to the vehicle model of the vehicle and the version of the controller included in the vehicle, and identifies the diagnostic services included in the diagnostic parameter list, and obtains the target parameters corresponding to the diagnostic service from the diagnostic parameter list, where the target parameters include at least one of a data identifier DID corresponding to the diagnostic service, a routine ID corresponding to the diagnostic service, an IO control parameter corresponding to the diagnostic service, a control mask corresponding to the diagnostic service, a routine control type corresponding to the diagnostic service, a control option corresponding to the diagnostic service, a session mode supported by the diagnostic service in the factory mode, and a security level supported by the diagnostic service in the non-factory mode, and generates multiple test case items according to the target parameters, and combines the multiple test case items to obtain a test case, so as to generate multiple test case items according to the parameters included in the diagnostic parameter list corresponding to the vehicle model and the controller, and automatically combine the multiple test case items to generate a complete test case, thereby improving the generation efficiency of test cases. In addition, it also saves the manpower for writing test cases and reduces the cost of generating test cases for general diagnosis.

[0058] Please refer to Figure 2 , Figure 2 which shows a schematic flowchart of the test case generation method provided by an embodiment of the present application. This method is applied to the above-mentioned electronic device. The following will elaborate in detail on Figure 2 the process shown. The test case generation method may specifically include the following steps:

[0059] Step S210: Obtain a diagnostic parameter list according to the vehicle model of the vehicle and the version of the controller included in the vehicle.

[0060] Step S220: Identify the diagnostic services included in the diagnostic parameter list.

[0061] Step S230: Obtain the target parameters corresponding to the diagnostic service from the diagnostic parameter list, where the target parameters include at least one of the data identifier DID corresponding to the diagnostic service, the routine ID corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0062] For the specific descriptions of steps S210 - S230, please refer to the descriptions of steps S110 - S130 above, which will not be elaborated here one by one.

[0063] Step S240: Generate the multiple test case items based on the target parameters and the use case templates corresponding to each test case item in the multiple test case items, where the multiple test case items include function sub-modules, test case IDs, test key points, preconditions, execution steps, and expected results.

[0064] In some embodiments, a test case can be composed of multiple test case items, where the multiple test case items can include function sub-modules, test case IDs, test key points, preconditions, execution steps, and expected results, etc. Among them, use case templates corresponding to each test case item can be preset in the electronic device. Correspondingly, after the electronic device obtains the target parameters corresponding to the diagnostic service, it can generate multiple test case items based on the target parameters and the use case templates corresponding to each test case item in the multiple test case items.

[0065] As an implementable manner, the electronic device can generate function sub-modules based on the diagnostic service and preset sub-functions. The preset sub-functions can be preset in the electronic device, can be set by the user independently, or can be obtained through third-party experimental data. Exemplarily, the preset sub-functions can include reading the DID default value, reading the content of the routine ID, etc. Use case templates corresponding to the preset sub-functions can be preset in the electronic device. Optionally, the electronic device can splice the name corresponding to the diagnostic service and the use case template corresponding to the preset sub-function to obtain the function sub-module.

[0066] In some embodiments, the electronic device can generate a test case ID and execution steps based on the target identifier corresponding to the diagnostic service. The target identifier corresponding to the diagnostic service can be the DID corresponding to the diagnostic service or the routine ID corresponding to the diagnostic service.

[0067] Exemplarily, please refer to Figure 3, which shows a schematic flowchart of a method for generating a test case provided by an embodiment of the present application. Among them, the electronic device can obtain a diagnostic parameter list according to the vehicle model and the version of the controller included in the vehicle. Among them, the electronic device can identify the diagnostic services in the diagnostic parameter list and can identify the target parameters corresponding to different diagnostic services from the diagnostic parameter list. For example, it can identify the DID or routine ID corresponding to different diagnostic services from the diagnostic parameter list, and can also identify the diagnostic session permission and security level permission corresponding to the DID or routine ID from the diagnostic parameter list according to the DID or routine ID corresponding to different diagnostic services. It can also identify the default value, parameter type, control mask, and option corresponding to the DID or routine ID. After the electronic device obtains the target parameters, it can fill the test case items (such as functional sub-module, test case ID, test key points, preconditions, execution steps, expected results, etc.) in a fixed format based on the identified target parameters, and can form a complete test case based on the test case items. Among them, in the case where the diagnostic service is not associated with the DID and the use case ID, the electronic device can generate a functional sub-module based on the name of the diagnostic service and generate a test case to test the diagnostic service.

[0068] As an implementable manner, please refer to Figure 3 , if the diagnostic services identified by the electronic device from the diagnostic parameter list are service 22, service 2E, or service 2F, it can generate the test case ID and execution steps corresponding to the test case based on the DID corresponding to the diagnostic service.

[0069] Optionally, a first use case template corresponding to the use case ID of the diagnostic service associated with the DID and a second use case template corresponding to the execution steps can be preset in the electronic device; correspondingly, the electronic device can splice the DID corresponding to the diagnostic service with the first use case template to obtain the test case ID, and can splice the DID corresponding to the diagnostic service with the second use case template to obtain the execution steps corresponding to the test case.

[0070] As another implementable manner, please refer to Figure 3 again. If the diagnostic service identified by the electronic device from the diagnostic parameter list is service 31, it can generate the test case ID and execution steps corresponding to the test case based on the routine ID corresponding to the diagnostic service.

[0071] Optionally, a third use case template corresponding to the use case ID of the diagnostic service associated with the routine ID and a fourth use case template corresponding to the execution steps can be preset in the electronic device; correspondingly, the electronic device can splice the routine ID corresponding to the diagnostic service with the third use case template to obtain the test case ID, and can splice the routine ID corresponding to the diagnostic service with the fourth use case template to obtain the execution steps.

[0072] In some embodiments, the electronic device may generate a preset condition based on the target identifier corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0073] Among them, a use case template corresponding to the preset condition may be pre-set in the electronic device. Correspondingly, after the electronic device obtains the target identifier corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode, the electronic device may splice the target identifier corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the use case template corresponding to the preset condition to obtain the preset condition corresponding to the diagnostic service.

[0074] As an implementable manner, please refer to again Figure 3 , if the diagnostic service identified by the electronic device from the diagnostic parameter list is service 22, service 2E, or service 2F, and the diagnostic service has sub-functions, a preset condition may be generated based on the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0075] Optionally, a fifth use case template corresponding to the preset condition of the diagnostic service associated with the DID may be pre-set in the electronic device; correspondingly, the electronic device may splice the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the fifth use case template to obtain the preset condition.

[0076] As another implementable manner, please refer to again Figure 3 , if the diagnostic service identified by the electronic device from the diagnostic parameter list is service 31, and the diagnostic service has sub-functions, a preset condition may be generated based on the routine ID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0077] Optionally, a sixth use case template corresponding to the preset condition of the diagnostic service associated with the routine ID may be pre-set in the electronic device; correspondingly, the electronic device may splice the routine ID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the sixth use case template to obtain the preset condition.

[0078] In some embodiments, the electronic device may generate test points and expected results based on at least one of the target identifier corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0079] As an implementable way, please refer to again Figure 3 , if the diagnostic service identified by the electronic device from the diagnostic parameter list is service 22 or service 2E, and the diagnostic service has sub-functions, then the test points and expected results can be generated based on the identification content of the DID corresponding to the diagnostic service, the default value of the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0080] Optionally, the electronic device may be pre-set with a seventh use case template corresponding to the test points and an eighth use case template corresponding to the expected results for service 22 or service 2E; correspondingly, the electronic device may splice the identification content of the DID corresponding to the diagnostic service, the default value of the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the seventh use case template to obtain the test points, and may splice the identification content of the DID corresponding to the diagnostic service, the default value of the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the eighth use case template to obtain the expected results.

[0081] As another implementable way, please refer to again Figure 3 , if the diagnostic service identified by the electronic device from the diagnostic parameter list is service 2F, and the diagnostic service has sub-functions, then the test points and expected results can be generated based on the DID corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0082] Optionally, a ninth use case template corresponding to the test points of the 2F service and a tenth use case template corresponding to the expected results may be preset in the electronic device; correspondingly, the electronic device may splice the DID corresponding to the diagnostic service, the IO control parameters corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the ninth use case template to obtain the test points, and may splice the DID corresponding to the diagnostic service, the IO control parameters corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the tenth use case template to obtain the expected results.

[0083] As another implementable manner, please refer to Figure 3 again. If the diagnostic service identified by the electronic device from the diagnostic parameter list is the 31 service and this diagnostic service has sub-functions, test points and expected results may be generated based on the routine ID corresponding to this diagnostic service, the routine control type corresponding to this diagnostic service, the control options corresponding to this diagnostic service, the session mode supported by this diagnostic service in the factory mode, and the security level supported by this diagnostic service in the non-factory mode.

[0084] Optionally, an eleventh use case template corresponding to the test points of the 31 service and a twelfth use case template corresponding to the expected results may be preset in the electronic device; correspondingly, the electronic device may splice the routine ID corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control options corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the eleventh use case template to obtain the test points, and may splice the routine ID corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control options corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode with the twelfth use case template to obtain the expected results.

[0085] Step S250: Arrange the multiple test case items in a preset order to obtain the test case.

[0086] In some embodiments, a preset order may be preset in the electronic device; among them, after the electronic device obtains multiple test case items, it may arrange the multiple test case items in the preset order to obtain the test case. Exemplarily, the electronic device may combine and arrange the generated functional sub-module, test case ID, test points, preset conditions, execution steps, and expected results in the preset order to generate the test case.

[0087] Exemplarily, please refer to Table 1 and Table 2. Table 1 shows the target parameters corresponding to 22 services obtained by the electronic device from the diagnostic parameter list, and Table 2 shows the test cases generated by the electronic device based on the target parameters. Among them, the electronic device can splice the name of the diagnostic service with the use case template corresponding to the preset functional sub-module ("(name of the diagnostic service)+read default value") to obtain the functional sub-module "22 read default value".

[0088] Among them, if the electronic device identifies that the first DID of the 22 service in the diagnostic parameter list is 0120, the use case template corresponding to the use case ID is "(TC_ZCUF_mDiag_22)" + "(identified DID)" + "_s0001"; based on this, the electronic device can convert the identified DID (0120) into a string type and splice it with the use case template corresponding to the use case ID to generate the corresponding use case ID "TC_ZCUF_mDiag_220120s0001".

[0089] Among them, after the electronic device identifies the diagnostic session where DID 0120 is located (in the default session), it can splice the identified session mode with the use case template corresponding to the test key point ("(identified session mode)" + "check default value DID" + "(identified DID)") to obtain the test key point "check default value DID0120 in the default session".

[0090] Among them, the electronic device can also splice the controller name (ZCUF) and the diagnostic session where it is located (in the default session) with the use case template corresponding to the precondition ("(input controller)" + "(identified session mode)") to obtain the precondition "ZCUF in the default session".

[0091] Among them, the electronic device can also splice the diagnostic request ID of the controller (diagnostic send 770:), the name of the diagnostic service, and the identified DID (0120) with the use case template corresponding to the execution step ("(diagnostic request ID of the controller)" + "(name of the diagnostic service)" + "(identified DID)") to obtain the execution step "diagnostic send 770: 220120".

[0092] Among them, a use case template corresponding to the expected result of the 22 service can be preset in the electronic device ("Diagnostic positive response, and the default value is correct, the default value is:" + "(DID default value extracted from the diagnostic parameter list)"); among them, after the electronic device obtains the default value of DID (7F 00 FF 00 EA EE 0E 0A AA A0 BE 64 00 00 03 00 00 00 FF 02 00 FF EF FB BE 0F D8 F7 E1 FB BE) from Table 1, it can splice the default value of DID with the use case template corresponding to the expected result to obtain the expected result "Diagnostic positive response, and the default value is correct, the default value is: 7F 00 FF 00 EA EE 0E 0A AA A0 BE 64 00 00 03 00 00 00 FF 02 00 FF EF FB BE 0F D8 F7 E1 FB BE".

[0093] Among them, after the electronic device obtains test case items: functional sub-module, test case ID, test key points, preset conditions, execution steps, and expected results, it can arrange all the test case items in a preset order to generate a test case. Optionally, the electronic device can traverse the diagnostic parameter list to identify all diagnostic services in the diagnostic parameter list, and generate test case items corresponding to each diagnostic service according to the target parameters corresponding to each diagnostic service. Thus, through the diagnostic parameter list of the corresponding vehicle model and controller version, without manual intervention, it can automatically identify the diagnostic services in the diagnostic parameter list, extract the target parameters corresponding to the diagnostic services, generate test case items in a fixed format according to the extracted target parameters of the diagnostic services, reduce the maintenance cost of writing test cases, and can form a complete test case according to the test case items, reduce the risk of missed testing, improve the efficiency of generating test cases, improve the credibility of test cases, and also reduce the cost of generating test cases.

[0094] The test case generation method provided by an embodiment of the present application, compared with Figure 1 the shown test case generation method, the test case items in this embodiment can include functional sub-module, test case ID, test key points, preset conditions, execution steps, and expected results. This embodiment can also generate multiple test case items based on the target parameters and the use case template corresponding to each test case item in multiple test case items, so as to generate test case items in a fixed format and reduce the maintenance cost. This embodiment can also arrange multiple test case items in a preset order to obtain a test case, thus eliminating the need for manual verification of the diagnostic parameter list, reducing the risk of missed testing, improving the efficiency of generating test cases, improving the reliability of test cases, and also reducing the cost of generating test cases.

[0095] Please refer toFigure 4 , Figure 4 shows a block diagram of a test case generation device provided in an embodiment of the present application. The test case generation device 200 is applied to the above-mentioned electronic device, and the following will elaborate in detail on Figure 4 the process shown. The test case generation device 200 includes: a diagnostic parameter list acquisition module 210, a diagnostic service identification module 220, a target parameter acquisition module 230, a test case item generation module 240, and a test case acquisition module 250, where:

[0096] The diagnostic parameter list acquisition module 210 is configured to obtain a diagnostic parameter list according to the vehicle model and the version of the controller included in the vehicle.

[0097] The diagnostic service identification module 220 is configured to identify the diagnostic services included in the diagnostic parameter list.

[0098] The target parameter acquisition module 230 is configured to obtain target parameters corresponding to the diagnostic service from the diagnostic parameter list, where the target parameters include at least one of a data identifier DID corresponding to the diagnostic service, a routine ID corresponding to the diagnostic service, an IO control parameter corresponding to the diagnostic service, a control mask corresponding to the diagnostic service, a routine control type corresponding to the diagnostic service, a control option corresponding to the diagnostic service, a session mode supported by the diagnostic service in the factory mode, and a security level supported by the diagnostic service in the non-factory mode;

[0099] The test case item generation module 240 is configured to generate a plurality of test case items according to the target parameters.

[0100] The test case acquisition module 250 is configured to combine the plurality of test case items to obtain a test case.

[0101] Further, the plurality of test case items include a functional sub-module, a test case ID, test key points, preconditions, execution steps, and expected results. The test case item generation module 240 may include: a functional sub-module generation unit, a test case ID and execution step generation unit, a precondition generation unit, and a test key point and expected result generation unit, where:

[0102] The functional sub-module generation unit is configured to generate the functional sub-module based on the diagnostic service and a preset sub-function.

[0103] The test case ID and execution step generation unit is configured to generate the test case ID and the execution steps based on a target identifier corresponding to the diagnostic service, where the target identifier is the DID or the routine ID.

[0104] A preset condition generation unit, configured to generate the preset condition based on the target identifier corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0105] A test point and expected result generation unit, configured to generate the test points and the expected results based on at least one of the target identifier corresponding to the diagnostic service, the IO control parameters corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control options corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0106] Further, the test case ID and execution step generation unit may include: a first test case ID and execution step generation unit and a second test case ID and execution step generation unit, where:

[0107] The first test case ID and execution step generation unit is configured to, if the diagnostic service is service 22, service 2E, or service 2F, generate the test case ID and the execution steps based on the DID corresponding to the diagnostic service.

[0108] The second test case ID and execution step generation unit is configured to, if the diagnostic service is service 31, generate the test case ID and the execution steps based on the routine ID corresponding to the diagnostic service.

[0109] Further, the preset condition generation unit may include: a first preset condition generation unit and a second preset condition generation unit, where:

[0110] The first preset condition generation unit is configured to, if the diagnostic service is service 22, service 2E, or service 2F, and the diagnostic service has sub-functions, generate the preset condition based on the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0111] The second preset condition generation unit is configured to, if the diagnostic service is service 31, and the diagnostic service has sub-functions, generate the preset condition based on the routine ID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0112] Further, the test key points and expected result generation unit may include: a first test key points and expected result generation unit, a second test key points and expected result generation unit, and a third test key points and expected result generation unit, where:

[0113] The first test key points and expected result generation unit is configured to, if the diagnostic service is service 22 or service 2E and the diagnostic service has sub-functions, generate the test key points and the expected results based on the identification content of the DID corresponding to the diagnostic service, the default value of the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0114] The second test key points and expected result generation unit is configured to, if the diagnostic service is service 2F and the diagnostic service has sub-functions, generate the test key points and the expected results based on the DID corresponding to the diagnostic service, the IO control parameters corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0115] The third test key points and expected result generation unit is configured to, if the diagnostic service is service 31 and the diagnostic service has sub-functions, generate the test key points and the expected results based on the routine ID corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control options corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

[0116] Further, the test case item generation module 240 may include: a test case item generation subunit, where:

[0117] The test case item generation subunit is configured to generate the multiple test case items based on the target parameters and the use case templates corresponding to each test case item in the multiple test case items.

[0118] Further, the test case acquisition module 250 may include: a test case acquisition subunit, where:

[0119] The test case acquisition subunit is configured to obtain the test case by arranging the multiple test case items in a preset order.

[0120] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

[0121] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical, or other forms of coupling.

[0122] In addition, in each embodiment of the present application, each functional module may be integrated in a processing module, may exist separately physically for each module, or two or more modules may be integrated in one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0123] Please refer to Figure 5 , which shows a structural block diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may be an electronic device with processing capabilities such as a vehicle, a tablet computer, a robot, etc. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs, where one or more application programs may be stored in the memory 120 and configured to be executed by one or more processors 110, and one or more programs are configured to execute the methods described in the foregoing method embodiments.

[0124] Among them, the processor 110 may include one or more processing cores. The processor 110 connects various parts within the entire electronic device 100 using various interfaces and lines, and by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and by calling data stored in the memory 120, it executes various functions of the electronic device 100 and processes data. Optionally, the processor 110 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 110 may integrate one or several combinations of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, and application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed; the modem is used to process wireless communication. It can be understood that the above modem may not be integrated into the processor 110 and may be implemented separately through a communication chip.

[0125] The memory 120 may include a Random Access Memory (RAM), or may also include a Read-Only Memory. The memory 120 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data created during the use of the electronic device 100 (such as a phone book, audio and video data, chat record data, etc.).

[0126] Please refer to Figure 6 , which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. Program code is stored in the computer-readable medium 300, and the program code can be called by a processor to execute the method described in the above method embodiments.

[0127] The computer-readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 300 has a storage space for the program code 310 for executing any method step in the above method. These program codes can be read out from or written into one or more computer program products. The program code 310 may be compressed in an appropriate form, for example.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present application.

Claims

1. A method for generating test cases, characterized in that The method includes: Obtaining a diagnostic parameter list according to the vehicle model and the version of the controller included in the vehicle; Identifying the diagnostic services included in the diagnostic parameter list; Obtaining target parameters corresponding to the diagnostic services from the diagnostic parameter list, where the target parameters include at least one of a data identifier DID corresponding to the diagnostic service, a routine ID corresponding to the diagnostic service, an IO control parameter corresponding to the diagnostic service, a control mask corresponding to the diagnostic service, a routine control type corresponding to the diagnostic service, a control option corresponding to the diagnostic service, a session mode supported by the diagnostic service in the factory mode, and a security level supported by the diagnostic service in the non-factory mode; Generating a plurality of test case items according to the target parameters; Combining the plurality of test case items to obtain a test case.

2. The method according to claim 1, characterized in that The plurality of test case items include a functional sub-module, a test case ID, test key points, preconditions, execution steps, and expected results. The generating of the plurality of test case items according to the target parameters includes: Generating the functional sub-module based on the diagnostic service and a preset sub-function; Generating the test case ID and the execution steps based on the target identifier corresponding to the diagnostic service, where the target identifier is the DID or the routine ID; Generating the preconditions based on the target identifier corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode; Generating the test key points and the expected results based on at least one of the target identifier corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode.

3. The method according to claim 2, characterized in that, The generating of the test case ID and the execution steps based on the target identifier corresponding to the diagnostic service includes: If the diagnostic service is service 22, service 2E, or service 2F, generating the test case ID and the execution steps based on the DID corresponding to the diagnostic service; If the diagnostic service is service 31, generating the test case ID and the execution steps based on the routine ID corresponding to the diagnostic service.

4. The method according to claim 2, wherein The generating of the preconditions based on the target identifier corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode includes: If the diagnostic service is service 22, service 2E, or service 2F, and the diagnostic service has a sub-function, generating the preconditions based on the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non-factory mode; If the diagnostic service is a 31 service and the diagnostic service has sub - functions, generate the preset conditions based on the routine ID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non - factory mode.

5. The method according to claim 2, wherein Generating the test points and the expected results based on at least one of the target identifier corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non - factory mode, includes: If the diagnostic service is a 22 service or a 2E service and the diagnostic service has sub - functions, generate the test points and the expected results based on the identification content of the DID corresponding to the diagnostic service, the default value of the DID corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non - factory mode; If the diagnostic service is a 2F service and the diagnostic service has sub - functions, generate the test points and the expected results based on the DID corresponding to the diagnostic service, the IO control parameter corresponding to the diagnostic service, the control mask corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non - factory mode; If the diagnostic service is a 31 service and the diagnostic service has sub - functions, generate the test points and the expected results based on the routine ID corresponding to the diagnostic service, the routine control type corresponding to the diagnostic service, the control option corresponding to the diagnostic service, the session mode supported by the diagnostic service in the factory mode, and the security level supported by the diagnostic service in the non - factory mode.

6. The method according to any one of claims 1-5, characterized in that, Generating a plurality of test case items according to the target parameters, includes: Generating the plurality of test case items based on the target parameters and the use - case template corresponding to each test case item in the plurality of test case items.

7. The method according to any one of claims 1-5, characterized in that, Combining the plurality of test case items to obtain a test case, includes: Arranging the plurality of test case items in a preset order to obtain the test case.

8. A test case generation device, characterized in that, The device includes: A diagnostic parameter list acquisition module, configured to acquire a diagnostic parameter list according to the vehicle model and the version of the controller included in the vehicle; A diagnostic service identification module, configured to identify the diagnostic services included in the diagnostic parameter list; A target parameter acquisition module, configured to acquire target parameters corresponding to the diagnostic service from the diagnostic parameter list, where the target parameters include at least one of a data identifier DID corresponding to the diagnostic service, a routine ID corresponding to the diagnostic service, an IO control parameter corresponding to the diagnostic service, a control mask corresponding to the diagnostic service, a routine control type corresponding to the diagnostic service, a control option corresponding to the diagnostic service, a session mode supported by the diagnostic service in the factory mode, and a security level supported by the diagnostic service in the non-factory mode; A test case item generation module, configured to generate a plurality of test case items according to the target parameters; A test case acquisition module, configured to combine the plurality of test case items to obtain a test case.

9. An electronic device, characterized in that, Comprising: One or more processors; A memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, Program code is stored in the computer-readable storage medium, and the program code can be called by a processor to execute the method according to any one of claims 1-7.