loader image

Test Solutions for Simulink Models & Production Code

Products

Test Solutions for Simulink Models & Production Code

Blog

Seamless Testing for Model-Based Developers: Directly from Simulink

Spruha Pingale

Oldenburg, Germany

1. The Need for Early Testing

  • Agile Software Development: Agile methodologies have revolutionized software development by shifting testing as close as possible to the development tasks, a concept known as “Shift left.” This approach emphasizes finding problems early in the development cycle, adhering to the principle of “Fail early – Fail cheap.” According to a study, early testing can reduce defect costs by up to 30% and shorten development time by 20%.
  • Software-Defined Vehicle: With the increasing integration of software in vehicles and the continuous development and over-the-air (OTA) updates, the agile process has become even more critical. This ensures that software updates are reliable and can be deployed seamlessly.
  • Challenges for Model-Based Testing: High repair costs and defects detected too late in the integration and operation stages are significant challenges. These issues can lead to increased development costs and delays in project timelines.

Conclusion: The primary problem is that 80% of development costs are spent identifying and fixing defects. The solution lies in systematic and efficient unit testing, which allows developers to discover errors earlier in the development process.

2. Test-Driven Development

Test-Driven Development (TDD) is a methodology that emphasizes writing tests for a software function before writing the actual function. This approach aims to ensure code quality, reduce bugs, and promote maintainability.

Key Principles of Test-Driven Development

  • Write Tests As Early as Possible: Test cases can be easily derived from requirements compared to the implementation phase.
  • Iterative Process: Functions are developed in small incremental cycles, allowing for continuous improvement and refinement.
  • Focus on Behavior: Successful test execution ensures that the function meets the desired behavior by validating it against predefined requirements.

Conclusion: Test-Driven Development (TDD) enhances the sense of accomplishment when developing a function, as it ensures that the code meets the required standards and behaves as expected.

3. How to Implement Test-Driven Development with BTC EmbeddedPlatform

Challenges of TDD in Model-Based Development

  • Lack of Requirements Traceability: Without traceability, it’s difficult to ensure all requirements are tested, leading to potential gaps and missed defects.
  • Absence of Automated Verdicts: Manual review of test results is time-consuming and error-prone; automated verdicts provide quick, reliable pass/fail statuses.
  • No Test Automation: Manual testing is slow and less reliable; automation allows for faster, repeatable tests with consistent results.
  • No ISO 26262 Certification: Without certification, it’s challenging to guarantee software safety and reliability, especially in the automotive industry.
  • Typical Testing Setup: A typical Test-Driven Development setup which is utilized by every Model based developer is using display ports or Constant blocks which doesn’t have proper test definition and test case verdicts. For instance, an example below.
Seamless Testing for Model-Based Developers: Directly from Simulink

TDD MBD Best Practices Suggested by BTC Embedded Systems

To overcome the challenges mentioned above, consider the following best practices:

  • Create your test cases as early as possible: Early test case creation by understanding the requirement to ensures that testing is aligned with requirements from the start.
  • Define and manage your test case verdicts: Clear verdicts provide quick, reliable pass/fail statuses, reducing manual review time.
  • Ensure traceability between test cases and requirements: Traceability guarantees that all requirements are tested, preventing gaps and missed defects.
  • Automate all test executions and enable regression testing: Automation allows for faster, repeatable tests with consistent results, supporting continuous integration.
  • Reuse your test cases in later code testing projects: Reusing test cases saves time and resources, ensuring consistency across different testing phases.

TDD Directly from Simulink: Best Solution Provided by BTC EmbeddedPlatform

  • From Simulink 2022b, BTC EmbeddedPlatform provides a MATLAB built-in integration solution where you can create, manage, and run your test cases directly within Simulink.
  • You can develop and test your model within Simulink without needing to add scopes or display ports to check your output.
  • Test cases can be transferred to later testing projects by uploading them to your BTC profile and link your requirements and make it more traceable.
  • This approach ensures that you can create test cases as early as possible and define and manage your test case verdicts effectively.
Seamless Testing for Model-Based Developers: Directly from Simulink

Conclusion

By leveraging these tools and best practices, model-based developers can achieve seamless testing directly from Simulink, ensuring high-quality software development and reducing the time and cost associated with identifying and fixing defects.

Spruha Pingale

Oldenburg, Germany

Application Engineer

Spruha Pingale studied her Masters in Electrical and Information Technology in Darmstadt University and joined BTC in March 2024 as a Application Engineer. She has done few automation tasks within BTC, to make CRM process faster. She has joined the team with a focus on supporting our customers in their process of Model based development and handcode C/C++ development, be it testing, requirements engineering, or both. Her technical expertise lies in the C/C++ software development for embedded systems. She also has 2 years of experience in Automotive industry as a Software Engineer for CAN development, while working at Bosch India.

Connect on LinkedIn

Popular Videos

Play Video
Play Video

Request Evaluation License

If you would like to try out our tools, we will gladly provide an evaluation license free of chargeEvaluations include a free launch workshop and also provide an opportunity for you to meet one-on-one with our support and engineering teams.

Schedule a Meeting

Do you have any questions or want to see our tools in action? If so, please use the link below to schedule a meeting, where a member of our engineering team will be happy to show you the features and use cases and directly answer any questions you might have.

Events

Join upcoming Webinar

Join our newsletter

Your email address will be submitted to the privacy-certified newsletter software CleverReach for technical distribution. For further information go to our privacy policy.

Videos

Discover some of the main features of our products in these short videos.