The ECU-TEST platform, used for automated testing of automotive software, has numerous features that significantly simplify the process of testing the diverse hardware variants that today’s software is designed to interface with. This blog will provide ideas to allow you to easily manage your suite of test scripts for different applications with different options. In turn, you can create more robust test systems to deliver higher quality on schedule.
Configuration Setup
To start, create a test configuration (tcf file) for each of the unique hardware variants on which you wish to test the software. Multiple variants of the same hardware platform can be grouped together as they will typically all use the same test bench (tbc file).
In the test configuration file, you can define global constants for the variable factors such as number of cylinders and firing order for engine controls, as well as optional accessories. When the test configuration is activated, all the defined global constants will be accessible from the test packages.
Script Implementation
Moving to the test script development, the following example test package demonstrates how you can use switch and case statements to control the test flow based on the constants defined for that variant. The number of loop iterations is being set to the number of cylinders defined in the configuration. The switch case will then execute the associated test steps for each cylinder as it iterates through the loop.
We see that when the test is executed with ENGINE_CYLINDERS defined with a value of 4, only the appropriate cases are run.
In the next test package, we will show how to use SwitchDef and IfDef to dynamically control the execution of test steps based on the defined constants. This allows you to easily maintain a single script that allows for several different options. For example, in a functional test where you want to verify the basic supply voltage and current for a number of optional accessories, you can define them as follows:
In order to work with SwitchDef and IfDef, the values must evaluate to Boolean True based on pythonic logic. We can see how ECU-TEST will evaluate the above definitions in the following test steps.
On line 7, we can see that the switch definition is enabled and will execute case 10 based on the value associated with the defined OEM_OPTION01. This could be to test the power supply for a display that comes in screen sizes of 8”, 10”, or 12”. ECU-TEST would run the appropriate case for the defined screen size.
On line 17, we demonstrate that defined values can also be strings. As an example, this capability can be used to test a power supply for optional hardware that has had multiple revisions which are defined as ASCII text.
On line 23, the IfDef condition is enabled because the value associated with OEM_OPTION03 evaluates to Boolean True.
On line 26, the IfDef condition is disabled because the value associated with OEM_OPTION04 evaluates to Boolean False.
On line 29, the IfDef condition is disabled because OEM_OPTION05 is not defined at all.
Summary
The use of conditional statements based on constants defined at the configuration level allows test packages to be flexible over numerous hardware variants all running on the same software platform. This minimizes the number of packages that need to be maintained and greatly simplifies the overhead that comes with managing complex test suites. The test configuration file offers a single source through which many parameter configurations may vary from variant to variant. This makes adding, removing, or changing the options much more simple than having to maintain a set of test packages for each unique variant.
At DISTek, we use advanced tools like ECU-TEST to deliver high quality software for commercial vehicle and off-highway equipment projects. Our team has extensive expertise using these tools, which lets us thoroughly test and validate systems to make sure they meet functional and safety requirements. With ECU-TEST, we can automate testing, find issues early on, and get results faster. This means we can get our client’s project to market quicker and at a lower cost. This shows our dedication to providing top-quality, modern solutions that are just right for you.