A flashing test method, device and medium
Patent Information
- Application Number
- CN202211637662.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-16
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2042-12-16
AI Technical Summary
这无疑对测试人员的技术水平要求较高,同时由于测试人员全程对不同项目的重新开发,容易出现测试点漏检、错检情况发生,使得整个刷写过程的效率较低,测试结果的准确性较低
[0049] This invention provides a flashing test method, comprising: obtaining configuration parameters of the current test project and the file to be flashed; calling the expected result parameter corresponding to the current test step in the configuration parameters, wherein the test cases for the file to be flashed are executed through multiple test steps under the current test project, and the test cases are obtained by combining the functional programs corresponding to the multiple test steps according to the configuration parameters, and the functional programs corresponding to the multiple test steps are pre-encapsulated; verifying the current test step according to the expected result parameter to obtain the verification result, and if the verification result is successful, calling the diagnostic function instruction to test the function corresponding to the current test step to obtain the test result; if the test result is successful, taking the next test step as the current test step, and returning to the step of calling the expected result parameter corresponding to the current test step in the configuration parameters, until the flashing test of the test steps within the test cases is completed. This method separates the configuration parameters from the flashing process, and divides the test process into independent test steps according to each functional program, and combines the functional programs according to the configuration parameters to obtain test cases, so that the test steps are freed from the dependency of the current test project, avoiding the need to redevelop the corresponding flashing process for the existing test project. Furthermore, testers are not required to be familiar with the flashing process, test points, and implementation principles of each test item, reducing the technical skill requirements for testers. Test steps can be programmed based solely on configuration parameters to implement the flashing test process. Additionally, before testing each test step, the expected result parameters are verified. Testing proceeds only if the verification result is successful. The next test step is performed only after the current test step's result is successful, saving testing time, improving the versatility of the flashing test and the efficiency of the entire flashing process, while also increasing the accuracy of the final test results.
Smart Images

Figure CN115840707B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing technology, and in particular to a brush test method, apparatus and medium. Background Technology
[0002] During the development process, Tier 1 suppliers of automotive electronic control units need to test the flashing functionality of their products based on Unified Diagnostic Services (UDS). The test points include forward testing, reverse testing, and stress testing. The flashing process and related parameters differ for each project, and testers need to redevelop the entire flashing process according to the flashing procedure for each project.
[0003] Because the flashing process and parameters are tested together, testers must not only be familiar with the project's flashing procedure and the test points to be verified, but also with the implementation principles of the entire flashing process. This undoubtedly places high demands on the testers' technical skills. Furthermore, since testers are redeveloping different projects throughout the process, it's easy for test points to be missed or incorrectly checked, resulting in low efficiency and low accuracy of the test results.
[0004] Therefore, finding a flash test method is an urgent problem that needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of this invention is to provide a brushing test method, apparatus, and medium that saves testing time, improves the versatility of brushing tests and the efficiency of the entire brushing process, and improves the accuracy of the final test results.
[0006] To solve the above-mentioned technical problems, the present invention provides a flashing test method, comprising:
[0007] Get the configuration parameters and files to be flashed for the current test project;
[0008] The expected result parameter corresponding to the current test step is called in the configuration parameters. The test case of the file to be written is executed through multiple test steps under the current test project. The test case is obtained by combining the functional programs corresponding to the multiple test steps according to the configuration parameters. The functional programs corresponding to the multiple test steps are pre-encapsulated.
[0009] The current test step is tested according to the expected result parameters to obtain the test result. If the test result is successful, the diagnostic function instruction is called to test the function corresponding to the current test step to obtain the test result.
[0010] If the test result is successful, the next test step is taken as the current test step, and the process returns to the step of calling the expected result parameter corresponding to the current test step in the configuration parameters, until the write test of the test steps in the test case is completed.
[0011] Preferably, the step of verifying the current test step according to the expected result parameter to obtain the test result includes:
[0012] Obtain the return result parameter of the current test step, wherein the return result parameter is the result parameter fed back by the inspection instruction sent when the current test step is called;
[0013] Compare the expected result parameters corresponding to the current test step with the returned result parameters;
[0014] When the expected result parameter is the same as the returned result parameter, the test result is determined to be successful.
[0015] If the expected result parameter is different from the returned result parameter, the test result is determined to be a failure.
[0016] Preferably, the test cases for the file to be written are executed through multiple test steps under the current test project, including:
[0017] Obtain the test points of the current test item, wherein the test points are forward test points and / or reverse test points;
[0018] The test steps are performed according to the test points to execute the test cases of the file to be written.
[0019] Preferably, when the test point is the reverse test point, the step of writing each of the test steps according to the test point to execute the test cases of the file to be written includes:
[0020] Obtain the reverse test type of the reverse test point, wherein the test type of the reverse test point includes either the skip-write step type or the short-circuit disconnect type;
[0021] When the reverse test type is the skipped flashing step type, the skipped test steps corresponding to the skipped flashing step type are not executed, and the test cases of the file to be flashed are executed for the non-skipped test steps, wherein the non-skipped test steps are the test steps other than the skipped flashing steps in each of the test steps.
[0022] When the reverse test type is the short-circuit / disconnection type, protection operation processing is performed according to the test steps corresponding to the short-circuit / disconnection type.
[0023] Preferably, the step of invoking the diagnostic function instruction to test the function corresponding to the current test step and obtain the test result includes:
[0024] Obtain the diagnostic function instruction, wherein the diagnostic function instruction is a send function instruction, a reply function instruction, or an examination result function instruction;
[0025] When all the initial test results corresponding to the diagnostic function command are successful, the test result is determined to be successful;
[0026] If one of the initial test results corresponding to the diagnostic function instruction fails, then the test result is determined to be a failure.
[0027] Preferably, determining the initial test result corresponding to the diagnostic function command includes:
[0028] When the diagnostic function instruction is the transmission function instruction, the time when the transmission function instruction appears on the CAN bus is recorded. If the time when the transmission function instruction appears is within a first preset time, the transmission indication is determined to be successful. If the time when the transmission function instruction appears exceeds the first preset time, the transmission indication is determined to be unsuccessful.
[0029] When the diagnostic function instruction is the response function instruction, the time when the response function instruction appears is determined. If the time when the response function instruction appears is within a second preset time, the reception instruction is determined to be successful. If the time when the response function instruction appears exceeds the second preset time, the reception instruction is determined to be unsuccessful.
[0030] When the diagnostic function instruction is the examination result function instruction, a response instruction is received, and the response instruction is compared with the expected result parameter of the current test step. If the response instruction is the same as the expected result parameter, the test result is determined to be successful; otherwise, the test result is determined to be unsuccessful.
[0031] Preferably, in the event that the test result fails, the method further includes:
[0032] If the test result fails, the test result is determined to be a failure, and the write test of the test case in the current test project is terminated.
[0033] Correspondingly, in the event that the test result fails, the following also applies:
[0034] If the test result fails, the write test of the test case within the current test project shall be terminated.
[0035] Preferably, after completing the write test of the test steps within the test case, the method further includes:
[0036] Update the execution result of the test case;
[0037] Determine if there are other test cases under the current test project;
[0038] If they exist, return to the step of obtaining the configuration parameters of the current test project and the file to be flashed;
[0039] If it does not exist, then end the flash test for the current test item.
[0040] To address the aforementioned technical problems, the present invention also provides a write test device, comprising:
[0041] The acquisition module is used to obtain the configuration parameters and files to be flashed for the current test project;
[0042] The calling module is used to call the expected result parameter corresponding to the current test step in the configuration parameters, wherein the test case of the file to be written is executed through multiple test steps under the current test project, and the test case is obtained by combining the functional programs corresponding to the multiple test steps according to the configuration parameters, and the functional programs corresponding to the multiple test steps are pre-encapsulated.
[0043] The inspection module is used to inspect the current test step according to the expected result parameters to obtain the inspection result, and if the inspection result is successful, to call the diagnostic function instruction to test the function corresponding to the current test step to obtain the test result.
[0044] The return module is used to, if the test result is successful, take the next test step as the current test step and return to the step of calling the expected result parameter corresponding to the current test step in the configuration parameters, until the write test of the test steps in the test case is completed.
[0045] To address the aforementioned technical problems, the present invention also provides a write test device, comprising:
[0046] Memory, used to store computer programs;
[0047] A processor is used to implement the steps of the flash test method as described above when executing the computer program.
[0048] To address the aforementioned technical problems, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the flashing test method described above.
[0049] This invention provides a flashing test method, comprising: obtaining configuration parameters of the current test project and the file to be flashed; calling the expected result parameter corresponding to the current test step in the configuration parameters, wherein the test cases for the file to be flashed are executed through multiple test steps under the current test project, and the test cases are obtained by combining the functional programs corresponding to the multiple test steps according to the configuration parameters, and the functional programs corresponding to the multiple test steps are pre-encapsulated; verifying the current test step according to the expected result parameter to obtain the verification result, and if the verification result is successful, calling the diagnostic function instruction to test the function corresponding to the current test step to obtain the test result; if the test result is successful, taking the next test step as the current test step, and returning to the step of calling the expected result parameter corresponding to the current test step in the configuration parameters, until the flashing test of the test steps within the test cases is completed. This method separates the configuration parameters from the flashing process, and divides the test process into independent test steps according to each functional program, and combines the functional programs according to the configuration parameters to obtain test cases, so that the test steps are freed from the dependency of the current test project, avoiding the need to redevelop the corresponding flashing process for the existing test project. Furthermore, testers are not required to be familiar with the flashing process, test points, and implementation principles of each test item, reducing the technical skill requirements for testers. Test steps can be programmed based solely on configuration parameters to implement the flashing test process. Additionally, before testing each test step, the expected result parameters are verified. Testing proceeds only if the verification result is successful. The next test step is performed only after the current test step's result is successful, saving testing time, improving the versatility of the flashing test and the efficiency of the entire flashing process, while also increasing the accuracy of the final test results.
[0050] In addition, the present invention also provides a writing test device and medium, which have the same beneficial effects as the writing test method described above. Attached Figure Description
[0051] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 A flowchart of a flashing test method provided in an embodiment of the present invention;
[0053] Figure 2 This is a structural diagram of a brushing test device provided in an embodiment of the present invention;
[0054] Figure 3This is a structural diagram of another brushing test device provided in an embodiment of the present invention;
[0055] Figure 4 A flowchart of another flashing test method provided in an embodiment of the present invention;
[0056] Figure 5 This is a schematic diagram illustrating the application of the write test method provided in an embodiment of the present invention. Detailed Implementation
[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0058] The core of this invention is to provide a brushing test method, device, and medium that saves testing time, improves the efficiency of the entire brushing process, and enhances the accuracy of the final test results.
[0059] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0060] It should be noted that the flashing test method provided by this invention is applicable to testing in the automotive electronics field, and the test products are based on the flashing function of UDS service. UDS service is a standardized diagnostic service, for example, specifying what commands should be sent to the Electronic Control Unit (ECU) to read fault codes, and what commands should be sent to the ECU to read data. The ECU consists of a microcontroller, memory, input / output interfaces, analog-to-digital converters, and large-scale integrated circuits for shaping and driving.
[0061] Figure 1 A flowchart of a flashing test method provided in an embodiment of the present invention is shown below. Figure 1 As shown, the method includes:
[0062] S11: Obtain the configuration parameters and files to be flashed for the current test project;
[0063] S12: Call the expected result parameter corresponding to the current test step in the configuration parameters;
[0064] Among them, the test cases for the files to be written are executed through multiple test steps under the current test project, and the test cases are obtained by combining the functional programs corresponding to multiple test steps according to the configuration parameters. The functional programs corresponding to multiple test steps are pre-encapsulated.
[0065] S13: Verify the current test step according to the expected result parameters to obtain the test result, and determine whether the test result is successful. If so, proceed to step S14.
[0066] S14: Call the diagnostic function command to test the function corresponding to the current test step and obtain the test result. Determine whether the test result is successful. If so, proceed to step S15.
[0067] S15: Set the next test step as the current test step and return to step S12 until the flush test of the test steps in the test case is completed.
[0068] Specifically, software is flashed into the ECU's non-volatile memory through UDS services. These services are not limited and can include routine control services, download request services, data transfer services, and transfer exit request services. Software flashing involves burning the software program into a specific area of the ECU chip's memory, and then the ECU runs the software program to achieve its specific functions. The configuration parameters and the file to be flashed for the current test item are obtained. Relevant configuration parameters from the existing test item are extracted as a configuration file. These configuration parameters can include expected results, relevant parameters in each test step, file storage address, size, and checksum, etc. This embodiment does not impose limitations and can be set according to actual conditions. The file to be flashed is the corresponding ECU flashing file.
[0069] In step S12, before executing the test steps, the expected result parameters corresponding to each test step are called in the configuration parameters. It should be noted that the expected result parameters can be the same or different for different test steps, but the expected result parameters corresponding to the current test step must be called in the configuration parameters before each test step is executed. The test cases for the file to be flashed are executed through multiple test steps under the current test project. That is, the test cases for the file to be flashed are executed according to each test step under the current test project. The test cases contain test steps formed based on the project's flashing process and combined with flashing test points. The functional programs corresponding to each test step under the current test project are pre-encapsulated. The files corresponding to the functional programs are modularized and made independent, so that the test steps in the flashing process have no dependencies, achieving independent connections between logic and the project. For example, a flashing process may have flashing steps such as clearing Flash, requesting data download, transmitting data, and exiting transmission. Each step within the flashing process is made independent, and the functional programs corresponding to the flash clearing step, requesting data download, transmitting data, and exiting transmission are modularized. The existing flashing process requires strict adherence to the current flashing order. However, due to the different parameters of each test project, it needs to be redeveloped and compiled every time it is flashed.
[0070] This embodiment makes each test step independent, extracts the configuration parameters of the test items, and executes the current test case according to the different test steps corresponding to different test items. The test cases are obtained by combining the functional programs based on the configuration parameters of the current test item. For example, the functional programs corresponding to the current flashing process are requesting data download, transmitting data, and exiting transmission, and its corresponding test steps are only three. Each test item has different requirements and implementation functions, and its corresponding test steps are formed by combining modular steps.
[0071] Furthermore, the test points for executing test cases can be forward test points, reverse test points, and corresponding stress test points, without limitation. The forward test points differ from existing forward write operations. Existing forward write operations target file sequence information, while the forward test points in this embodiment target the execution of the test steps of the current test case. Successfully writing a test case can be achieved by listing each step sequentially. Reverse test points include power supply shorting / disconnection, Controller Area Network (CAN) shorting / disconnection, and skipping write steps. Skipping write steps involves removing the steps to be skipped from the previous complete process. Stress testing involves executing thousands of times based on forward or reverse test points for stress detection.
[0072] In step S13, the current test step is tested based on the expected result parameters to obtain the test result. The testing process can be to compare the actual parameters with the expected result parameters. When the comparison is successful, the corresponding test result is also successful; when the comparison fails, the corresponding test result also fails.
[0073] Only if the initial test is successful can the functionality of the test steps be tested. The testing process involves calling various function instructions to obtain test results. The called function instructions are diagnostic instructions. If all diagnostic results are successful, the test result is considered successful; if any one fails, the test result is considered unsuccessful.
[0074] After the current test step is completed, if the test result is successful, the next test step is performed, and the process returns to step S12, until all test steps are completed. It should be noted that if the test result fails, the current test step ends immediately, and subsequent test steps are not executed, confirming the test result as failed.
[0075] This invention provides a flashing test method, comprising: obtaining configuration parameters of the current test project and the file to be flashed; calling the expected result parameter corresponding to the current test step in the configuration parameters, wherein the test cases for the file to be flashed are executed through multiple test steps under the current test project, and the test cases are obtained by combining the functional programs corresponding to the multiple test steps according to the configuration parameters, and the functional programs corresponding to the multiple test steps are pre-encapsulated; verifying the current test step according to the expected result parameter to obtain the verification result, and if the verification result is successful, calling the diagnostic function instruction to test the function corresponding to the current test step to obtain the test result; if the test result is successful, taking the next test step as the current test step, and returning to the step of calling the expected result parameter corresponding to the current test step in the configuration parameters, until the flashing test of the test steps within the test cases is completed. This method separates the configuration parameters from the flashing process, and divides the test process into independent test steps according to each functional program, and combines the functional programs according to the configuration parameters to obtain test cases, so that the test steps are freed from the dependency of the current test project, avoiding the need to redevelop the corresponding flashing process for the existing test project. Furthermore, testers are not required to be familiar with the flashing process, test points, and implementation principles of each test item, reducing the technical skill requirements for testers. Test steps can be programmed based solely on configuration parameters to implement the flashing test process. Additionally, before testing each test step, the expected result parameters are verified. Testing proceeds only if the verification result is successful. The next test step is performed only after the current test step's result is successful, saving testing time, improving the versatility of the flashing test and the efficiency of the entire flashing process, while also increasing the accuracy of the final test results.
[0076] Based on the above embodiments, step S13, which involves verifying the current test step according to the expected result parameters to obtain the test result, includes:
[0077] Get the return result parameters of the current test step, where the return result parameters are the result parameters fed back by the inspection command sent when the current test step is called;
[0078] Compare the expected result parameters corresponding to the current test step with the returned result parameters;
[0079] When the expected result parameter is the same as the returned result parameter, the test result is considered successful.
[0080] If the expected result parameter differs from the returned result parameter, the test result is determined to be a failure.
[0081] Specifically, the return result parameters of the current test step are obtained. These parameters are the check instructions sent by the current test step, and the corresponding response instructions sent based on the received check instructions. Essentially, the return result parameters are the actual parameters before execution in the current test step. The expected result parameters for the current test step are compared with the return result parameters. The comparison process involves comparing each string number by number; if the numbers are different, it indicates that the two parameters are different. The comparison process can also use regular expression matching to speed up the comparison, or other comparison methods can be used; no limitation is made here, and the appropriate method can be set according to the actual situation.
[0082] The test is considered successful if the two parameters are the same, and unsuccessful if they are different.
[0083] The expected result verification process provided in this embodiment judges the current verification result before performing the functional test of the test steps, providing a guarantee for subsequent functional tests. If the verification result fails, the test of the current test item is terminated, so as to save flashing test time and improve flashing test efficiency.
[0084] Based on the above embodiments, step S12, which executes test cases for the file to be written through multiple test steps under the current test project, includes:
[0085] Obtain the test points for the current test project, where the test points are forward test points and / or reverse test points;
[0086] The test steps are written according to the test points to execute the test cases of the file to be written.
[0087] Specifically, this involves obtaining the test points for the current test project. Since stress testing is merely a testing method, it involves repeated testing of each test case under forward or reverse test point conditions. A test point refers to a functional point being tested, primarily containing the functional requirements of the test scenario. It is a general description or rough test of the test scenario, without specific test data. Test points can be marked as passed or failed.
[0088] The test steps are executed according to the test points to run the test cases of the file to be written. When the test point is a forward test point, listing the test steps sequentially can achieve a successful write test case. When the test point is a reverse test point, as an example, the test steps are executed according to the test points to run the test cases of the file to be written, including:
[0089] When the reverse test type is the skipped flush step type, the skipped test steps corresponding to the skipped flush step type are not executed, and the test cases of the file to be flushed are executed for the non-skipped test steps. The non-skipped test steps are the test steps other than the skipped flush step in each test step.
[0090] When the reverse test type is short-circuit / disconnection, protection operations are performed according to the test steps corresponding to the short-circuit / disconnection type. It is understandable that the test types for reverse test points include power short-circuit / disconnection, CAN circuit short-circuit / disconnection, and skipping the flashing step type. In abnormal situations such as power short-circuit / disconnection and CAN circuit short-circuit / disconnection, the corresponding operations are for protecting the flashing process; therefore, these two are combined into the short-circuit / disconnection type.
[0091] When the test type of the reverse test point is "skip flashing steps," the skipped test steps corresponding to this type are not executed, and the test cases for the file to be flashed are executed for the non-skipped test steps. Referring to the example in the above embodiment, a flashing process consists of the flashing steps of clearing Flash, requesting data download, transmitting data, and exiting transmission. If the skipped flashing step is the clear Flash step, then the non-skipped steps are the test steps corresponding to requesting data download, transmitting data, and exiting transmission.
[0092] When the flashing type is short-circuit / disconnection, an automatic operation step is added at the required connection point. In this embodiment, the automatic operation step is an automatic power-off protection operation. If any abnormality is detected in the power supply or CAN line, the power is directly cut off. In existing flashing tests, the operation of the power supply and CAN line requires manual intervention, which makes it difficult to accurately grasp the timing and affects the test results. The automatic operation in this embodiment automates the control of the power supply and CAN line in the test case, achieving precise action and timing control. It should be noted that when the test case performs the short-circuit / disconnection type of the reverse test point, it needs to call RS232 to interact with the CAN bus and power supply voltage, controlling the short-circuit / disconnection of the CAN line, the power input voltage, etc. The RS232 line is only one embodiment; other communication lines can also be used, and are not limited here.
[0093] Correspondingly, power supply and CAN operation tests refer to specific flashing steps during the normal flashing process, such as disconnecting the power supply when the voltage exceeds the limit, short-circuiting the power supply, or short-circuiting or disconnecting the CAN circuit.
[0094] This embodiment provides a method for writing each test step based on the test point. When the test point is a reverse writing test point, each test step is written according to different reverse test types to ensure that the writing process is orderly. At the same time, the shorting and disconnecting types at the reverse test point can achieve precise action control and time control, thereby improving writing efficiency.
[0095] Based on the above embodiments, step S14, which involves calling the diagnostic function instruction to test the function corresponding to the current test step and obtain test results, includes:
[0096] Obtain diagnostic function commands, which may be send function commands, reply function commands, or test result function commands.
[0097] If all initial test results corresponding to the diagnostic function command are successful, the test result is determined to be successful.
[0098] If one of the initial test results corresponding to the diagnostic function command fails, the test result is determined to be a failure.
[0099] Specifically, the diagnostic function commands are sending function commands, replying function commands, or checking result function commands. This embodiment only provides three types. In reality, the diagnostic function commands are not limited to these three types and can also be other diagnostic function commands. This is just one embodiment and can be set according to the actual situation.
[0100] If all initial test results corresponding to the diagnostic function command are successful, the test result is determined to be successful. If any one of the initial test results corresponding to the diagnostic function command fails, the test result is determined to be failed.
[0101] The process of determining the initial test result corresponding to the diagnostic function command, as an example, includes:
[0102] When the diagnostic function command is a transmit function command, the time when the transmit function command appears on the CAN bus is recorded. If the time when the transmit function command appears is within the first preset time, the transmit instruction is determined to be successful. If the time when the transmit function command appears exceeds the first preset time, the transmit instruction is determined to be unsuccessful.
[0103] When the diagnostic function command is a reply function command, determine the time when the reply function command appears. If the reply function command appears within the second preset time, it is determined that the instruction was received successfully. If the reply function command appears beyond the second preset time, it is determined that the instruction was received failed.
[0104] When the diagnostic function command is a check result function command, a response command is received. The response command is compared with the expected result parameter of the current test step. If the response command and the expected result parameter are the same, the test result is determined to be successful. If the response command and the expected result parameter are the same, the test result is determined to be unsuccessful.
[0105] Specifically, when the diagnostic function command is a transmit command, the time when the transmit command appears on the CAN bus needs to be recorded. If this time is within the first preset time, the transmit instruction is considered successful; otherwise, it is considered a failure. The basic transmit function sends out the diagnostic command that needs to be transmitted. When a transmit command appears on the CAN bus, the transmit instruction is marked as successful. If no transmit command appears on the CAN bus within a certain time, a timeout is determined, and the result is marked as a failure.
[0106] When the diagnostic function command is a response command, the time of the response command's appearance is determined. If the response command appears within a second preset time, the reception indication is considered successful; if the response command appears after the second preset time, the reception indication is considered unsuccessful. For the basic reception function, when the ECU responds, the reception indication is marked as successful, and the response content is recorded. If no response is received within a certain time, a timeout is determined, and the result is marked as unsuccessful.
[0107] When the diagnostic function command is a check result function command, a response command is received. This response command is compared with the expected result parameters of the current test step. This comparison is performed on the functional test of the executed test step. The comparison process can be the same as or different from the above embodiment; this embodiment is not limited to this. The basic check response function includes real-time check sending instructions. After successful sending, the receiving instruction is detected in real-time. Upon successful receiving, the recorded response content is compared with the given expected result. If the received response is as expected, the check result indicator is marked as successful; otherwise, the result is marked as failed.
[0108] This embodiment provides a process for calling diagnostic function commands to test the functions corresponding to each test step and obtain the final test results. The sending and receiving functions interact with the CAN bus to achieve sending and receiving.
[0109] If the test result is successful, proceed to step S14. If the test result fails, as an example, the method further includes:
[0110] If the verification result fails, the test result is determined to be a failure, and the flush test of the test case within the current test project is terminated.
[0111] Correspondingly, in the event of a test failure, the following also applies:
[0112] If the test fails, terminate the refresh test of the test steps for the test cases within the current test project.
[0113] Specifically, in order to save testing time and ensure accuracy, the test results are checked before the test steps are executed. If the test results fail, even if the corresponding functional tests are performed in the subsequent test steps, the test effect corresponding to the current flashing process will also fail. Therefore, if the current test results fail, the test result is determined to be failed, and the flashing test of the current test item is terminated, and the execution of the current test step is also terminated.
[0114] In addition, if the verification result is successful, the execution of the current test step will end if the test result fails.
[0115] This embodiment provides a method to determine the test result as a failure and terminate the test step writing test of the test case within the current test project when the test result fails; in the case of test result failure, the test step writing test of the test case within the current test project is terminated, saving detection time and improving testing efficiency.
[0116] Based on the above embodiments,
[0117] After completing the flash test of the test steps within the test case, the following is also included:
[0118] Update the execution result of the test case;
[0119] Determine if there are other test cases under the current test project;
[0120] If they exist, return to the step of obtaining the configuration parameters of the current test project and the file to be flashed;
[0121] If it does not exist, then end the flash test for the current test item.
[0122] Specifically, after obtaining the test results, the execution results of the test cases are updated. It is also necessary to determine whether there are any test cases to be executed later. If there are, the process returns to step S12 to continue execution. If there are no test cases, the current test project's write test ends.
[0123] The execution results of the updated test cases provided in this embodiment are used as test markers to avoid repeated updates of existing unmarked test cases, which would lead to low test efficiency.
[0124] The foregoing has described in detail various embodiments corresponding to the write test method. Based on this, the present invention also discloses a write test apparatus corresponding to the above method. Figure 2 This is a structural diagram of a brushing test device provided in an embodiment of the present invention. Figure 2 As shown, the write test device includes:
[0125] Module 11 is used to obtain the configuration parameters and files to be flashed for the current test project.
[0126] The module 12 is used to call the expected result parameter corresponding to the current test step in the configuration parameters, wherein the test case of the file to be written is executed through multiple test steps under the current test project, and the test case is obtained by combining the functional programs corresponding to the multiple test steps according to the configuration parameters, and the functional programs corresponding to the multiple test steps are pre-encapsulated.
[0127] The inspection module 13 is used to inspect the current test step according to the expected result parameters to obtain the inspection result, and if the inspection result is successful, to call the diagnostic function instruction to test the function corresponding to the current test step to obtain the test result.
[0128] The return module 14 is used to, if the test result is successful, take the next test step as the current test step and return to the step of calling the expected result parameter corresponding to the current test step in the configuration parameters, until the write test of the test steps in the test case is completed.
[0129] Since the embodiments of the device part correspond to the embodiments described above, please refer to the embodiments described in the method part for the embodiments of the device part, and will not be repeated here.
[0130] For an introduction to the brushing test device provided by the present invention, please refer to the above method embodiments. The present invention will not be described in detail here, but it has the same beneficial effects as the above brushing test method.
[0131] Figure 3 This is a structural diagram of another brushing test device provided in an embodiment of the present invention, as shown below. Figure 3 As shown, the device includes:
[0132] Memory 21 is used to store computer programs;
[0133] Processor 22 is used to implement the steps of the write test method when executing computer programs.
[0134] The flashing test device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.
[0135] The processor 22 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 22 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 22 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 22 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 22 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.
[0136] The memory 21 may include one or more computer-readable storage media, which may be non-transitory. The memory 21 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 21 is used to store at least the following computer program 211, which, after being loaded and executed by the processor 22, is capable of implementing the relevant steps of the flashing test method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 21 may also include an operating system 212 and data 213, etc., and the storage method may be temporary storage or permanent storage. The operating system 212 may include Windows, Unix, Linux, etc. The data 213 may include, but is not limited to, the data involved in the flashing test method, etc.
[0137] In some embodiments, the write test device may further include a display screen 23, an input / output interface 24, a communication interface 25, a power supply 26, and a communication bus 27.
[0138] Those skilled in the field can understand, Figure 3 The structure shown does not constitute a limitation on the write test apparatus and may include more or fewer components than illustrated.
[0139] The processor 22 implements the flash test method provided in any of the above embodiments by calling the instructions stored in the memory 21.
[0140] For an introduction to the brushing test device provided by the present invention, please refer to the above method embodiments. The present invention will not be described in detail here, but it has the same beneficial effects as the above brushing test method.
[0141] Furthermore, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by processor 22, implements the steps of the above-described flashing test method.
[0142] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0143] For an introduction to the computer-readable storage medium provided by the present invention, please refer to the above method embodiments. The present invention will not be described in detail here, but it has the same beneficial effects as the above-described brush and write test method.
[0144] As one example, Figure 4 A flowchart of another flashing test method provided in an embodiment of the present invention is shown below. Figure 4 As shown, it includes:
[0145] S21: Read the project flashing configuration file and read the flashing file;
[0146] S22: Start executing the test cases;
[0147] S23: Call the function of the current write step and pass the expected result;
[0148] S24: Determine whether the current result is successful. If successful, proceed to step S25; if unsuccessful, proceed to step S30.
[0149] S25: Call the diagnostic command sending function, diagnostic response receiving function, and examination result function;
[0150] S26: Determine whether the instruction information corresponding to the diagnostic instruction sending function, diagnostic response receiving function, and inspection result function is successful. If successful, proceed to step S27; if unsuccessful, proceed to step S28.
[0151] S27: The current result indicates success;
[0152] S28: The current result indicates failure;
[0153] S29: Determine if there is a subsequent flashing test step. If it exists, return to step S23; otherwise, proceed to step S30.
[0154] S30: Update test results;
[0155] S31: Determine if there are test cases for subsequent flashing. If they exist, return to step S22; otherwise, end the process.
[0156] Figure 5 This is an application diagram of the write test method provided in the embodiments of the present invention, such as... Figure 5 As shown, the project configuration file and flashing process configure the execution of test cases. The test cases are located within the test case module. The testing process of the test cases requires interaction with the CAN bus. The interaction process involves calling the send function, receive function, and short-circuit / open-circuit function of the RS232 module. The test case module calls the RS232 module, which interacts with the CAN bus, power supply voltage, and controls the short-circuit / open-circuit of the CAN line, power input voltage, etc.
[0157] For a flowchart and application diagram of another brushing test method provided by the present invention, please refer to the above method embodiments. The present invention will not be described again here, but it has the same beneficial effects as the above brushing test method.
[0158] The foregoing has provided a detailed description of the write test method, write test apparatus, and medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
[0159] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A flashing test method, characterized in that, include: Get the configuration parameters and files to be flashed for the current test project; The expected result parameter corresponding to the current test step is called in the configuration parameters. The test case of the file to be written is executed through multiple test steps under the current test project. The test case is obtained by combining the functional programs corresponding to the multiple test steps according to the configuration parameters. The functional programs corresponding to the multiple test steps are pre-encapsulated. Modularize and isolate the files corresponding to the functional programs, so that the test steps in the flashing process have no dependency relationship, and realize the independent connection between logic and project; The current test step is tested according to the expected result parameters to obtain the test result. If the test result is successful, the diagnostic function instruction is called to test the function corresponding to the current test step to obtain the test result. If the test result is successful, the next test step is taken as the current test step, and the process returns to the step of calling the expected result parameter corresponding to the current test step in the configuration parameters, until the write test of the test steps in the test case is completed. Correspondingly, the test cases for the file to be written are executed through multiple test steps under the current test project, including: Obtain the test points of the current test item, wherein the test points are forward test points and / or reverse test points; The test steps are written according to the test points to execute the test cases of the file to be written. Correspondingly, when the test point is the reverse test point, the step of writing each of the test steps according to the test point to execute the test cases of the file to be written includes: Obtain the reverse test type of the reverse test point, wherein the test type of the reverse test point includes either the skip-write step type or the short-circuit disconnect type; When the reverse test type is the skipped flashing step type, the skipped test steps corresponding to the skipped flashing step type are not executed, and the test cases of the file to be flashed are executed for the non-skipped test steps, wherein the non-skipped test steps are the test steps other than the skipped flashing steps in each of the test steps. When the reverse test type is the short-circuit / disconnection type, protection operation processing is performed according to the test steps corresponding to the short-circuit / disconnection type.
2. The write test method according to claim 1, characterized in that, The step of verifying the current test step based on the expected result parameter to obtain the verification result includes: Obtain the return result parameter of the current test step, wherein the return result parameter is the result parameter fed back by the inspection instruction sent when the current test step is called; Compare the expected result parameters corresponding to the current test step with the returned result parameters; When the expected result parameter is the same as the returned result parameter, the test result is determined to be successful. If the expected result parameter is different from the returned result parameter, the test result is determined to be a failure.
3. The write test method according to claim 1 or 2, characterized in that, The method of invoking the diagnostic function command to test the function corresponding to the current test step and obtain the test result includes: Obtain the diagnostic function instruction, wherein the diagnostic function instruction is a send function instruction, a reply function instruction, or an examination result function instruction; When all the initial test results corresponding to the diagnostic function command are successful, the test result is determined to be successful; If one of the initial test results corresponding to the diagnostic function instruction fails, then the test result is determined to be a failure.
4. The write test method according to claim 3, characterized in that, Determining the initial test result corresponding to the diagnostic function command includes: When the diagnostic function instruction is the transmission function instruction, the time when the transmission function instruction appears on the CAN bus is recorded. If the time when the transmission function instruction appears is within a first preset time, the transmission indication is determined to be successful. If the time when the transmission function instruction appears exceeds the first preset time, the transmission indication is determined to be unsuccessful. When the diagnostic function instruction is the response function instruction, the time when the response function instruction appears is determined. If the time when the response function instruction appears is within a second preset time, the reception instruction is determined to be successful. If the time when the response function instruction appears exceeds the second preset time, the reception instruction is determined to be unsuccessful. When the diagnostic function instruction is the examination result function instruction, a response instruction is received, and the response instruction is compared with the expected result parameter of the current test step. If the response instruction is the same as the expected result parameter, the test result is determined to be successful; otherwise, the test result is determined to be unsuccessful.
5. The write test method according to claim 4, characterized in that, In the event that the test result fails, the method further includes: If the test result fails, the test result is determined to be a failure, and the write test of the test case in the current test project is terminated. Correspondingly, in the event that the test result fails, the following also applies: If the test result fails, the write test of the test case within the current test project shall be terminated.
6. The write test method according to claim 5, characterized in that, After completing the flash test of the test steps within the test case, the following is also included: Update the execution results of the test cases; Determine if there are other test cases under the current test project; If they exist, return to the step of obtaining the configuration parameters of the current test project and the file to be flashed; If it does not exist, then end the flash test for the current test item.
7. A write test device, characterized in that, include: The acquisition module is used to obtain the configuration parameters and files to be flashed for the current test project; The calling module is used to call the expected result parameter corresponding to the current test step in the configuration parameters, wherein the test case of the file to be written is executed through multiple test steps under the current test project, and the test case is obtained by combining the functional programs corresponding to the multiple test steps according to the configuration parameters, and the functional programs corresponding to the multiple test steps are pre-encapsulated. Modularize and isolate the files corresponding to the functional programs, so that the test steps in the flashing process have no dependency relationship, and realize the independent connection between logic and project; The inspection module is used to inspect the current test step according to the expected result parameters to obtain the inspection result, and if the inspection result is successful, to call the diagnostic function instruction to test the function corresponding to the current test step to obtain the test result. The return module is used to, if the test result is successful, take the next test step as the current test step and return to the step of calling the expected result parameter corresponding to the current test step in the configuration parameters, until the write test of the test steps in the test case is completed; Correspondingly, the test cases for the file to be written are executed through multiple test steps under the current test project, including: Obtain the test points of the current test item, wherein the test points are forward test points and / or reverse test points; The test steps are written according to the test points to execute the test cases of the file to be written. Correspondingly, when the test point is the reverse test point, the step of writing each of the test steps according to the test point to execute the test cases of the file to be written includes: Obtain the reverse test type of the reverse test point, wherein the test type of the reverse test point includes either the skip-write step type or the short-circuit disconnect type; When the reverse test type is the skipped flashing step type, the skipped test steps corresponding to the skipped flashing step type are not executed, and the test cases of the file to be flashed are executed for the non-skipped test steps, wherein the non-skipped test steps are the test steps other than the skipped flashing steps in each of the test steps. When the reverse test type is the short-circuit / disconnection type, protection operation processing is performed according to the test steps corresponding to the short-circuit / disconnection type.
8. A write test device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the write test method as described in any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the write test method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device used for automatically flashing and testing automobile ECU programs
CN106874055A