A test method and device based on an AUTOSAR platform, an electronic device, and a storage medium

By acquiring test text and target code on the AUTOSAR platform and using automated tools to generate and run executable files, the problem of low efficiency in integration testing is solved, and the error target code can be quickly located, thus improving testing efficiency.

CN115168232BActive Publication Date: 2026-05-12CHINA AUTOMOTIVE INNOVATION CORP
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA AUTOMOTIVE INNOVATION CORP
Filing Date
2022-07-28
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In integration testing based on the AUTOSAR platform, the huge number of test cases leads to low efficiency in manually executing integration tests, slow progress in regression testing, and difficulty in quickly locating problem points.

Method used

This paper presents a testing method based on the AUTOSAR platform. By acquiring test text, identifying target code, generating an executable file using an automated integrated environment scheduling tool, and automatically running the target microcontroller based on the test environment script, the predicted and actual execution results are compared to quickly locate errors.

Benefits of technology

It automates testing on the AUTOSAR platform, improves testing efficiency, enables rapid location of erroneous target code, and saves manpower and time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115168232B_ABST
    Figure CN115168232B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a test method based on an AUTOSAR platform, the method comprising: obtaining a test text, the test text comprising at least one assertion and at least one function description information, the assertion being used to indicate a predicted execution result of the function description information corresponding to the assertion; determining target code corresponding to the test text, the target code being used to implement functions indicated by the function description information; generating an executable file according to the target code based on an automated integrated environment scheduling tool, and downloading the executable file into a target single-chip microcomputer; automatically running the target single-chip microcomputer based on a test environment script to obtain a test result, the test result comprising the predicted execution result and an actual execution result of the at least one function description information. The present disclosure can automatically execute the target code to obtain the test result through the automated integrated environment scheduling tool and the test environment script.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automotive electronic integration testing technology, and in particular to a testing method, apparatus, electronic device, and storage medium based on the AUTOSAR platform. Background Technology

[0002] AUTOSAR (Automotive Open System Architecture) is a collaborative development framework for automotive electronic systems, involving global automakers, component suppliers, and various research and service organizations. It establishes an open standard software architecture for vehicle electronic control units (ECUs). Basic software development based on the AUTOSAR platform involves numerous software functional requirements and standard definitions. During integration testing, the sheer number of test cases leads to a significant increase in testing workload, making manual integration testing difficult and inefficient, and resulting in frequent problems during development. How to quickly perform regression testing, how to automate the execution of a large number of test cases, and how to rapidly locate problem points are urgent technical challenges that need to be addressed. Summary of the Invention

[0003] To address at least one of the aforementioned technical problems, this disclosure provides a testing method, apparatus, electronic device, and storage medium based on the AUTOSAR platform.

[0004] On the one hand, this disclosure provides a testing method based on the AUTOSAR platform, the method including:

[0005] Obtain test text, which includes at least one assertion and at least one functional description, wherein the assertion is used to indicate the predicted execution result corresponding to the functional description of the assertion;

[0006] Determine the target code corresponding to the test text. The target code is used to implement the functions indicated by the functional description information.

[0007] Based on the automated integrated environment scheduling tool, an executable file is generated from the target code and downloaded to the target microcontroller;

[0008] Based on the test environment script, the target microcontroller is automatically run to obtain test results. The test results include the predicted execution result and the actual execution result corresponding to at least one functional description.

[0009] In an optional embodiment, generating an executable file from the target code includes:

[0010] The test project is integrated based on the target code and test text, and the test project can be compiled and executed.

[0011] Compile and test the project to generate an executable file.

[0012] In an optional embodiment, determining the target code corresponding to the test text includes:

[0013] Based on the test text, configuration files and static code are generated. The configuration files represent the configuration information of the vehicle's electronic control unit, and the static code is used to determine the implementation method of each function description information.

[0014] The target code is obtained based on the configuration file and static code.

[0015] In an optional embodiment, the target code is obtained based on the configuration file and static code, including:

[0016] The configuration tool provides the configuration code corresponding to the configuration file.

[0017] Determine the target code based on the configuration code and static code.

[0018] In an optional embodiment, a configuration tool is used to obtain the configuration code corresponding to the configuration file, including:

[0019] Determine the configuration options for the configuration tool;

[0020] In response to the complete configuration of configuration items, generate configuration code.

[0021] In an optional embodiment, the target microcontroller is automatically run based on a test environment script to obtain test results, including:

[0022] Based on the test environment script, simulate the test environment required for the target microcontroller to run;

[0023] Based on the test environment, the target microcontroller is run automatically to obtain test results.

[0024] Secondly, the present invention also provides a testing device based on the AUTOSAR platform, comprising:

[0025] The acquisition module is used to acquire test text, which includes at least one assertion and at least one functional description information. The assertion is used to indicate the predicted execution result corresponding to the functional description information of the assertion.

[0026] The target code determination module is used to determine the target code corresponding to the test text. The target code is used to implement the functions indicated by the functional description information.

[0027] The executable file generation module is used to generate an executable file based on the target code using an automated integration environment scheduling tool, and then download the executable file to the target microcontroller.

[0028] The testing module is used to automatically run the target microcontroller based on the test environment script and obtain the test results. The test results include the predicted execution result and the actual execution result corresponding to at least one functional description information.

[0029] Thirdly, the present invention also provides an electronic device, comprising:

[0030] processor;

[0031] Memory used to store processor-executable instructions;

[0032] The processor is used to execute instructions to implement the aforementioned test method based on the AUTOSAR platform.

[0033] Fourthly, the present invention also provides a storage medium that, when the instructions in the storage medium are executed by the processor of an electronic device, enables the electronic device to perform the above-described tests based on the AUTOSAR platform.

[0034] Fifthly, the present invention also provides a computer program product comprising a computer program stored in a readable storage medium, wherein at least one processor of a computer device reads from the readable storage medium and executes the computer program, causing the device to perform the aforementioned test method based on the AUTOSAR platform.

[0035] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure.

[0036] Implementing this disclosure will have the following beneficial effects:

[0037] Obtain test text, which includes at least one assertion and at least one functional description. The assertion indicates the predicted execution result corresponding to the functional description. Determine the target code corresponding to the test text, which implements the function indicated by each functional description. Based on an automated integration environment scheduling tool, generate an executable file from the target code and download the executable file to the target microcontroller. Based on a test environment script, automatically run the target microcontroller to obtain test results, which include the predicted execution result corresponding to at least one functional description and the actual execution result.

[0038] This application, by determining the target code corresponding to the test text, enables the implementation of the functions indicated by the functional description information in the test text. Through an automated integrated scheduling tool, an executable file is automatically generated based on the target code. By writing the test environment text, the target microcontroller carrying the executable file is automatically run. The generation and execution of the target code are automated, saving a significant amount of manpower in the target code generation and execution process. By comparing the predicted execution result corresponding to at least one functional description information in the test results with the actual execution result, if the actual execution result does not match the predicted execution result, it is possible to quickly determine that there is an error in the generated target code, effectively improving the efficiency of AUTOSAR platform testing.

[0039] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0040] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The accompanying drawings are incorporated in and constitute a part of this specification, illustrating embodiments consistent with this disclosure, and are used together with the description to explain the principles of this disclosure, and do not constitute an improper limitation of this disclosure.

[0041] Figure 1 This is a schematic diagram of an implementation environment according to an exemplary embodiment;

[0042] Figure 2 This is a flowchart illustrating a testing method based on the AUTOSAR platform according to an exemplary embodiment;

[0043] Figure 3 This is a flowchart illustrating the determination of target code according to an exemplary embodiment;

[0044] Figure 4 This is a flowchart illustrating an embodiment of obtaining target code from a configuration file and static code;

[0045] Figure 5 This is a flowchart illustrating, according to an exemplary embodiment, a method for obtaining configuration code corresponding to a configuration file using a configuration tool;

[0046] Figure 6 This is a flowchart illustrating an example of generating an executable file from object code;

[0047] Figure 7 This is a schematic diagram illustrating functional description information according to an exemplary embodiment;

[0048] Figure 8 This is a block diagram of a test apparatus based on an AUTOSAR platform, according to an exemplary embodiment.

[0049] Figure 9 This is a block diagram illustrating an electronic device for testing based on an AUTOSAR platform, according to an exemplary embodiment. Detailed Implementation

[0050] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0051] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0052] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. Like reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise. The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0053] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0054] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.

[0055] In related technologies, integration testing based on the AUTOSAR platform uses a huge number of test cases, and most of them are executed manually. This process is inefficient, regression testing is slow, and when problems occur, technicians cannot quickly locate the problem.

[0056] To enable rapid regression testing and automate the execution of numerous test cases, allowing technical personnel to quickly pinpoint the problem, this disclosure provides a testing method based on the AUTOSAR platform.

[0057] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application environment according to an exemplary embodiment, such as... Figure 1 As shown, the application environment may include server 01 and terminal 02.

[0058] In an optional embodiment, server 01 can be used for computational processing based on the AUTOSAR platform's testing methods. Specifically, server 01 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0059] In an optional embodiment, terminal 02 can perform computational processing in conjunction with the AUTOSAR-based testing method of server 01. Specifically, terminal 02 can be, but is not limited to, electronic devices such as smartphones, desktop computers, tablets, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, and smart wearable devices. Optionally, the operating system running on the electronic device can be, but is not limited to, Android, iOS, Linux, Windows, and Unix systems.

[0060] For example, test text is input on terminal 02, and server 01 obtains the test text from terminal 02; then, the target code corresponding to the test text is determined, and the target code is used to implement the functions indicated by the functional description information; based on the automated integration environment scheduling tool, an executable file is generated according to the target code, and the executable file is downloaded to the target microcontroller; based on the test environment script, the target microcontroller is automatically run to obtain test results, which include the predicted execution result and the actual execution result corresponding to at least one functional description information; finally, the test results are transmitted to terminal 02.

[0061] In addition, it should be noted that, Figure 1 The example shown is merely one application environment provided by this disclosure; in practical applications, other application environments may also be included.

[0062] In the embodiments described in this specification, the server 01 and the terminal 02 can be directly or indirectly connected through wired or wireless communication, and this disclosure does not impose any restrictions.

[0063] Figure 2 This is a flowchart illustrating a testing method based on an AUTOSAR platform according to an exemplary embodiment, such as... Figure 2 As shown, the testing methods based on the AUTOSAR platform include the following:

[0064] Step S201: Obtain test text, which includes at least one assertion and at least one functional description information. The assertion is used to indicate the predicted execution result corresponding to the functional description information of the assertion.

[0065] In this embodiment, the test text can be obtained by writing test text based on software usage requirements, and the written test text conforms to the AUTOSAR platform design specifications. The test text includes at least one assertion and at least one functional description. Test code is written for each functional description in the test text, with each functional description distinguished by a number, and a corresponding assertion is added. The assertion indicates the predicted execution result of the functional description corresponding to the assertion. By associating the predicted execution result with the corresponding functional description number through the assertions, the location of the problem can be quickly identified.

[0066] Step S202: Determine the target code corresponding to the test text. The target code is used to implement the functions indicated by the function description information.

[0067] In this embodiment of the disclosure, the target code consists of two parts: one part is static code developed based on the AUTOSAR specification, and the other part is configuration code developed by configuration tools, such as toolchains, through a human-computer interaction interface. Figure 3 This is a flowchart illustrating the determination of target code according to an exemplary embodiment, such as... Figure 3 As shown, the target code corresponding to the test text is determined, including the following:

[0068] Step S2021: Generate configuration files and static code based on the test text. The configuration files represent the configuration information of the vehicle's electronic control unit, and the static code is used to determine the implementation method of each function description information.

[0069] In this embodiment, the test text contains at least one functional description. Implementing this at least one functional description requires specifying the configuration information of the vehicle electronic control unit corresponding to that at least one functional description, as well as the implementation method of each functional description. The AUTOSAR platform can generate a configuration file with the .arxml extension based on the test text. This configuration file contains the configuration information of the vehicle electronic control unit, which is determined by the OEM or component supplier's design requirements for the vehicle electronic control unit's basic software. Static code is used to specify the implementation method of the functions indicated by each functional description, such as the processing of logical algorithms and the maintenance or transition of state machines. Static code under the AUTOSAR architecture is immutable code.

[0070] Step S2022: Obtain the target code based on the configuration file and static code.

[0071] Based on the above, this embodiment of the present disclosure can determine the configuration information of the vehicle electronic control unit and the implementation method of each function description information by generating configuration files and static code based on test text, thus laying the foundation for the generation of target code. The target code obtained through configuration files and static code can meet the design requirements of OEMs or component suppliers for the basic software of vehicle electronic control units and limit the implementation method of functions.

[0072] Figure 4 This is a flowchart illustrating an exemplary embodiment of obtaining target code from a configuration file and static code, such as... Figure 4 As shown, based on the configuration file and static code, the target code is obtained, including the following:

[0073] Step S401: Obtain the configuration code corresponding to the configuration file using the configuration tool.

[0074] Figure 5 This is a flowchart illustrating, according to an exemplary embodiment, how a configuration tool obtains configuration code corresponding to a configuration file. Figure 5 As shown, the configuration tool generates the configuration code corresponding to the configuration file, including the following:

[0075] Step S4011: Determine the configuration items of the configuration tool.

[0076] In this embodiment, the configuration tool is a toolchain built into the AUTOSAR platform, which can develop configuration code through a human-machine interface. Before the toolchain automatically develops the configuration code, the configuration items required for developing the configuration code need to be defined. The configuration items limit the specific parameters of the functional implementation method indicated by the static code. The configuration file is imported into the toolchain, and the configuration code is generated after the configuration items in the toolchain are configured. The configuration items depend on the requirements of the vehicle's electronic control unit. Some configuration items are automatically configured by the toolchain, while others need to be manually configured. Configuration items that are incorrectly configured automatically can also be corrected manually. Optionally, the configuration items that are automatically configured include CAN node information, signals, messages, CAN communication frame IDs, etc., while the configuration items that are manually configured include adjusting data types, data mapping between data and signals, etc.

[0077] Step S4012: In response to the complete configuration of the configuration items, generate configuration code.

[0078] In this embodiment of the disclosure, when the configuration items of the configuration tool are fully configured, the configuration tool can generate corresponding configuration code based on the imported configuration file. The configuration code is a variable, dynamic code used to fulfill the configuration requirements of the vehicle's electronic control unit.

[0079] As can be seen from the above, by importing the configuration file into the configuration tool, the embodiments of this disclosure can automatically determine some configuration items of the configuration tool, saving a lot of configuration time. By manually configuring some configuration items, configuration errors and configuration items that cannot be automatically configured in the automatic configuration items can be completed, thus making up for the loopholes in automatic configuration. The configuration code generated when the configuration items of the configuration tool are fully configured can meet the configuration requirements of the vehicle electronic control unit.

[0080] Step S402: Determine the target code based on the configuration code and static code.

[0081] In this embodiment of the disclosure, the target code is obtained by combining the configuration code generated by the configuration tool with the static code.

[0082] As can be seen from the above, the embodiments of this disclosure can automatically obtain the configuration code corresponding to the configuration file by configuring the configuration tool, saving a lot of time required in the code writing process and improving testing efficiency; the target code determined by the configuration code and static code can also meet the implementation method of the function and the configuration requirements of the vehicle electronic control unit.

[0083] Step S203: Based on the automated integration environment scheduling tool, generate an executable file from the target code and download the executable file to the target microcontroller.

[0084] In this embodiment, the automated integration environment scheduling tool is Jenkins. Jenkins is an open-source software project, a continuous integration tool developed based on Java, used to monitor repetitive tasks. It aims to provide an open and easy-to-use software platform that enables continuous software integration. All steps included in this embodiment are executed in a pipeline under Jenkins scheduling. Figure 6 This is a flowchart illustrating a method for generating an executable file from object code according to an exemplary embodiment, such as... Figure 6 As shown, an executable file is generated from the target code, including the following:

[0085] Step S2031: Integrate the test project based on the target code and test text. The test project can be compiled and executed.

[0086] In this embodiment of the disclosure, the test text and target code are combined in the same project to form a test project, which can be compiled and executed.

[0087] Step S2032: Compile the test project to generate an executable file.

[0088] In this embodiment of the disclosure, the test project formed by the above steps is compiled to obtain an executable file with the extension .elf. This file is used to execute in the microcontroller to implement the function indicated by the function description information.

[0089] As can be seen from the above, this embodiment of the present disclosure combines the target code and the test text to achieve integrated testing of the target code and the test text, completes the establishment of a compilable test project, implements the test project by compiling the test project, completes the initial execution of the target code, and obtains an executable file corresponding to the target code, laying the foundation for the subsequent execution of the target code.

[0090] Step S204: Based on the test environment script, automatically run the target microcontroller and obtain the test results. The test results include the predicted execution result and the actual execution result corresponding to at least one function description information.

[0091] In this embodiment of the disclosure, the target microcontroller is automatically run based on a test environment script to obtain test results, including the following:

[0092] Step S2041: Based on the test environment script, simulate the test environment required for the target microcontroller to run.

[0093] In this embodiment of the disclosure, the test environment script can be a written CANOE CAPL script. By running the CANOE CAPL script, the signals required for the operation of the target microcontroller can be simulated, and the signals sent by the target microcontroller can be received. The script can also make judgments on the received signals and send feedback signals corresponding to the signals, thereby creating a test environment for the operation of the target microcontroller.

[0094] Step S2042: Based on the test environment, automatically run the target microcontroller and obtain the test results.

[0095] In this embodiment of the disclosure, the target microcontroller can be automatically run and test results obtained through a simulated test environment. Optionally, the target microcontroller can be an MCU TC297. The executable file is burned to the MCU TC297 and run to obtain test results. Optionally, this embodiment of the disclosure can print out the test results through assertions. By binding the labels of the functional description information in the test results, the corresponding predicted execution results, and the actual execution results, the results can be quickly compared.

[0096] Optionally, if the actual execution result does not match the predicted execution result, it can be determined that the target code corresponding to the actual execution result has an error. After identifying the erroneous target code, by checking whether the erroneous target code conforms to the platform specification requirements, or whether the configuration items of the configuration tool corresponding to the erroneous target code are configured correctly, the cause of the erroneous target code can be determined. This process avoids checking code or configuration items unrelated to the erroneous target code, further saving the time required to troubleshoot the problem and improving testing efficiency.

[0097] As can be seen from the above, by writing test environment scripts, this embodiment can simulate the signals required for the operation of the target microcontroller, process and judge the signals fed back by the target microcontroller, and thus simulate the environment required for the automated operation of the target microcontroller, thereby realizing the automated operation of the target microcontroller. On this basis, by printing the test results of the target microcontroller's operation, the predicted execution results can be quickly compared with the actual execution results, the error location can be locked, and the erroneous target code can be quickly identified, saving a lot of time required to find the problem.

[0098] In the above embodiments, this disclosure, by generating configuration files and static code based on test text, can determine the configuration information and implementation methods of each function description information of the vehicle electronic control unit, laying the foundation for the generation of target code. The target code obtained through configuration files and static code can meet the design requirements of OEMs or component suppliers for the basic software of the vehicle electronic control unit and limit the implementation methods of functions. By configuring the configuration tool, the configuration code corresponding to the configuration file can be automatically obtained, saving a lot of time required in the code writing process. By combining the target code and test text, a compilable test project is established. Through compiling the test project, the initial execution of the target code is completed, and an executable file corresponding to the target code is obtained, laying the foundation for the subsequent execution of the target code. By writing test environment scripts, the environment required for the automated operation of the target microcontroller can be simulated, realizing the automated operation of the target microcontroller. On this basis, by printing the test results of the target microcontroller's operation, the predicted execution results can be quickly compared with the actual execution results, the error location can be locked, and the erroneous target code can be quickly identified.

[0099] In one specific implementation method, the technical solution of this application is implemented as follows:

[0100] Obtain test text, which includes at least one assertion and at least one functional description, whereby the assertion is used to indicate the predicted execution result corresponding to the functional description.

[0101] The above implementation process includes: obtaining test texts can be done by writing test texts based on software usage requirements, and the written test texts must conform to the AUTOSAR platform design specifications. The test texts include at least one assertion and at least one functional description. Test code is written for each functional description in the test texts, and each functional description is distinguished by a number. For example... Figure 7 The diagram illustrates a functional description information according to an exemplary embodiment. The AUTOSAR specification defines the various functional description information that a component needs to implement using SWS numbers. Taking the CAN communication protocol as an example, the diagram defines four different functional description information under the labels "CanTp_00168", "CanTp_00169", "CanTp_00170", and "CanTp_00238". The function defined by "CanTp_00168" is: after power-on, the CanTp module should be in the CanTp_off state. The test text also includes corresponding assertions and predicted execution results. Assertions indicate the predicted execution results corresponding to the functional description information. By associating the predicted execution results with the corresponding functional description information numbers through assertions, the problem can be quickly located.

[0102] Identify the target code corresponding to the test text. The target code is used to implement the functions indicated by the functional description information.

[0103] The target code consists of two parts: static code developed based on the AUTOSAR specification and configuration code developed through a human-computer interaction interface using configuration tools, such as toolchains. The implementation process includes:

[0104] Based on the test text, configuration files and static code are generated. The configuration files represent the configuration information of the vehicle's electronic control unit, and the static code is used to determine how each function description is implemented.

[0105] The above implementation process includes: the test text contains at least one functional description. Implementing at least one functional description requires specifying the configuration information of the vehicle electronic control unit corresponding to that functional description, as well as the implementation method of each functional description. The AUTOSAR platform can generate a configuration file with the .arxml extension, such as DBC.arxml, based on the test text. This configuration file contains the configuration information of the vehicle electronic control unit, which is determined by the OEM or component supplier's design requirements for the vehicle electronic control unit's basic software. Static code is used to specify the implementation method of the functions indicated by each functional description, including the processing of logical algorithms and the maintenance or transition of state machines. Static code under the AUTOSAR architecture is immutable.

[0106] Based on the above, this embodiment of the present disclosure can determine the configuration information of the vehicle electronic control unit and the implementation method of each function description information by generating configuration files and static code based on test text, thus laying the foundation for the generation of target code. The target code obtained through configuration files and static code can meet the design requirements of OEMs or component suppliers for the basic software of vehicle electronic control units and limit the implementation method of functions.

[0107] The target code is obtained based on the configuration file and static code.

[0108] The above implementation process includes the following:

[0109] The configuration tool provides the configuration code corresponding to the configuration file.

[0110] The above implementation process includes the following:

[0111] Determine the configuration options for the configuration tool.

[0112] The above implementation process includes the following: The configuration tool is the toolchain provided with the AUTOSAR platform. The toolchain can develop configuration code through a human-machine interface. Before the toolchain automatically develops the configuration code, the configuration items required for developing the configuration code need to be clearly defined. These configuration items specify the concrete parameters defining the functional implementation method indicated by the static code. The configuration file is imported into the toolchain, and after the toolchain configuration items are configured, the configuration code is generated. The configuration items depend on the requirements of the vehicle's electronic control unit; some configuration items are automatically configured by the toolchain, while others require manual configuration. Taking the CAN communication protocol as an example, automatically configured configuration items include CAN node information, signals, messages, CAN communication frame IDs, etc., while manually configured configuration items include adjusting data types and data mapping between data and signals, etc.

[0113] In response to the complete configuration of configuration items, generate configuration code.

[0114] The above implementation process includes the following: Once the configuration items in the configuration tool are fully configured, the configuration tool can generate corresponding configuration code based on the imported configuration file. The configuration code is a variable, dynamic code used to fulfill the configuration requirements of the vehicle's electronic control unit.

[0115] As can be seen from the above, by importing the configuration file into the configuration tool, the embodiments of this disclosure can automatically determine some configuration items of the configuration tool, saving a lot of configuration time. By manually configuring some configuration items, configuration errors and configuration items that cannot be automatically configured in the automatic configuration items can be completed, thus making up for the loopholes in automatic configuration. The configuration code generated when the configuration items of the configuration tool are fully configured can meet the configuration requirements of the vehicle electronic control unit.

[0116] Determine the target code based on the configuration code and static code.

[0117] The above implementation process includes the following: combining the configuration code generated by the configuration tool with the static code to obtain the target code.

[0118] As can be seen from the above, the embodiments of this disclosure can automatically obtain the configuration code corresponding to the configuration file by configuring the configuration tool, saving a lot of time required in the code writing process and improving testing efficiency; the target code determined by the configuration code and static code can also meet the implementation method of the function and the configuration requirements of the vehicle electronic control unit.

[0119] Based on the automated integrated environment scheduling tool, an executable file is generated from the target code and then downloaded to the target microcontroller.

[0120] The automated integration environment scheduling tool is Jenkins. Jenkins is an open-source software project, a continuous integration tool developed based on Java, used to monitor repetitive tasks. It aims to provide an open and easy-to-use software platform that enables continuous software integration. The steps included in this embodiment are all executed in a pipeline under Jenkins scheduling. The above implementation process includes the following:

[0121] The test project is integrated based on the target code and test text, and the test project can be compiled and executed.

[0122] The above implementation process includes the following: combining the test text and target code under the same project to form a test project, which can be compiled and executed.

[0123] Compile and test the project to generate an executable file.

[0124] The above implementation process includes the following: compiling the test project formed by the above steps to obtain an executable file with the extension .elf, which is used to execute in the microcontroller to implement the function indicated by the function description information.

[0125] As can be seen from the above, this embodiment of the present disclosure combines the target code and the test text to achieve integrated testing of the target code and the test text, completes the establishment of a compilable test project, implements the test project by compiling the test project, completes the initial execution of the target code, and obtains an executable file corresponding to the target code, laying the foundation for the subsequent execution of the target code.

[0126] Based on the test environment script, the target microcontroller is automatically run to obtain test results. The test results include the predicted execution result and the actual execution result corresponding to at least one functional description.

[0127] The above implementation process includes the following: Based on the test environment script, the target microcontroller is automatically run to obtain the test results, including the following:

[0128] Based on the test environment script, simulate the test environment required for the target microcontroller to run.

[0129] The above implementation process includes the following: The test environment script can be a written CANOE CAPL script. By running the CANOE CAPL script, the signals required for the operation of the target microcontroller can be simulated, and the signals sent by the target microcontroller can be received. It can also make judgments on the received signals and send feedback signals corresponding to the signals, thus creating a test environment for the operation of the target microcontroller.

[0130] Based on the test environment, the target microcontroller is run automatically to obtain test results.

[0131] The above implementation process includes the following: The target microcontroller can be automatically run in a simulated test environment, and test results can be obtained. Optionally, the target microcontroller model can be MCU TC297. The executable file is burned to the MCU TC297 microcontroller for execution, and test results are obtained. Optionally, the obtained test results can be printed through assertions. By binding the labels of the functional description information in the test results with the corresponding predicted execution results and actual execution results, the results can be quickly compared to pinpoint the error location. If the actual execution result does not match the predicted execution result, it can be determined that the target code corresponding to the actual execution result has an error. After identifying the erroneous target code, by checking whether the erroneous target code conforms to the platform specification definition requirements, or whether the configuration items of the configuration tool corresponding to the erroneous target code are configured correctly, the cause of the erroneous target code can be determined. This process avoids checking code or configuration items unrelated to the erroneous target code, further saving time required for troubleshooting and improving testing efficiency.

[0132] As can be seen from the above, the embodiments of this disclosure can simulate the signals required for the operation of the target microcontroller by writing test environment scripts, and process and judge the signals fed back by the target microcontroller, thereby simulating the environment required for the automated operation of the target microcontroller and realizing the automated operation of the target microcontroller. On this basis, by printing the test results of the target microcontroller's operation, the predicted execution results can be quickly compared with the actual execution results, the error location can be locked, and the erroneous target code can be quickly identified.

[0133] Figure 8 This is a block diagram of a test apparatus based on an AUTOSAR platform, according to an exemplary embodiment. (Refer to...) Figure 8The device includes an acquisition module 801, a target code determination module 802, an executable file generation module 803, and a testing module 804, wherein...

[0134] The acquisition module 801 is used to acquire test text, which includes at least one assertion and at least one functional description information. The assertion is used to indicate the predicted execution result corresponding to the functional description information of the assertion.

[0135] The target code determination module 802 is used to determine the target code corresponding to the test text. The target code is used to implement the functions indicated by the function description information.

[0136] The executable file generation module 803 is used to generate an executable file based on the target code using an automated integration environment scheduling tool, and then download the executable file to the target microcontroller.

[0137] Test module 804 is used to automatically run the target microcontroller based on the test environment script and obtain test results. The test results include the predicted execution result and the actual execution result corresponding to at least one functional description information.

[0138] In an optional embodiment, the executable file generation module 803 includes:

[0139] The test project integration module is used to integrate a test project based on the target code and test text. The test project can be compiled and executed.

[0140] The executable file submodule is used to compile the test project and generate an executable file.

[0141] In an optional embodiment, the target code determination module 802 includes:

[0142] The initial code generation module is used to generate configuration files and static code based on the test text. The configuration files represent the configuration information of the vehicle's electronic control unit, and the static code is used to determine the implementation method of each function description information.

[0143] The target code submodule is used to obtain the target code based on the configuration file and static code.

[0144] In an optional embodiment, the target code submodule module includes:

[0145] The configuration code generation module is used to generate configuration code corresponding to the configuration file through configuration tools;

[0146] The target code determination module is used to determine the target code based on the configuration code and static code.

[0147] In an optional embodiment, the code generation module is configured to include:

[0148] The configuration items module is used to determine the configuration items for the configuration tool;

[0149] The configuration code submodule is used to generate configuration code in response to the complete configuration of configuration items.

[0150] In an optional embodiment, test module 804 includes:

[0151] The test environment generation module is used to simulate the test environment required for the target microcontroller to run, based on the test environment script.

[0152] The test results submodule is used to automatically run the target microcontroller based on the test environment and obtain the test results.

[0153] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0154] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing processor-executable instructions; wherein the processor is used for the instructions to implement a test method based on an AUTOSAR platform as described in the embodiments of this disclosure.

[0155] Figure 9 This is a block diagram illustrating an electronic device for testing based on an AUTOSAR platform, according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the electronic device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a test method based on the AUTOSAR platform. The display screen can be a liquid crystal display (LCD) or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.

[0156] Those skilled in the art will understand that Figure 9The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the electronic device to which the present disclosure is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0157] In an exemplary embodiment, a storage medium is also provided, which, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the AUTOSAR-based test method of the present disclosure embodiments.

[0158] In an exemplary embodiment, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform the AUTOSAR-based testing method of the present disclosure embodiments.

[0159] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this disclosure can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0160] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0161] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A testing method based on the AUTOSAR platform, characterized in that, The method includes: Obtain test text, the test text including at least one assertion and at least one functional description information, the assertion being used to indicate the predicted execution result corresponding to the functional description information of the assertion; Based on the test text, a configuration file and static code are generated. The configuration file represents the configuration information of the vehicle electronic control unit, and the static code is used to determine the implementation method of each of the functional description information. The static code under the AUTOSAR platform is immutable code. The configuration tool is used to obtain the configuration code corresponding to the configuration file; the target code is determined based on the configuration code and the static code; the configuration tool is a toolchain provided by the AUTOSAR platform; the toolchain develops the configuration code through a human-computer interaction interface; the target code is used to implement the functions indicated by the description information of each function. Based on the automated integrated environment scheduling tool, an executable file is generated according to the target code, and the executable file is downloaded to the target microcontroller; Based on the test environment script, the target microcontroller is automatically run to obtain test results. The test results include at least one predicted execution result and an actual execution result corresponding to the functional description information.

2. The method according to claim 1, characterized in that, The step of generating an executable file based on the target code includes: The test project is integrated based on the target code and the test text, and the test project can be compiled and executed. Compile the test project to generate the executable file.

3. The method according to claim 1, characterized in that, The step of obtaining the configuration code corresponding to the configuration file through the configuration tool includes: Determine the configuration items of the configuration tool; In response to the complete configuration of the configuration items, the configuration code is generated.

4. The method according to claim 1, characterized in that, The test environment script automatically runs the target microcontroller to obtain test results, including: Based on the test environment script, simulate the test environment required for the target microcontroller to run; Based on the aforementioned test environment, the target microcontroller is automatically run to obtain the test results.

5. A testing device based on the AUTOSAR platform, characterized in that, include: An acquisition module is used to acquire test text, the test text including at least one assertion and at least one functional description information, the assertion being used to indicate the predicted execution result corresponding to the functional description information of the assertion; The code initial generation module is used to generate configuration files and static code based on the test text. The configuration files represent the configuration information of the vehicle electronic control unit, and the static code is used to determine the implementation method of each of the functional description information. The static code under the AUTOSAR platform is immutable code. The target code submodule is used to obtain the configuration code corresponding to the configuration file through a configuration tool; determine the target code based on the configuration code and the static code; the configuration tool is a toolchain provided by the AUTOSAR platform; the toolchain develops the configuration code through a human-computer interaction interface; The target code is used to implement the functions indicated by the functional description information; An executable file generation module is used to generate an executable file based on the target code using an automated integration environment scheduling tool, and then download the executable file to the target microcontroller. The testing module is used to automatically run the target microcontroller based on a test environment script and obtain test results. The test results include at least one predicted execution result and an actual execution result corresponding to the functional description information.

6. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is used for the instructions to implement the test method based on the AUTOSAR platform as described in any one of claims 1 to 4.

7. A storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the test method based on the AUTOSAR platform as described in any one of claims 1 to 4.

8. A computer program product, characterized in that, The computer program product includes a computer program stored in a readable storage medium, wherein at least one processor of a computer device reads from and executes the computer program, causing the device to perform a test method based on the AUTOSAR platform as described in any one of claims 1 to 4.