×

Happy to Help!

This website doesn't store cookies. Enjoy the experience, without worrying about your data!

Great, thanks!

ISO 26262 Compliant Unit Testing Strategies: A Step Towards Achieving Functional Safety in Automotive Product Development

  • 0

ISO 26262 Compliant Unit Testing Strategies: A Step Towards Achieving Functional Safety in Automotive Product Development

It is always better to be safe than sorry! And when human life is at stake, the commitment to safety requires to be of highest order.

We are talking about safety of the automobiles – passenger vehicles, commercial vehicles, off-road vehicles, Electric Vehicles and more. To be more specific, we are referring to the Functional Safety in Automotive.

As per the ISO 26262 standard, functional safety corresponds to the fool-proof design and development of electric and electronic components of a vehicle.

“There are an exploding number of electronic and electric components in a modern-day automobile. A lot of them including the anti-lock braking system, airbags, electronic power steering and more have a direct impact on the safety of the driver and the passengers. Rigorous and standardized software and hardware testing process is one of the ways to ensure robust and fool-proof systems.”

In this blog, we will talk about the unit testing aspect of the functional safety. The need for such a guideline will also be discussed.

The transition from ISO 9001 based Testing to ISO 26262 Compliant Unit Testing

As already mentioned, the safety criticality of several automotive components is quite high. In such scenarios, the functional safety at both unit level and system level needs to be ensured.

A few years back when ISO 26262 was uninitiated, the unit testing standards were in compliance with ISO 9001. The need for the concepts of ‘functional safety’ arose when certain failures in safety critical components started getting reported on a regular basis.

After Though testing has always remained a part of automotive product development process, but after these recalls, the testing process was in dire need of a revamp.

On top of this, the numerous car recalls by many global automotive OEMs over the years also added fuel to the fire. In these recalls, sometimes, the fault was found to be with the airbag and at times, with the braking system.

Though testing has always remained a part of automotive product development process, but after these recalls, the testing process was in dire need of a revamp.

One of the major aspects where ISO 26262 compliant Unit Testing differs with ISO 9001 is related to the writing of the test cases. For ISO 26262 compliance, the test cases are always written in accordance with the safety requirements.”

New concepts and methods of unit testing have been included in the ISO 26262 that make it ideal for achieving functional safety in automobiles. We will touch upon these methods further in the blog.

ISO 26262 Compliant Unit Testing: What Makes the Process Different?

If we look from a broad perspective, ISO 26262 guidelines are focused on making the software codes more comprehensible, reliable and easy to test. One of the example is the restriction of the software component and their interface sizes. By doing so, the code is rendered less prone to errors.

The ISO 26262 unit testing guidelines aim at demonstrating that only the unit design specifications are fulfilled and any unrequired feature is done away with.

Such requirement based unit testing lets the automotive testing team input the values and check the output. Depending on the output, the bugs are identified and processed.

Understanding the Unit Testing Recommendation Table, Defined by ISO 26262

The section 6 of ISO 26262 standard has the recommendations for unit and integration testing. The recommendation table 10 has all the methods for software unit testing. Whereas, the table 11 recommends the methods for derivation of the test cases.

We will go through each of the methods to have a better understanding:

ISO 26262 Table 10 – Methods for unit testing of the software

Requirement-based test: This method helps in systematic identification of implementation failures. The failures occurring due to incomplete and inconsistent requirement are also identified.

In this method, the input values are derived from the behavioral requirements which are usually developed previously. If there are no documented requirements, they need to be deduced from the functional model as it has the executable specifications.

It has to be made sure that for all the requirements that have to be implemented by a software unit, one test case must be defined.

After the requirements are finalized, requirement-based testing is applied. As we can see in the table, it is mandatory for all ASIL ratings (A to D).

ISO 26262 Unit Testing 1

 

PS: The ‘+’ symbol in the table implies Recommended and ‘++’ implies strongly recommended

Interface Testing as per ISO 26262 standard: Correct implementation of interfaces is very strongly recommended by the ISO 26262 unit test recommendation table. This is because, every software unit may have been tested individually but their communication with other units is also very critical.

During the interface testing, the value range of the incoming signals from the interface is defined and divided in classes. These classes have a boundary value which is used to define the test cases. After the test cases are defined interface testing can be performed.

Interface testing is performed to detect early failures that could go unnoticed till the integration testing process. At that stage, it would be even difficult to localize the issue.

Fault Injection Testing: Quite a self-explanatory term, fault injection implies the insertion of some arbitrary faults. This may include corrupting the values of CPU registers, code mutation, corrupting the variable value and more. Faults can be injected either at compile time or run-time.

This testing is done to ensure that the software unit behaves in an expected manner at the occurrence of any error.

Fault Injection Testing is strongly recommended, but only for automotive products that require ASIL D compliance.

ISO 26262 Unit Testing 2

 

Resource Usage Test: This test is performed to ensure that the unit being tested does not eat up a lot of CPU memory. Resource Usage testing is usually done on the target platform or the simulator. This test is strongly recommended only when the software product is targeting to be ASIL D compliant.

Back-to-back Comparison Test: The software unit under test must behave like the model based on which the unit was designed. Back-to-back comparison test achieves exactly that.

For this test method, a model is required that can simulate the unit being tested. The test suites from the source code are applied to the model and vice versa. The results of both the scenarios are compared and output is recorded.

ISO 26262 Recommendation Table 11- Derivation of Test Cases

The entire process of requirement based testing depends on the test cases you have defined. ISO 26262 underlines some methods to derive these test cases to ensure the software is assigned the required ASIL level.

We look at some of the test case derivation methods at a glance:

Requirement Analysis: Every software unit will have some behavioral requirements. For instance, if a function is supposed to return ‘0’ as the output for a negative input value, we will keep -1 as a test case value.

If you are using some unit testing tools, these values will be generated based on the requirements. It is strongly recommended for all ASIL levels.

Analysis of the Equivalence Classes: There is a range of input values for which the behavior of the software unit should be similar. This range is called the equivalence class.

These classes can be identified based on the input and output division. The input range thus derived is categorized under a subset of the unit. Once the equivalence classes are determined, a value that represents the class is chosen and test class is generated based on it.

Equivalence class test generation is strongly recommended by ISO 26262 recommendations for ASIL B to D compliance.

Boundary Values Analysis: Every input can have a minimum and maximum possible value, called the boundary values. For software being tested for ASIL B, C or D, test generation based on boundary values is strongly recommended.

The Metrics for ISO 2626 Compliant Unit Test Coverage

Statement Coverage: A part of unit testing, statement coverage covers those lines of codes that have been tested at least once. Only one test case is required. Statement coverage is strongly recommended only for ASIL level A and B.

ISO 26262 Unit Testing 3

 

Branch Coverage: Branch coverage is applicable at a decision point, for eg. an ‘if…else’ condition. In such a scenario, both true and false condition need to be executed. Naturally, two test cases are required here. It is strongly recommended for ASIL B, C and D functional safety compliance.

Modified Condition/Decision Coverage (MCDC): This is where Functional Testing becomes a very serious business. MCDC is highly recommended for ASIL level D. Here, every condition in the decision in the ‘if.. else’ condition or the loops, can independently influence the outcome.

Role of Testing Tools in ISO 26262 compliant Unit Test Process

The Unit Testing tools can be quite helpful in helping you achieve the right ASIL level for your software. Running the unit test methods manually can be an extensive task and prone to errors.

Tools like Reactis and CANTATA etc. ease the process considerably. They can help the developers automate the testing process by

  • Test case derivation
  • Framework generation
  • Execution of the test cases
  • Test report generation etc.

Many of these tools are built around the ISO 26262 guidelines and offer complete structural coverage metrics at the software unit level.

Concluding Thoughts

ISO 26262 has become a de facto standard for automotive industry in terms of functional safety. The unit testing recommendations by ISO 26262 should be followed in letter and spirit to build a really safe automotive system.

If you are new to ISO 26262 and functional safety, we recommend these blogs for you to have a clear understanding of concepts like safety management, ASIL level etc.


  • 0

Understanding the Automotive Functional Safety Best-Practices with ISO 26262 standard

The modern day vehicles have evolved from predominantly mechanical machine into an electronically-controlled system.

Today, a car consists of hundreds of automotive Electronic Control Units (ECU) and millions of lines of software code.

With passage of time and the lightening pace of technical advancement, the number of ECUs within automobiles is also increasing. This increase in complexity and functionalities of ECU-based car design is driven by a need for a comfortable driving experience along with safety and pollution control.

The automotive ECUs power many of the advanced function and features available in modern cars including advanced driver assistance(ADAS) , telematics, passive safety systems, engine management – to name a few.

Functional Safety in Automotive:

With the widespread of the modern automobiles, run and regulated by automotive ECUs, the need for advanced safety features has also become inevitable.

Functional Safety as a process has become an essential component of the ECU software development cycle. Functional safety schemes for automobiles helps in identifying malfunctions (electric and electronic), and specifies actions and techniques to be adopted to mitigate risks and damage during instances of software or hardware failures.

Inability or a delay in identifying or mitigating instances of ECU (hardware/software) failure can impact all the stakeholders throughout the value chain – including the ECU Supplier, Car manufacturers and the end user.

The consequences may involve loss of life or property, financial loss, legal liability, regulatory actions or even the loss of goodwill for all of those involved.

And this is why today modern vehicles are required to adhere to the safety standards listed within the Automotive Safety Integrity Level (ASIL). ASIL is a risk classification scheme specified within the ISO 26262 – a Functional Safety standard for Road Vehicles.


Functional Saftey Automotive
Image Credit: dcvizcayno.wordpress.com

Ensuring Functional Safety of Automotive Software with ISO 26262 standard

The ISO 26262 standard addresses the need for a unified and automotive-specific international Functional Safety Standard for electrical and electronic ECU and other embedded systems in a vehicle.

The ISO 26262 standard is an adaptation of IEC 61508 standard. It specifies recommendations to ensure the functional safety throughout the product development cycle- at the system, hardware, and software levels. The ASIL standard is a key component for the ISO 26262 compliance.

Most functions within an automotive ECU are implemented and controlled through automotive ECU software and the complexity of this software can reach more than 10 million lines of code.

Typically, these programmable ECUs contain highly modular embedded software. The software may include both safety-related and non-safety-related code and software components that perform functions with different ASIL ratings.

The ISO 26262 standard specifies two approaches to be followed if embedded software includes software components with varying ASIL ratings.

  1. Either develop the entire software according to the highest ASIL, or
  2. Take necessary actions to ensure that the software components with a with a lower ASIL rating are not interfering with software with higher ASIL rating


ISO 26262

Design and development of ISO 26262 compliant ECU Software

The need for developing safety-critical automotive components and the increasing demands for complex and innovative automobile applications are ongoing challenges for the automotive manufacturers and design engineers.

They have to play the balancing act of catering to increased application complexity while reducing the time-to-market with utmost care. And this while ensuring that no comprise is made on ensuring safety of the automotive application and software component.

The expertise then lies in designing the automotive ECU application by taking into account every aspect of safety failures that can occur during the product development cycle. These failures mostly fall under following groups:

  • Random/systematic hardware defects
  • Systematic software defects.

Identifying Sources of Errors during ECU Software development Lifecycle

The systematic software failures occur mostly due to human errors during different product development life cycle phases. These can mostly be traced back to a certain root cause and fixed.

Let us look at some instances of errors that usually occur during the software development cycle and which could have a lasting impact on the performance of the final automotive application:

  1. Requirement specification and communication– This phase results in one of the largest sources of errors. It occurs when:

    • Software executes “correctly” according to the understanding of the requirement, but the requirement eventually appears to be inaccurately defined within the scope of the system
    • The requirement was simply misunderstood by the automotive software developer
  2. Software Design and coding errors– Considered as the second most common source of errors, this type of error usually occurs due to :
    • A poorly structured embedded software code
    • Timing errors, incorrect queries, syntax errors, algorithm errors, error in displaying results errors, lack of self-tests, failed error-handling – to name a few
  3. Errors due to software changes – Such errors is said to have occurred when
    • Changes to the developed software may introduce unanticipated errors
    • Failure of the configuration control process

    These errors can usually be traced back to requirements and programming errors.

  4. Errors due to inadequate testing: During the testing phases, sometimes the software seems to have passed the testing criteria, but during the actual execution it may fail to perform the required task. Such a failure is termed as a testing failure. This happens if:
    • Software functions properly in unit testing
    • Software passes systems and integration testing, but ideally it shouldn’t have. This happens when safety-critical test coverage is inadequate

    Such errors can also be traced back to requirements and programming errors

  5. Errors in Timings: Software performs the right function, but at the wrong time or under inappropriate conditions.

    Such instances of errors during the application development can be reduced or eliminated by introducing failure-safe processes and by taking extra care at each of the phases including: requirement analysis, design, manufacturing process, documentation etc.
    Designing a robust and well –optimized software, keeping into account these instances of errors; can reduce systematic failures to a large extent.

Recommended Approach

The best practice for developing functionally safe automotive software can vary with the end- application and requirement it is being developed for.

The development and design of a software specific to ADAS may not be same as the one for Anti-Lock Brake System (ABS). The need of the hour then is to optimize the software and hardware design according to the specific domain and application.

The ISO 26262, a functional safety standard for automotive, specifies definite techniques and measures to address various types of failures and issues related to the automotive software development lifecycle.

It is also necessary to ensure that while designing the ECU software and ensuring compliance with the ISO 26262 standard, the components (hardware and software) are not seen just as individual systems but as a whole .The best approach is to have a holistic view of the ECU application so that all the applications work in perfect coordination.