An automated UDS flash test and system based on Python and CAPL language
Through the automated UDS flash test method based on Python and CAPL languages, the problems of low efficiency and high cost of UDS flash test are solved, efficient and low-cost automated testing are realized, and human factors and hardware requirements are reduced, and testing accuracy is improved. degree and compatibility.
Patent Information
- Application Number
- CN202311867711.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-30
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2043-12-30
AI Technical Summary
The existing UDS flash writing test methods have problems such as low manual testing efficiency and large errors, and automated testing requires expensive HIL equipment and high learning costs.
The automated UDS flash test method based on Python and CAPL languages is adopted. By writing functional interfaces, generating test case libraries, building test environments, running test scripts and monitoring progress, one-click automated testing is achieved, reducing human factors and hardware needs.
It improves testing efficiency and accuracy, reduces costs, reduces meaningless repetitive labor, liberates manpower, and achieves compatibility and platformization of different projects.
Smart Images

Figure CN117785712B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of flash testing, and in particular to an automated UDS flash testing method and system based on Python and CAPL languages. Background Art
[0002] Software flashing refers to a method of burning software to a specified address in the controller main chip through a host computer or other media, so as to achieve the purpose of writing or updating the program in the main chip. UDS (Unified Diagnostic Services) is a universal diagnostic service standard used for the diagnosis and debugging of automotive electronic control units (ECUs). UDS is a communication protocol defined by the ISO14229 standard that can communicate on multiple buses such as CAN and LIN. The UDS protocol is widely used in the diagnosis and debugging of automotive electronic control systems and has become an important part of modern automobile manufacturing.
[0003] At present, the main methods of UDS flashing test are manual test, ECU-TEST software, CANoe software and HIL system combined automated test. Among them, manual test requires testers to test each item against the test case, and manually perform fault injection test according to the progress of flashing.
[0004] However, manual testing requires testers to manually perform fault injection testing based on observing the flashing progress. The test efficiency is low and manual fault injection has significant errors. Automatic testing requires companies to have HIL equipment, ECU-TEST software, CANoe software and its hardware. This set of equipment is relatively expensive and requires a high learning cost. Summary of the invention
[0005] Based on this, it is necessary to provide a low-cost automated UDS flash test method, device, computer equipment, computer-readable storage medium and computer program product based on Python and CAPL language to address the above technical problems.
[0006] In a first aspect, the present application provides an automated UDS flash test method based on Python and CAPL language. The method comprises:
[0007] Write functional interfaces and generate corresponding test case libraries based on preset test requirements;
[0008] Build the test environment and obtain the corresponding test parameter information;
[0009] According to the test template in the test requirements, filter out the test cases corresponding to the test template and make them into test script files for testing.
[0010] In one embodiment, the normal flash test includes:
[0011] Configuring the function parameter information to the function interface;
[0012] Run the test script file and monitor the test progress;
[0013] When the test is completed, obtaining the test result;
[0014] The test result is compared with the preset expected result and the comparison result is output.
[0015] In one embodiment, the fault injection test includes:
[0016] Configuring the function parameter information to the function interface;
[0017] Run the test script and obtain the bus flash message through the functional interface;
[0018] When a message requiring fault injection is detected, the fault injection operation is performed through the functional interface;
[0019] When the test is completed, obtaining a first fault test result;
[0020] Comparing the first fault test result with a preset expected result and obtaining a first comparison result;
[0021] Re-perform the normal flash test and obtain the second comparison result;
[0022] If the first comparison result and the second comparison result are both the same as the corresponding expected results, then outputting a prompt message related to passing the test;
[0023] Otherwise, output relevant prompt information related to failure.
[0024] In one embodiment, writing the functional interface includes:
[0025] Get the handles of all top-level windows on the desktop and put them into a list;
[0026] Get the corresponding process ID list according to the handle list; use the process ID list to get the corresponding process name list;
[0027] Automatically match the process name of the host computer software from the process name list and obtain the top-level handle corresponding to the host computer software;
[0028] Use the top-level handle of the host computer to obtain the handles of each functional component in the host computer, and obtain the functional component through the handle;
[0029] Write a functional interface based on the functional components.
[0030] In one embodiment, writing the functional interface includes:
[0031] Call the modbus library function to send a communication message to the program-controlled relay through the serial port, and the communication message meets the RS485 protocol;
[0032] The program-controlled relay controls the opening and closing of the port based on the communication message.
[0033] In one embodiment, writing the functional interface includes:
[0034] Call the CAPL written function to send a communication message to the program-controlled relay through the serial port, and the communication message meets the RS485 protocol;
[0035] The program-controlled relay controls the opening and closing of the port based on the communication message.
[0036] In the second aspect, the present application also provides an automated UDS flash test device based on Python and CAPL language. The device includes:
[0037] Functional interface writing module, used to write functional interfaces and generate corresponding test case libraries according to preset test requirements;
[0038] Test parameter acquisition module, used to build the test environment and obtain the corresponding test parameter information;
[0039] The flash test running module is used to filter out the test cases corresponding to the test template according to the test template in the test requirements and make them into test script files for testing.
[0040] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0041] Write functional interfaces and generate corresponding test case libraries based on preset test requirements;
[0042] Build the test environment and obtain the corresponding test parameter information;
[0043] According to the test template in the test requirements, filter out the test cases corresponding to the test template and make them into test script files for testing.
[0044] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0045] Write functional interfaces and generate corresponding test case libraries based on preset test requirements;
[0046] Build the test environment and obtain the corresponding test parameter information;
[0047] According to the test template in the test requirements, filter out the test cases corresponding to the test template and make them into test script files for testing.
[0048] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0049] Write functional interfaces and generate corresponding test case libraries based on preset test requirements;
[0050] Build the test environment and obtain the corresponding test parameter information;
[0051] According to the test template in the test requirements, filter out the test cases corresponding to the test template and make them into test script files for testing.
[0052] The above-mentioned automated UDS flash test method, device, computer equipment, storage medium and computer program product based on Python and CAPL language writes functional interfaces and generates corresponding test case libraries according to preset test requirements; builds a test environment and obtains corresponding test parameter information; filters out test cases corresponding to the test template according to the test template in the test requirements and makes them into test script files for testing. This application adopts the above method. The present invention uses Python software. After completing the preliminary configuration, it can perform one-click automated testing without learning the operation interface; the operation is simple and easy to execute; the present invention only uses Python software and CANoe software in terms of software, and only uses CANcaseXL hardware, ES581 hardware and programmable relay hardware in terms of hardware. No other software and hardware coordination is required, and no independent design and research and development of supporting hardware is required; few tools are used and the cost is low; the present invention only needs to build a simple test environment, and can be compatible with the host computer software of different projects through simple configuration, without the need for active adaptation of the host computer software, and no need for the test software to adapt to the host computer; the platformization degree is high and no additional development cost is required; the present invention can automatically analyze intermediate data and automatically generate test reports, filter out error items, and do not need manual data processing; reduce test errors caused by human factors; the operation of the present invention can reduce meaningless repetitive work, liberate manpower, and improve work efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 This is an application environment diagram of an automated UDS flash writing test method based on Python and CAPL language in one embodiment;
[0054] Figure 2It is a flowchart of an automated UDS flash writing test method based on Python and CAPL language in one embodiment;
[0055] Figure 3 It is a flowchart of a normal flash test of an automated UDS flash test method based on Python and CAPL language in one embodiment;
[0056] Figure 4 It is a flowchart of a fault injection test of an automated UDS flash writing test method based on Python and CAPL language in one embodiment;
[0057] Figure 5 It is a structural block diagram of an automated UDS flash writing test device based on Python and CAPL language in one embodiment. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0059] The automated UDS flash test method based on Python and CAPL language provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. It includes a computer, host computer software, Python3.9 software, CANoe14.0 software, CANcaseXL device, ES581 device, programmable relay, and Excel software; the computer is used for the specific use of the software; the host computer software is used to perform the flash test; Python3.9 software is used to control the host computer software, generate test cases, perform one-click test execution, analyze test data, and generate test results; CANoe14.0 software can analyze CAN bus message information and is used to perform fault injection tests in flash tests; CANcaseXL device is used as a carrier for CANoe software execution and can capture CAN message information; ES581 device is used as a carrier for host computer software execution and can capture CAN message information; programmable relay is used to control the power on and off of the controller and can be controlled by a program. Excel software is used to read test reports and analyze specific data.
[0060] In one embodiment, Figure 2 As shown, the method comprises the following steps:
[0061] Step 202, write a functional interface and generate a corresponding test case library according to preset test requirements.
[0062] Among them, the functional interface includes using Python to write the functional interface of various functions of the upper computer software, realizing the function of simulating the mouse to control the upper computer; using Python to write the functional interface of the programmable relay, realizing the function of controlling the on and off of the programmable relay port; and using CAPL to write the functional interface of the programmable relay, realizing the function of controlling the on and off of the programmable relay port in CANoe.
[0063] Step 204: build a test environment and obtain corresponding test parameter information.
[0064] Among them, build a test environment, connect the programmable relay to the controller, connect CANcaseXL and ES581 to the controller, fill in the test parameter information required for flashing in Python, the test parameter information includes the host computer software path, the test requirement template path and the file path to be flashed.
[0065] Once the hardware test environment is built, there is no need to rebuild it for each test. The upper computer software path, test requirement template path, and file path to be flashed filled in the Python script are only manually configured before each test.
[0066] It is worth mentioning that this system can provide another more intelligent functional interface. If the test content is deployed on a project management software such as SVN for management, and the system can be given relevant permissions, this system can realize the autonomous download of the latest version of the test files and test requirements from SVN through the functional interface for testing. It only needs to configure the path of the relevant files on the project management software in advance to realize the autonomous update of the test requirements and test software. It can reduce the test accidents caused by configuration errors.
[0067] Step 206, filter out test cases corresponding to the test template according to the test template in the test requirement and make them into test script files for testing.
[0068] Among them, Python is used to read the test requirement template, automatically filter test cases from the test case library and generate test script files, automatically execute flash tests, and execute the test process according to the test cases; the Python script can select matching test cases in the test case library according to the test requirement template, and make the filtered test cases into test script files separately.
[0069] In the above-mentioned automated UDS flash writing test method based on Python and CAPL language, the present invention uses Python software. After completing the preliminary configuration, it can perform automated testing with one click, without the need to learn the operation interface; the operation is simple and easy to execute; the present invention only uses Python software and CANoe software in terms of software, and only uses CANcaseXL hardware, ES581 hardware and programmable relay hardware in terms of hardware. No other software and hardware coordination is required, and no independent design and research and development of supporting hardware is required; few tools are used and the cost is low; the present invention only needs to build a simple test environment, and can be compatible with the host computer software of different projects through simple configuration, without the need for active adaptation of the host computer software, and no need for the test software to adapt to the host computer; the platformization degree is high and no additional development cost is required.
[0070] In one embodiment, Figure 3 As shown, the normal flash test includes:
[0071] Step 302: configure the function parameter information to the function interface.
[0072] Among them, in the normal flash test, Python first calls the programmable relay interface to power on the controller, then opens the host computer software according to the host computer software path, and then uses the host computer software function interface to configure the flash baud rate, flash hardware, and files to be flashed.
[0073] Step 304: Run the test script file and monitor the test progress.
[0074] Then, the upper computer software function interface is used to automatically click the flash button, and after the flash test starts, the progress of the flash progress bar is monitored.
[0075] Step 306, when the test is finished, obtain the test result, compare the test result with the preset expected result and output the comparison result.
[0076] Among them, when the flashing stops, read the contents of the flashing result box of the host computer. If it matches the expected result of the test case, output "PASS"; if the result is inconsistent, output "FAIL".
[0077] In one embodiment, Figure 4 As shown, fault injection testing includes:
[0078] The function parameter information is configured to the function interface.
[0079] Among them, Python first calls the programmable relay interface to power on the controller, then opens the host computer software according to the host computer software path, and then uses the host computer software function interface to configure the flashing baud rate, flashing hardware, files to be flashed and other information.
[0080] Run the test script and obtain the bus flash message through the functional interface.
[0081] Among them, Python then calls the CANoe interface to start the fault injection script written in CAPL language. When Python starts the flashing process, CANoe will monitor the bus flashing message.
[0082] When a message requiring fault injection is detected, the fault injection operation is performed through the functional interface.
[0083] Among them, when it is detected that a flashing step that requires fault injection is required, CANoe will automatically call the programmable relay interface to perform fault injection operations such as disconnecting the power supply and short-circuiting the CAN line.
[0084] When the flashing stops, Python will read the contents of the flashing result box of the host computer. If it matches the expected result of the test case, it will output "PASS"; if the result is inconsistent, it will output "FAIL"; then Python will call the programmable relay interface to execute the operation of powering off and then powering on the controller, and then perform a normal flashing test and obtain the result; when both results are "PASS", the final test result of the test case is "PASS", if at least one result is not "PASS", the final test result of the test case is "FAIL".
[0085] In one embodiment, considering that some host computers do not include API test interfaces, and without API test interfaces, the flash test cannot be integrated, so Python is used to write functional interfaces of various functions of the host computer software to realize the functions of simulating mouse control of the host computer, including:
[0086] First, get the handles of all top-level windows on the desktop and put them in a list. Then get the corresponding process ID list based on the handle list. Then use the process ID list to get the corresponding process name list. Automatically match the process name of the host software from the process name list and get the top-level handle corresponding to the host software. Then use the top-level handle of the host computer to get the handles of each functional component in the host computer. Get the functional components through the handles and classify them, such as buttons, radio buttons, drop-down boxes, edit boxes, progress bars, etc. Finally, write a functional interface for each functional component separately, and use the functional interface to simulate the operation of the mouse on the functional component.
[0087] It is worth mentioning that this functional interface can adapt to many different types of flashing host computer software. Different test projects often have different flashing host computer software due to different customer needs. This functional interface can adapt to different flashing host computer software. It only needs to make a simple configuration file for each host computer to use it normally. Users do not need to develop an additional host computer, nor do they need to modify the software to adapt to the host computer.
[0088] In one embodiment, the function interface of the program-controlled relay is written in Python to realize the function of controlling the on and off of the program-controlled relay port, including:
[0089] Write a functional interface to realize the function of controlling the on and off of the program-controlled relay port using Python software. Use the modbus library function in Python to send RS485 protocol communication messages to the program-controlled relay through the serial port. After the program-controlled relay receives the communication message of the protocol, it can connect or disconnect a single or multiple ports at the same time according to the message content.
[0090] In one embodiment, the function interface of the program-controlled relay is written using CAPL to realize the function of controlling the on and off of the program-controlled relay port in CANoe, including:
[0091] Write a functional interface to realize the function of using CANoe software to control the on and off of the program-controlled relay port. CANoe software itself does not have RS485 communication protocol, so you need to use the CAPL that comes with CANoe software to write functions so that the sent message meets the RS485 communication protocol. Finally, use CANoe software to send RS485 protocol communication messages to the program-controlled relay through the serial port. After the program-controlled relay receives the communication message of the protocol, it can connect or disconnect a single or multiple ports at the same time according to the message content.
[0092] After the automated test is completed, the tester only needs to check the FAIL item in the Excel table to quickly know which test cases have not passed the test, so that targeted analysis can be carried out to quickly understand the problems in this version of the software; the tester only needs to fill in the basic configuration item data, start the Python script, and wait for the test results to be generated; there is no need to manually execute test cases one by one, nor to worry about large errors caused by manual operation; there is no need to manually process a large amount of intermediate data, nor to worry about data accuracy; no additional manpower is required to ensure the system is running, reducing repeated manual labor. The system has simple equipment and low cost, easy operation and efficient operation, and has high compatibility with different host computer software. When migrating between different projects, you only need to replace the host computer software and the corresponding configuration, and it has a high degree of platformization.
[0093] The system has high independence and compatibility, and can be used as a test system alone or as a test subsystem embedded in another test system. The system provides a software interface for interacting with project management software, which can meet the needs of enterprises for process-based, uninterrupted and continuous testing.
[0094] This embodiment adopts the above method and uses Python software. After completing the preliminary configuration, it can perform one-click automated testing without learning the operation interface; the operation is simple and easy to execute; the software of the present invention only uses Python software and CANoe software, and the hardware only uses CANcaseXL hardware, ES581 hardware and programmable relay hardware. No other software and hardware coordination is required, and no independent design and research and development of supporting hardware is required; few tools are used and the cost is low; the present invention only needs to build a simple test environment, and can be compatible with the host computer software of different projects through simple configuration, without the need for active adaptation of the host computer software, and no need for the test software to adapt to the host computer; the platformization degree is high and no additional development cost is required; the present invention can automatically analyze intermediate data and automatically generate test reports, filter out error items, and do not need manual data processing; reduce test errors caused by human factors; the operation of the present invention can reduce meaningless repetitive work, liberate manpower, and improve work efficiency and accuracy.
[0095] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0096] Based on the same inventive concept, the embodiment of the present application also provides an automated UDS flash test device based on Python and CAPL languages for implementing the automated UDS flash test method based on Python and CAPL languages involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the automated UDS flash test device based on Python and CAPL languages provided below can refer to the limitations of the automated UDS flash test method based on Python and CAPL languages above, and will not be repeated here.
[0097] In one embodiment, Figure 5 As shown, an automated UDS flash test device based on Python and CAPL language is provided, including: a function interface writing module, a test parameter acquisition module and a flash test running module, wherein:
[0098] Functional interface writing module, used to write functional interfaces and generate corresponding test case libraries according to preset test requirements;
[0099] Test parameter acquisition module, used to build the test environment and obtain the corresponding test parameter information;
[0100] The flash test running module is used to filter out the test cases corresponding to the test template according to the test template in the test requirements and make them into test script files for testing.
[0101] In one embodiment, the flash test running module is also used to: configure the functional parameter information to the functional interface; run the test script file and monitor the test progress; when the test is completed, obtain the test results; compare the test results with the preset expected results and output the comparison results.
[0102] In one embodiment, the flash test running module is also used to: configure the functional parameter information to the functional interface; run the test script and obtain the bus flash message through the functional interface; when a message requiring fault injection is detected, perform the fault injection operation through the functional interface; when the test is completed, obtain the first fault test result; compare the first fault test result with the preset expected result and obtain the first comparison result; re-perform the normal flash test and obtain the second comparison result; if the first comparison result and the second comparison result are both the same as the corresponding expected results, output prompt information related to passing the test; otherwise, output prompt information related to failing.
[0103] In one embodiment, the functional interface writing module is also used to: first obtain the handles of all top-level windows on the desktop and put them into a list, then obtain the corresponding process ID list based on the handle list, then use the process ID list to obtain the corresponding process name list, automatically match the process name of the host computer software from the process name list and obtain the top-level handle corresponding to the host computer software; then use the top-level handle of the host computer to obtain the handles of each functional component in the host computer, and obtain the functional component through the handle, and write a functional interface based on the functional component.
[0104] In one embodiment, the function interface writing module is also used to: call the modbus library function to send a communication message to the programmable relay through the serial port, and the communication message meets the RS485 protocol; the programmable relay controls the opening and closing of the port based on the communication message.
[0105] In one embodiment, the function interface writing module is also used to: call the CAPL writing function to send a communication message to the programmable relay through the serial port, and the communication message meets the RS485 protocol. The programmable relay controls the opening and closing of the port based on the communication message.
[0106] Each module in the above-mentioned automated UDS flash test device based on Python and CAPL language can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0107] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram is shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an automated UDS flash writing test method based on Python and CAPL languages is implemented.
[0108] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0109] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0110] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0111] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0112] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0113] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0114] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0115] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An automated UDS flash test method based on Python and CAPL language, It is characterized in that The method comprises: Write a functional interface and generate a corresponding test case library according to preset test requirements; the writing of the functional interface includes: obtaining handles of all top-level windows on the desktop and putting them into a list; obtaining a corresponding process ID list according to the handle list; using the process ID list to obtain a corresponding process name list; automatically matching the process name of the host computer software from the process name list and obtaining the top-level handle corresponding to the host computer software; using the top-level handle of the host computer to obtain the handles of each functional component in the host computer, and obtaining the functional component through the handle; writing a functional interface based on the functional component; Build the test environment and obtain the corresponding test parameter information; According to the test template in the test requirement, test cases corresponding to the test template are screened out and made into a test script file for testing; the test includes a fault injection test, and the fault injection test includes: configuring the function parameter information to the function interface; running the test script and obtaining the bus flash message through the function interface; when a message that needs to be injected with a fault is detected, performing a fault injection operation through the function interface; when the test is completed, obtaining a first fault test result; comparing the first fault test result with a preset expected result and obtaining a first comparison result; re-performing a normal flash test and obtaining a second comparison result; if the first comparison result and the second comparison result are both the same as the corresponding expected results, outputting prompt information related to passing the test; otherwise, outputting prompt information related to failing the test.
2. The method according to claim 1, wherein the test further comprises a normal flash test. It is characterized in that The normal flash test includes: Configuring the function parameter information to the function interface; Run the test script file and monitor the test progress; When the test is completed, obtaining the test result; The test result is compared with the preset expected result and the comparison result is output.
3. The method according to claim 1, It is characterized in that The writing function interface includes: Call the modbus library function to send a communication message to the program-controlled relay through the serial port, and the communication message meets the RS485 protocol; The program-controlled relay controls the opening and closing of the port based on the communication message.
4. The method according to claim 1, It is characterized in that The writing function interface includes: Call the CAPL written function to send a communication message to the program-controlled relay through the serial port, and the communication message meets the RS485 protocol; The program-controlled relay controls the opening and closing of the port based on the communication message.
5. An automated UDS flash test device based on Python and CAPL language, It is characterized in that The device comprises: Functional interface writing module, used to write functional interfaces and generate corresponding test case libraries according to preset test requirements; also used to obtain handles of all top-level windows on the desktop and put them into a list; obtain the corresponding process ID list according to the handle list; use the process ID list to obtain the corresponding process name list; automatically match the process name of the host computer software from the process name list and obtain the top-level handle corresponding to the host computer software; use the top-level handle of the host computer to obtain the handles of each functional component in the host computer, and obtain the functional component through the handle; write functional interfaces based on the functional components; Test parameter acquisition module, used to build the test environment and obtain the corresponding test parameter information; A flash test running module is used to filter out test cases corresponding to the test template according to the test template in the test requirements and make them into test script files for testing; wherein the test includes a fault injection test; it is also used to configure functional parameter information to a functional interface; run the test script and obtain a bus flash message through the functional interface; when a message requiring fault injection is detected, perform a fault injection operation through the functional interface; when the test is completed, obtain a first fault test result; compare the first fault test result with a preset expected result and obtain a first comparison result; re-perform a normal flash test and obtain a second comparison result; if the first comparison result and the second comparison result are both the same as the corresponding expected results, output prompt information related to passing the test; otherwise, output prompt information related to failing the test.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
8. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
