Test case generation method and device, vehicle-mounted equipment and vehicle
By obtaining test requirements information and combining preset test objects and behavior modules to generate test cases, the problem of poor repetitive workload and applicability in the prior art is solved, and the efficiency and flexibility of test case generation is improved.
Patent Information
- Application Number
- CN202411129835.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-11-12
AI Technical Summary
The existing automotive domain controller functional testing methods have the problem of repeated workload and difficulty in applying different models or controllers. Testers need to rewrite the functions or test operation steps of other domain controllers, and the test case generation method is highly oriented towards single control. It is difficult to reuse the device.
By obtaining test requirements information, determining the target test object and target behavior, calling the target test object module and target behavior module in the preset development platform to combine it, generating test cases, making full use of the modules that have been written by other testers, and reducing repetition Work and improve the flexibility of test cases.
Reduces repetitive work in the test case generation process, improves the efficiency and flexibility of generating test cases, and makes it possible to apply to different test models or test controllers for test cases.
Smart Images

Figure CN118939556A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a test case generation method, device, vehicle-mounted equipment and vehicle. Background Art
[0002] The functional test of the automotive domain controller is a key link to ensure the efficient and safe operation of the automotive system. The main purpose of the functional test of the automotive domain controller is to verify whether the various functions of the domain controller are normally executed according to the design requirements, and to ensure that its performance, safety and reliability meet the requirements of vehicle operation.
[0003] At present, the automobile controller testing method is to send relevant control signals to the controller according to the control logic design, and then check the controller output signal. Usually, the project team needs to divide the testers into multiple groups, each group is responsible for testing one or more functions of the controller. The test cases produced by this testing method are mainly based on the process of realizing the test controller function, and each test step is based on the controller as the object to arrange the behavior sequence of the controller.
[0004] The disadvantages of this testing method are as follows: (1) Testers are only familiar with the functions they are responsible for testing. When the test logic crosses functions or controllers, testers will rewrite the functions or test operation steps of other domain controllers because they do not understand the functions of other domain controllers. However, in the actual testing process, the functions or test operation steps of these other domain controllers have already been written by other testers. Therefore, testers from different project teams have a lot of repetitive work. (2) Due to the diversity of automobile models, the diversity of controllers, and the high variability of controller functions, the current method of generating test cases is highly oriented towards a single controller and is difficult to be repeatedly applied to different models or controllers.
[0005] Therefore, the current test case generation method needs to be improved. Summary of the invention
[0006] In view of the above-mentioned shortcomings of the prior art, the present application provides a test case generation method, device, vehicle-mounted equipment and vehicle to solve the above-mentioned technical problems.
[0007] The present application provides a test case generation method, the method comprising: obtaining test requirement information issued by a tester; determining a target test object and a target behavior from the test requirement information; the target test object comprises a test object for generating a test case corresponding to the test requirement information; the target behavior comprises a behavior for generating a test case corresponding to the test requirement information; calling a target test object module and a target behavior module in a preset development platform, and combining the target test object module and the target behavior module, the target test object module being pre-generated based on the information of the target test object; the target behavior module being pre-generated based on the information of the target behavior; and generating a test case based on the combination result.
[0008] In one embodiment of the present application, if the test requirement information includes the association relationship between the target test object and the target behavior, the process of combining the target test object module and the target behavior module includes: grouping the target behavior modules according to the association relationship between the target test object and the target behavior to obtain a set of target behavior modules corresponding to different target test object modules; combining different target test object modules and target behavior module sets corresponding to different target test object modules to obtain a target test function module, and establishing an association relationship between the target test function module and different target test object modules; constructing a function and object relationship diagram based on the target test function module, different target test object modules, and the association relationship between the target test function module and different target test object modules, and using the function and object relationship diagram as the combination result.
[0009] In one embodiment of the present application, if the information of the target test object includes an object name, an object function description, an object identifier and an object behavior, then the process of pre-generating a target test object module based on the information of the target test object includes: storing the object name, the object function description, the object identifier and the object behavior to obtain the storage information of the target test object; and encapsulating the storage information of the target test object to obtain the target test object module.
[0010] In one embodiment of the present application, if the information of the target behavior includes a behavior name, a behavior function description, a behavior implementation condition, a behavior implementation operation description, and a behavior implementation response description, then the process of pre-generating a target behavior module based on the information of the target behavior includes: storing the behavior name, the behavior function description, the behavior implementation condition, the behavior implementation operation description, and the behavior implementation response description to obtain the storage information of the target behavior; and encapsulating the storage information of the target behavior to obtain the target behavior module.
[0011] In one embodiment of the present application, if the information of the target behavior also includes condition parameters, implementation parameters, and response parameters, then before pre-generating a target behavior module based on the information of the target behavior, the method also includes: defining the condition parameters based on the behavior implementation conditions; defining the implementation parameters based on the behavior implementation operation description; and defining the response parameters based on the behavior implementation response description; establishing an association relationship between the condition parameters and the behavior implementation conditions; establishing an association relationship between the implementation parameters and the behavior implementation operation description; and establishing an association relationship between the response parameters and the behavior implementation response description.
[0012] In one embodiment of the present application, after generating a test case, the method includes: recording parameter data of the target test object before being tested, executing the test case, recording parameter data of the target test object during the test, and after executing the test case, recording parameter data after the target test object is tested; comparing the parameter data before the target test object is tested with the conditional parameters, comparing the parameter data of the target test object during the test with the implementation parameters, and comparing the parameter data after the target test object is tested with the response parameters, and determining the test result of the target test object based on the comparison result.
[0013] In one embodiment of the present application, after obtaining the target test object module and the target behavior module, the method includes: displaying the information of the target test object module and the information of the target behavior module; or, modifying the information of the target test object module and the information of the target behavior module.
[0014] According to one aspect of an embodiment of the present application, a test case generating device is provided, the device comprising: an information acquisition module, used to acquire test requirement information issued by a tester; an object determination module, used to determine a target test object and a target behavior from the test requirement information; the target test object comprises a test object for generating a test case corresponding to the test requirement information; the target behavior comprises a behavior for generating a test case corresponding to the test requirement information; a module combination module, used to call a target test object module and a target behavior module in a preset development platform, and combine the target test object module and the target behavior module, the target test object module being pre-generated based on the information of the target test object; the target behavior module being pre-generated based on the information of the target behavior; and a case generating module, used to generate a test case based on the combination result.
[0015] According to one aspect of an embodiment of the present application, a vehicle-mounted device is provided, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the vehicle-mounted device implements the test case generation method described above.
[0016] According to one aspect of an embodiment of the present application, a vehicle is provided, the vehicle comprising the test case generating apparatus as described above or the vehicle-mounted device as described above.
[0017] The beneficial effects of the present application are as follows: the present application obtains the test requirement information issued by the tester, determines the target test object and the target behavior from the test requirement information, calls the target test object module and the target behavior module in the preset development platform, and combines the target test object module and the target behavior module, and generates test cases based on the combination results. The above process, by calling the target test object module and the target behavior module in the preset development platform, can make full use of the target test object module and the target behavior module that have been written by other testers, reduce repetitive work in the process of generating test cases, and improve the efficiency of generating test cases; by combining the target test object module and the target behavior module, and generating test cases that can be applicable to different test vehicle models or test controllers, the flexibility of test case generation is improved.
[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0020] Figure 1 is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application;
[0021] Figure 2 is a flow chart of a test case generation method shown in an exemplary embodiment of the present application;
[0022] Figure 3 is a schematic diagram of a target test object shown in an exemplary embodiment of the present application;
[0023] Figure 4 is a schematic diagram of a target behavior symbol shown in an exemplary embodiment of the present application;
[0024] Figure 5 is a schematic diagram of a target test function shown in an exemplary embodiment of the present application;
[0025] Figure 6 is a schematic diagram showing the relationship between functions and objects in an exemplary embodiment of the present application;
[0026] Figure 7 is a schematic diagram of storing target test object information shown in an exemplary embodiment of the present application;
[0027] Figure 8 is a schematic diagram showing another exemplary embodiment of the present application for storing target test object information;
[0028] Fig. 9 is a schematic diagram of storing target test function information shown in an exemplary embodiment of the present application;
[0029] Fig.10 is a schematic diagram of a test case shown in an exemplary embodiment of the present application;
[0030] Fig.11 is a block diagram of a test case generating device shown in an exemplary embodiment of the present application;
[0031] Fig.12 A schematic diagram of the structure of a computer system of a vehicle-mounted device suitable for implementing an embodiment of the present application is shown. DETAILED DESCRIPTION
[0032] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.
[0033] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0034] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0035] Figure 1 It is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application.
[0036] Reference Figure 1 As shown, the system architecture may include a monitoring device 101 and an on-board controller 102. The on-board controller 102 may be at least one of a desktop graphics processing unit (GPU) computer, a GPU computing cluster, a neural network computer, etc. Relevant technical personnel may use the on-board controller 102 to obtain the test requirement information issued by the tester, determine the target test object and target behavior from the test requirement information, call the target test object module and the target behavior module in the preset development platform, and combine the target test object module and the target behavior module, and generate a test case based on the combination result. The monitoring device 101 is used to monitor the test requirement information issued by the tester, and after monitoring the test requirement information issued by the tester, provide it to the on-board controller 102 for processing.
[0037] Illustratively, after obtaining the test requirement information issued by the tester in the monitoring device 101, the on-board controller 102 determines the target test object and target behavior from the test requirement information, calls the target test object module and target behavior module in the preset development platform, and combines the target test object module and the target behavior module, and generates a test case based on the combination result. The above process, by calling the target test object module and the target behavior module in the preset development platform, can make full use of the target test object module and the target behavior module that have been written by other testers, reduce repetitive work in the process of generating test cases, and improve the efficiency of generating test cases; by combining the target test object module and the target behavior module, and generating test cases that can be applicable to different test vehicle models or test controllers, the flexibility of test case generation is improved.
[0038] It should be noted that the test case generation method provided in the embodiment of the present application is generally executed by the vehicle-mounted controller 102 , and accordingly, the test case generation device is generally arranged in the vehicle-mounted controller 102 .
[0039] The implementation details of the technical solution of the embodiment of the present application are described in detail below:
[0040] Figure 2 is a flowchart of a test case generation method shown in an exemplary embodiment of the present application. The test case generation method can be executed by a computing processing device. The computing processing device can be Figure 1 The vehicle controller 102 shown in FIG. Figure 2 As shown, the test case generation method includes at least steps S210 to S240, which are described in detail as follows:
[0041] In step S210, the test requirement information issued by the tester is obtained.
[0042] In one embodiment of the present application, the test requirement information includes the vehicle domain controller to be tested, the test operation performed on the vehicle domain controller, etc. The vehicle domain controller to be tested is taken as the target test object, and the test operation performed on the vehicle domain controller is taken as the target behavior.
[0043] In step S220, a target test object and a target behavior are determined from the test requirement information.
[0044] In this embodiment, the target test object includes a test object corresponding to the test requirement information and used to generate a test case; the target behavior includes a behavior corresponding to the test requirement information and used to generate a test case.
[0045] In this embodiment, the process of determining the target test object and target behavior from the test requirement information can be achieved by extracting the content in the vehicle model field in the test requirement information to obtain the target vehicle model, by extracting the content in the object field in the test requirement information to obtain the target test object, and by extracting the content in the behavior field in the test requirement information to obtain the target behavior, etc.
[0046] In step S230, the target test object module and the target behavior module in the preset development platform are called, and the target test object module and the target behavior module are combined.
[0047] In this embodiment, the target test object module is pre-generated based on the information of the target test object; the target behavior module is pre-generated based on the information of the target behavior.
[0048] In this embodiment, by calling the target test object module and target behavior module in the preset development platform and combining the target test object module and the target behavior module, it is possible to fully utilize the target test object module and target behavior module that have been written by other testers, reduce repetitive work in the process of generating test cases, and improve the efficiency of generating test cases.
[0049] In step S240, a test case is generated based on the combination result.
[0050] In this embodiment, the process of generating a test case based on the combination result includes: converting the combination result into a text in a preset language format, and generating a test case based on the text in the preset language format.
[0051] In this embodiment, the preset language format text includes (Communication Access Programming Language, CAPL), Python language, etc., which are not specifically limited here.
[0052] In this embodiment, the target test object module and the target behavior module are combined to generate test cases that can be applicable to different test vehicle models or test controllers, thereby improving the flexibility of test case generation.
[0053] In one embodiment of the present application, if the test requirement information includes an association relationship between a target test object and a target behavior, the process of combining the target test object module and the target behavior module includes:
[0054] According to the association relationship between the target test object and the target behavior, the target behavior modules are grouped to obtain a set of target behavior modules corresponding to different target test object modules.
[0055] In this embodiment, the association relationship between the target test object and the target behavior is pre-established by the tester, and the association relationship between the target test object and the target behavior is determined from the ownership relationship between the target behavior and the target test object. For example, when the implementation object of a certain target behavior is the target test object, the target behavior has an ownership relationship with the target test object.
[0056] In this embodiment, the process of grouping target behavior modules according to the association relationship between the target test object and the target behavior includes: selecting one of the target test objects, grouping the target behaviors belonging to the target test object into a group, and obtaining a target behavior set corresponding to the target test object, that is, obtaining a target behavior module set corresponding to the target test object module; continuing to select other target test objects, grouping the target behaviors belonging to other target test objects into a group, and obtaining a target behavior module set corresponding to other target test object modules, until a target behavior module set corresponding to each target test object module is obtained.
[0057] In this embodiment, the target behaviors in the target behavior module set are sorted according to the order in which the behaviors are executed. For example, the first target behavior executed is sorted first, the second target behavior executed is sorted second, and so on.
[0058] Different target test object modules and target behavior module sets corresponding to the different target test object modules are combined to obtain target test function modules, and association relationships between the target test function modules and the different target test object modules are established.
[0059] In this embodiment, the process of establishing an association relationship between a target test function module and different target test object modules includes: if the target test function module includes a target test object module, determining that the target test object module has an affiliation with the target test function module; if the target test object module has an affiliation with the target test function module, establishing an association relationship between the target test function module and the target test object module.
[0060] In this embodiment, the target test function module includes the target test function name and the target behavior name involved in the target test function.
[0061] Based on the target test function module, different target test object modules, and the association relationship between the target test function module and different target test object modules, a function and object relationship diagram is constructed, and the function and object relationship diagram is used as the combination result.
[0062] In this embodiment, the relationship between the target test function module and different target test object modules is displayed in the form of a function and object relationship diagram, which is convenient for testers to view.
[0063] In one embodiment of the present application, if the information of the target test object includes an object name, an object function description, an object identifier, and an object behavior, the process of pre-generating a target test object module based on the information of the target test object includes:
[0064] The object name, object function description, object identification and object behavior are stored to obtain storage information of the target test object.
[0065] In this embodiment, the storage information of the target test object is stored in the form of a table or a relationship diagram, which is not specifically limited here.
[0066] The storage information of the target test object is encapsulated to obtain the target test object module.
[0067] In this embodiment, the encapsulation format of the storage information of the target test object can be set according to actual conditions. For example, JSON (Java Script Object Notation) format is used as the encapsulation format of the storage information of the target test object.
[0068] In one embodiment of the present application, if the information of the target behavior includes a behavior name, a behavior function description, a behavior implementation condition, a behavior implementation operation description, and a behavior implementation response description, then the process of pre-generating a target behavior module based on the information of the target behavior includes:
[0069] The behavior name, behavior function description, behavior implementation conditions, behavior implementation operation description and behavior implementation response description are stored to obtain the storage information of the target behavior.
[0070] In this embodiment, the storage information of the target behavior is stored in the form of a table or a relationship diagram, which is not specifically limited here.
[0071] The storage information of the target behavior is encapsulated to obtain the target behavior module.
[0072] In this embodiment, the encapsulation format of the storage information of the target behavior can be set according to actual conditions. For example, JSON (Java Script Object Notation) format is used as the encapsulation format of the storage information of the target behavior.
[0073] In one embodiment of the present application, if the information of the target behavior also includes condition parameters, implementation parameters, and response parameters, before pre-generating the target behavior module based on the information of the target behavior, the test case generation method further includes:
[0074] Based on the behavior implementation conditions, condition parameters are defined; based on the behavior implementation operation description, implementation parameters are defined; and based on the behavior implementation response description, response parameters are defined.
[0075] In this embodiment, there is a mapping relationship between the behavior implementation conditions and the condition parameters, there is a mapping relationship between the behavior implementation operation description and the implementation parameters, and there is a mapping relationship between the behavior implementation response description and the response parameters.
[0076] In this embodiment, if the behavior implementation operation is described as fastening the seat belt, the implementation parameter corresponding to the fastening state is 1, and the behavior implementation condition is that the seat belt state is valid, and the behavior implementation response is described as checking the seat belt for a warning or checking the seat belt for a warning.
[0077] In this embodiment, when the behavior implementation condition is that the seat belt status is valid, the condition parameter is set to 1, and when the behavior implementation condition is that the seat belt status is invalid, the condition parameter is set to 0. When the behavior implementation response description is that there is a warning for checking the seat belt, the response parameter is set to 1; when the behavior implementation response description is that there is no warning for checking the seat belt, the response parameter is set to 0.
[0078] Establish an association relationship between condition parameters and behavior implementation conditions; establish an association relationship between implementation parameters and behavior implementation operation descriptions; and establish an association relationship between response parameters and behavior implementation response descriptions.
[0079] In this embodiment, since the condition parameter is defined based on the behavior implementation condition, the behavior implementation condition and the condition parameter have a one-to-one correspondence. Since the implementation parameter is defined based on the behavior implementation operation description, the implementation parameter and the behavior implementation operation description have a one-to-one correspondence. Since the response parameter is defined based on the behavior implementation response description, the response parameter and the behavior implementation response description have a one-to-one correspondence.
[0080] In this embodiment, the process of establishing the association relationship between the condition parameter and the behavior implementation condition includes: judging whether there is a corresponding relationship between the condition parameter and the behavior implementation condition, and if there is a corresponding relationship between the condition parameter and the behavior implementation condition, then establishing the association relationship between the condition parameter and the behavior implementation condition. The process of establishing the association relationship between the implementation parameter and the behavior implementation operation description includes: judging whether there is a corresponding relationship between the implementation parameter and the behavior implementation operation description, and if there is a corresponding relationship between the implementation parameter and the behavior implementation operation description, then establishing the association relationship between the implementation parameter and the behavior implementation operation description. The process of establishing the association relationship between the response parameter and the behavior implementation response description includes: judging whether there is a corresponding relationship between the response parameter and the behavior implementation response description, and if there is a corresponding relationship between the response parameter and the behavior implementation response description, then establishing the association relationship between the response parameter and the behavior implementation response description.
[0081] In this embodiment, after establishing the association relationship between the condition parameter and the behavior implementation condition, when the behavior implementation condition is that the seat belt state is valid, the condition parameter is automatically set to 1, and when the behavior implementation condition is that the seat belt state is invalid, the condition parameter is automatically set to 0; after establishing the association relationship between the implementation parameter and the behavior implementation operation description, when the behavior implementation operation description is fastening the seat belt, the implementation parameter is automatically set to 1, and when the behavior implementation operation description is unfastening the seat belt, the implementation parameter is automatically set to 0. After establishing the association relationship between the response parameter and the behavior implementation response description, when the behavior implementation response description is checking the seat belt for a warning, the response parameter is automatically set to 1, and when the implementation response description is checking the seat belt for a warning, the response parameter is automatically set to 0.
[0082] In one embodiment of the present application, after generating a test case, the test case generation method includes:
[0083] Record parameter data of the target test object before testing, and execute test cases, record parameter data of the target test object during testing, and after executing the test cases, record parameter data of the target test object after testing.
[0084] In this embodiment, the parameter data before the target test object is tested includes the running status data before the target test object is tested, the parameter data during the target test object test process includes the running status data during the target test object test process, and the parameter data after the target test object is tested includes the running status data after the target test object is tested.
[0085] The parameter data of the target test object before the test is compared with the condition parameters, the parameter data of the target test object during the test is compared with the implementation parameters, and the parameter data of the target test object after the test is compared with the response parameters. Based on the comparison results, the test results of the target test object are determined.
[0086] In this embodiment, if the parameter data of the target test object before the test is consistent with the conditional parameters, the parameter data of the target test object during the test is consistent with the implementation parameters, and the parameter data after the target test object is consistent with the response parameters, then the test result of the target test object is a successful test. If the parameter data before the target test object is inconsistent with the conditional parameters, the parameter data of the target test object during the test is inconsistent with the implementation parameters, or the parameter data after the target test object is inconsistent with the response parameters, then the test result of the target test object is an unsuccessful test.
[0087] In one embodiment of the present application, after obtaining the target test object module and the target behavior module, the test case generation method includes:
[0088] Display the information of the target test object module and the target behavior module; or modify the information of the target test object module and the target behavior module.
[0089] In this embodiment, the information of the target test object module and the target behavior module can be displayed in a graphical manner. For example, when the mouse is placed on the target test object module or within a preset range of the target test object module, the information of the target test object module is automatically displayed.
[0090] In this embodiment, the information of the target test object module and the target behavior module are modified by modifying the data in the chart. For example, by double-clicking the information of the target test object module with the mouse, you can jump to the editing page of the chart to modify the information of the target test object module.
[0091] Figure 3is a schematic diagram of a target test object shown in an exemplary embodiment of the present application. Figure 3 As shown, a rectangular square is used to represent the target test object, and the name of the target test object is indicated on the top of the rectangular square.
[0092] Figure 4 is a schematic diagram of a target behavior symbol shown in an exemplary embodiment of the present application, such as Figure 4 As shown, the bottom of the rectangular square representing the target test object represents the target behavior set of the target test object, and in the target behavior set, each row represents a target behavior.
[0093] Figure 5 is a schematic diagram of a target test function shown in an exemplary embodiment of the present application. Figure 5 As shown, a rounded square is used to represent a target test function, the top of the rounded square indicates the name of the target test function, and the bottom of the rounded square indicates the target behavior set involved in the target test function. In the target behavior set, each row represents a target behavior.
[0094] Figure 6 is a schematic diagram showing the relationship between functions and objects in an exemplary embodiment of the present application. Figure 6 As shown, the target test function is a combination of target behaviors of various target test objects, and the target test function is connected to various target test objects by solid lines.
[0095] Figure 7 is a schematic diagram of storing target test object information shown in an exemplary embodiment of the present application, such as Figure 7 As shown, taking the storage of target test object information in a table as an example, in the table named Object List (ObjectList), it includes a target test object name (ObjectName) field, a target test object description (Description) field, and a target test object picture (Picture) field. When the target test object name is LeftLock, the target test object description is a left door lock, and the corresponding target test object picture is inserted into the target test object picture field.
[0096] Figure 8 is a schematic diagram showing another exemplary embodiment of the present application for storing target test object information, such as Figure 8As shown, taking the table to store the target test object information as an example, in the table named LeftLock, it includes a target behavior name (BehaviorName) field, a target behavior description (Description) field, and a target behavior parameter (Arguments) field. When the target behavior name is Lock_SetStatus, the target behavior description is to set the lock status. The implementation method is: by setting the lock signal (locksignal). The target behavior parameter (Arguments) includes a lock status (LockStatus) parameter and a door status parameter (DoorStatus). Among them, the lock status (LockStatus) parameter is 1, indicating that the lock is open (On), the lock status (LockStatus) parameter is 0, indicating that the lock is closed (Off), the door status parameter (DoorStatus) is 1, indicating that the door is open (On), and the door status (DoorStatus) parameter is 0, indicating that the door is closed (Off).
[0097] Fig. 9 is a schematic diagram of storing target test function information shown in an exemplary embodiment of the present application, such as Fig. 9 As shown, taking the storage of target test function information in a table as an example, in a table named target test function list (FeatureList), the target test function name (FeatureName) and target test function description (Description) fields are included. When the target test function name is BLE, the target test function description is that the Bluetooth module is used to support unlocking, connecting headphones, and supporting Bluetooth calls.
[0098] Fig.10 is a schematic diagram of a test case shown in an exemplary embodiment of the present application, such as Fig.10As shown, the test case includes a module domain field, a function number field, a system name field, a function item field, a target test function field, a behavior implementation condition field, a behavior implementation operation description field, and a behavior implementation response description field. The module domain is the vehicle body domain, the function number is D3-F2-2, the system name is the passive safety system, the function item is the seat belt reminder, the target test function is the main driver's seat belt visual alarm (first-level reminder), and the behavior implementation conditions are that the car console usage mode is the comfort mode (CarConsole_SetUsageMode(Comfort)), the left seat belt is in a valid state (LeftSeat_SetSafetyBelt( Valid)), the behavior implementation operation description is the seat belt status is untied (Safetybelt_SetBeltStatus(Untied)), the car console usage mode is driving mode (CarConsole_SetUsageMode(Driving)), the seat belt status is fastened (SafetyBelt_SetBeltStatus(Tied)), the behavior implementation response description is the car console seat belt presence alarm (CarConsole_CheckSafetyBeltWarning(1)), the car console seat belt absence alarm (CarConsole CheckSafetyBeltWarning(0)).
[0099] In this embodiment, when the vehicle controller has a test requirement, the automobile development V model is used to perform a demand analysis on the vehicle controller to determine the test requirement information, thereby facilitating the determination of the target test object and the target behavior from the test requirement information.
[0100] In this embodiment, taking the testing of the vehicle controller function as an example, the process of using the automobile development V model to perform demand analysis on the vehicle controller includes: (1) determining the modeling object, which is the equipment, devices, virtual devices and tools in the software existing in the vehicle; (2) determining the abstraction level, which is the vehicle level, that is, the equipment and devices of the vehicle (including virtual devices and tools in the software) are abstract objects, such as the accelerator, brake, left door lock, air conditioner in the central control screen, etc., but no abstraction is performed on the switches and components in the inner layer, such as the vehicle control unit, pin, air conditioner temperature adjustment button in the central control screen, etc.; (3) analyzing the test model, test object and test behavior, etc. For example, when the left door lock is determined as the test object, the left door lock is analyzed through the demand document, etc. to have two behaviors: locking and unblocking; (4) evaluating the test model, test object and test behavior, etc., to obtain a modified test model, a modified test object and a modified test behavior; (5) forming test demand information stored in the form of a chart through the modified test model, the modified test object and the modified test behavior.
[0101] In this embodiment, the step format of the test case is "target behavior name (input parameter 1, input parameter 2...)"; if there is output data in the step, the output data format is "output data = target behavior name (input parameter 1, input parameter 2...)".
[0102] In this embodiment, in order to reduce the modeling workload, the object attributes are used as parameter data and described directly in the target behavior. For example, when the voltage attribute of the power supply is to be checked, it is directly classified as the check voltage behavior of the "power supply" object, and by checking the voltage parameter information in the voltage behavior, it is determined whether the voltage attribute of the power supply meets the expected results.
[0103] In this embodiment, the process of creating an automated test project based on the development of CAPL language as an example and executing the automated test project includes: (1) creating a file directory structure, the file directory structure includes a root directory, a project common library, a module common library, and a test script library, wherein the root directory is used to place all test project files, the project common library is used to place project-level common parameter files and function files, the module common library is used to place module-level common parameter files and function files, and the test script library is used to place test set files and test data files; (2) using the information of the target test object and the information of the target behavior to create a module common library; using the target test function information to create a test script library; referencing all project common libraries, module common library files and the test set data files needed to create a test set; (3) applying the test set in the Test Modules test environment in the CANoe simulation tool; (4) executing the test case and obtaining a report.
[0104] In this embodiment, a device and its behavior are expressed through a unified target test object module and target behavior module, thereby reducing misunderstandings of the same device by different testers, shortening the communication time between different testers, and improving the work efficiency of testers; the reusability and maintainability between the target test object and the target behavior are enhanced through the association relationship between the target test object module and the target behavior module; the test cases or automated test projects generated by the target test object module and the target behavior module are highly reusable and customizable.
[0105] The following describes an apparatus embodiment of the present application, which can be used to execute the test case generation method in the above embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above embodiment of the test case generation method of the present application.
[0106] Fig.11 is a block diagram of a test case generation device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The implementation environment shown is specifically configured in the vehicle controller 102. The device may also be applicable to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applicable.
[0107] like Fig.11 As shown, the exemplary test case generating device includes:
[0108] The information acquisition module 1101 is used to obtain the test requirement information issued by the tester.
[0109] The object determination module 1102 is used to determine the target test object and target behavior from the test requirement information.
[0110] The module combining module 1103 is used to call the target test object module and the target behavior module in the preset development platform, and combine the target test object module and the target behavior module.
[0111] The use case generation module 1104 is used to generate test cases based on the combination results.
[0112] In one embodiment of the present application, the test requirement information includes the vehicle domain controller to be tested, the test operation performed on the vehicle domain controller, etc. The vehicle domain controller to be tested is taken as the target test object, and the test operation performed on the vehicle domain controller is taken as the target behavior.
[0113] In this embodiment, the target test object includes a test object corresponding to the test requirement information and used to generate a test case; the target behavior includes a behavior corresponding to the test requirement information and used to generate a test case.
[0114] In this embodiment, the process of determining the target test object and target behavior from the test requirement information can be achieved by extracting the content in the vehicle model field in the test requirement information to obtain the target vehicle model, by extracting the content in the object field in the test requirement information to obtain the target test object, and by extracting the content in the behavior field in the test requirement information to obtain the target behavior, etc.
[0115] In this embodiment, the target test object module is pre-generated based on the information of the target test object; the target behavior module is pre-generated based on the information of the target behavior.
[0116] In this embodiment, by calling the target test object module and target behavior module in the preset development platform and combining the target test object module and the target behavior module, it is possible to fully utilize the target test object module and target behavior module that have been written by other testers, reduce repetitive work in the process of generating test cases, and improve the efficiency of generating test cases.
[0117] In this embodiment, the process of generating a test case based on the combination result includes: converting the combination result into a text in a preset language format, and generating a test case based on the text in the preset language format.
[0118] In this embodiment, the preset language format text includes (Communication Access Programming Language, CAPL), Python language, etc., which are not specifically limited here.
[0119] In this embodiment, the target test object module and the target behavior module are combined to generate test cases that can be applicable to different test vehicle models or test controllers, thereby improving the flexibility of test case generation.
[0120] It should be noted that the test case generation device provided in the above embodiment and the test case generation method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the test case generation device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0121] An embodiment of the present application also provides a vehicle-mounted device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the vehicle-mounted device implements the test case generation method provided in the above-mentioned embodiments.
[0122] An embodiment of the present application further provides a vehicle, the vehicle comprising a test case generating device as provided in each of the above embodiments or a vehicle-mounted device as provided in each of the above embodiments.
[0123] Fig.12 The structure diagram of the computer system of the vehicle-mounted device suitable for implementing the embodiment of the present application is shown. It should be noted that: Fig.12 The computer system 1200 of the vehicle-mounted device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0124] like Fig.12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM) 1203, such as executing the method in the above embodiment. In the RAM 1203, various programs and data required for system operation are also stored. The CPU 1201, the ROM 1202 and the RAM 1203 are connected to each other through the bus 1204. The input / output (I / O) interface 1205 is also connected to the bus 1204.
[0125] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed so that a computer program read therefrom is installed into the storage section 1208 as needed.
[0126] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1209, and / or installed from a removable medium 1211. When the computer program is executed by a central processing unit (CPU) 1201, various functions defined in the system of the present application are executed.
[0127] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable medium or any combination of the above two. Computer-readable media can be, for example, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0128] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0129] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0130] Another aspect of the present application also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor of a computer, causes the computer to execute the test case generation method as described above. The computer-readable medium may be included in the vehicle-mounted device described in the above embodiment, or may exist independently without being assembled into the vehicle-mounted device.
[0131] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable medium. A processor of a computer device reads the computer instruction from the computer-readable medium, and the processor executes the computer instruction, so that the computer device executes the test case generation method provided in each of the above embodiments.
[0132] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A test case generation method, characterized in that: The method comprises: Obtain test requirement information issued by testers; Determine a target test object and a target behavior from the test requirement information; the target test object includes a test object for generating a test case corresponding to the test requirement information; the target behavior includes a behavior for generating a test case corresponding to the test requirement information; Calling a target test object module and a target behavior module in a preset development platform, and combining the target test object module and the target behavior module, wherein the target test object module is pre-generated based on the information of the target test object; and the target behavior module is pre-generated based on the information of the target behavior; Based on the combined results, test cases are generated.
2. The test case generation method according to claim 1, characterized in that: If the test requirement information includes an association relationship between the target test object and the target behavior, the process of combining the target test object module and the target behavior module includes: According to the association relationship between the target test object and the target behavior, the target behavior modules are grouped to obtain a set of target behavior modules corresponding to different target test object modules; Combining different target test object modules and target behavior module sets corresponding to different target test object modules to obtain a target test function module, and establishing an association relationship between the target test function module and different target test object modules; Based on the target test function module, the different target test object modules, and the association relationship between the target test function module and the different target test object modules, a function and object relationship diagram is constructed, and the function and object relationship diagram is used as the combination result.
3. The test case generation method according to claim 1 or 2, characterized in that: If the information of the target test object includes an object name, an object function description, an object identifier, and an object behavior, the process of pre-generating a target test object module based on the information of the target test object includes: The object name, the object function description, the object identifier and the object behavior are stored to obtain storage information of the target test object; The storage information of the target test object is encapsulated to obtain the target test object module.
4. The test case generation method according to claim 1 or 2, characterized in that: If the target behavior information includes behavior naming, behavior function description, behavior implementation conditions, behavior implementation operation description, and behavior implementation response description, the process of pre-generating a target behavior module based on the target behavior information includes: The behavior name, the behavior function description, the behavior implementation condition, the behavior implementation operation description and the behavior implementation response description are stored to obtain storage information of the target behavior; The storage information of the target behavior is encapsulated to obtain the target behavior module.
5. The test case generation method according to claim 4, characterized in that: If the target behavior information further includes condition parameters, implementation parameters, and response parameters, before pre-generating a target behavior module based on the target behavior information, the method further includes: Based on the behavior implementation condition, define the condition parameter; based on the behavior implementation operation description, define the implementation parameter; and based on the behavior implementation response description, define the response parameter; Establish an association relationship between the condition parameter and the behavior implementation condition; establish an association relationship between the implementation parameter and the behavior implementation operation description; and establish an association relationship between the response parameter and the behavior implementation response description.
6. The test case generation method according to claim 5, characterized in that: After generating the test case, the method includes: Recording parameter data of the target test object before testing, and executing the test case, recording parameter data of the target test object during testing, and after executing the test case, recording parameter data of the target test object after testing; The parameter data of the target test object before the test is compared with the condition parameters, the parameter data of the target test object during the test is compared with the implementation parameters, and the parameter data after the test of the target test object is compared with the response parameters. Based on the comparison results, the test result of the target test object is determined.
7. The test case generation method according to claim 1 or 2, characterized in that: After obtaining the target test object module and the target behavior module, the method includes: The information of the target test object module and the information of the target behavior module are displayed; or the information of the target test object module and the information of the target behavior module are modified.
8. A test case generating device, characterized in that: The device comprises: Information acquisition module, used to obtain test requirement information issued by testers; An object determination module, used to determine a target test object and a target behavior from the test requirement information; the target test object includes a test object for generating a test case corresponding to the test requirement information; the target behavior includes a behavior for generating a test case corresponding to the test requirement information; A module combination module, used for calling a target test object module and a target behavior module in a preset development platform, and combining the target test object module and the target behavior module, wherein the target test object module is pre-generated based on the information of the target test object; and the target behavior module is pre-generated based on the information of the target behavior; The use case generation module is used to generate test cases based on the combination results.
9. A vehicle-mounted device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the vehicle-mounted device to implement the test case generation method as described in any one of claims 1 to 7.
10. A vehicle, characterized in that: The vehicle includes the test case generating device as claimed in claim 8 or the vehicle-mounted device as claimed in claim 9.
