{"id":19564,"date":"2025-01-27T14:08:04","date_gmt":"2025-01-27T12:08:04","guid":{"rendered":"https:\/\/www.btc-embedded.com\/?p=19564"},"modified":"2025-01-27T14:28:08","modified_gmt":"2025-01-27T12:28:08","slug":"seamless-testing-for-model-based-developers","status":"publish","type":"post","link":"https:\/\/www.btc-embedded.com\/zh-hans\/seamless-testing-for-model-based-developers\/","title":{"rendered":"Seamless Testing for Model-Based Developers: Directly from Simulink"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"19564\" class=\"elementor elementor-19564\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3fd23a6 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3fd23a6\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3097a26\" data-id=\"3097a26\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cc1ca58 elementor-widget elementor-widget-heading\" data-id=\"cc1ca58\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">1.\tThe Need for Early Testing<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-907bc6d elementor-widget elementor-widget-text-editor\" data-id=\"907bc6d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul>\n \t<li><strong>Agile Software Development:<\/strong>\u00a0Agile methodologies have revolutionized software development by shifting testing as close as possible to the development tasks, a concept known as \u201cShift left.\u201d This approach emphasizes finding problems early in the development cycle, adhering to the principle of \u201cFail early \u2013 Fail cheap.\u201d According to a study, early testing can reduce defect costs by up to 30% and shorten development time by 20%.<\/li>\n \t<li><strong>Software-Defined Vehicle:\u00a0<\/strong>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.<\/li>\n \t<li><strong>Challenges for Model-Based Testing:<\/strong>\u00a0High 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.<\/li>\n<\/ul><p>\n<p>\n<strong>Conclusion:<\/strong>\u00a0The 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.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9d9c324 elementor-widget elementor-widget-heading\" data-id=\"9d9c324\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">2.\tTest-Driven Development<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ef8339b elementor-widget elementor-widget-text-editor\" data-id=\"ef8339b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tTest-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.\n<p><p>\n<strong>Key Principles of Test-Driven Development<\/strong>\n<ul>\n \t<li><strong>Write Tests As Early as Possible:\u00a0<\/strong>Test cases can be easily derived from requirements compared to the implementation phase.<\/li>\n \t<li><strong>Iterative Process:<\/strong>\u00a0Functions are developed in small incremental cycles, allowing for continuous improvement and refinement.<\/li>\n \t<li><strong>Focus on Behavior:<\/strong> Successful test execution ensures that the function meets the desired behavior by validating it against predefined requirements.<\/li>\n<\/ul><p><p>\n<strong>Conclusion:\u00a0<\/strong>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.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-86b55ab elementor-widget elementor-widget-heading\" data-id=\"86b55ab\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">3.\tHow to Implement Test-Driven Development with BTC EmbeddedPlatform<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8ed7c86 elementor-widget elementor-widget-heading\" data-id=\"8ed7c86\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\">Challenges of TDD in Model-Based Development<\/h4>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ef25c9d elementor-widget elementor-widget-text-editor\" data-id=\"ef25c9d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li><strong>Lack of Requirements Traceability<\/strong>: Without traceability, it&#8217;s difficult to ensure all requirements are tested, leading to potential gaps and missed defects.<\/li><li><strong>Absence of Automated Verdicts<\/strong>: Manual review of test results is time-consuming and error-prone; automated verdicts provide quick, reliable pass\/fail statuses.<\/li><li><strong>No Test Automation<\/strong>: Manual testing is slow and less reliable; automation allows for faster, repeatable tests with consistent results.<\/li><li><strong>No ISO 26262 Certification<\/strong>: Without certification, it&#8217;s challenging to guarantee software safety and reliability, especially in the automotive industry.<\/li><li><strong>Typical Testing Setup<\/strong>: A typical Test-Driven Development setup which is utilized by every Model based developer is using display ports or Constant blocks which doesn\u2019t have proper test definition and test case verdicts. For instance, an example below.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3f15e2c elementor-widget elementor-widget-image\" data-id=\"3f15e2c\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"612\" height=\"366\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2025\/01\/Blogpic1_01_20251.webp\" class=\"attachment-large size-large wp-image-19574\" alt=\"Seamless Testing for Model-Based Developers: Directly from Simulink\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\"><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5b4b0e8 elementor-widget elementor-widget-heading\" data-id=\"5b4b0e8\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\">TDD MBD Best Practices Suggested by BTC Embedded Systems<\/h4>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-615b9de elementor-widget elementor-widget-text-editor\" data-id=\"615b9de\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>To overcome the challenges mentioned above, consider the following best practices:<\/p><ul><li><strong>Create your test cases as early as possible<\/strong>: Early test case creation by understanding the requirement to ensures that testing is aligned with requirements from the start.<\/li><li><strong>Define and manage your test case verdicts<\/strong>: Clear verdicts provide quick, reliable pass\/fail statuses, reducing manual review time.<\/li><li><strong>Ensure traceability between test cases and requirements<\/strong>: Traceability guarantees that all requirements are tested, preventing gaps and missed defects.<\/li><li><strong>Automate all test executions and enable regression testing<\/strong>: Automation allows for faster, repeatable tests with consistent results, supporting continuous integration.<\/li><li><strong>Reuse your test cases in later code testing projects<\/strong>: Reusing test cases saves time and resources, ensuring consistency across different testing phases.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ea464d3 elementor-widget elementor-widget-heading\" data-id=\"ea464d3\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\">TDD Directly from Simulink: Best Solution Provided by BTC EmbeddedPlatform<\/h4>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-de32686 elementor-widget elementor-widget-text-editor\" data-id=\"de32686\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li>From Simulink 2022b, <a href=\"https:\/\/www.btc-embedded.com\/btc-embeddedplatform\/\">BTC EmbeddedPlatform<\/a> provides a MATLAB built-in integration solution where you can create, manage, and run your test cases directly within Simulink.<\/li><li>You can develop and test your model within Simulink without needing to add scopes or display ports to check your output.<\/li><li>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.<\/li><li>This approach ensures that you can create test cases as early as possible and define and manage your test case verdicts effectively.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ab27072 elementor-widget elementor-widget-image\" data-id=\"ab27072\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"800\" height=\"125\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2025\/01\/Blogpic2_01_2025.webp\" class=\"attachment-large size-large wp-image-19571\" alt=\"Seamless Testing for Model-Based Developers: Directly from Simulink\" srcset=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2025\/01\/Blogpic2_01_2025.webp 1680w, https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2025\/01\/Blogpic2_01_2025-768x120.webp 768w, https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2025\/01\/Blogpic2_01_2025-1536x240.webp 1536w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\"><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8a16c94 elementor-widget elementor-widget-heading\" data-id=\"8a16c94\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Conclusion<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9ba5811 elementor-widget elementor-widget-text-editor\" data-id=\"9ba5811\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>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.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>1. The Need for Early Testing Agile Software Developmen [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":19595,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[48,210,121],"product":[],"use_cases":[],"class_list":["post-19564","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-simulink","tag-test-driven-development","tag-testing"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/posts\/19564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=19564"}],"version-history":[{"count":30,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/posts\/19564\/revisions"}],"predecessor-version":[{"id":19603,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/posts\/19564\/revisions\/19603"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/media\/19595"}],"wp:attachment":[{"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=19564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=19564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=19564"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/product?post=19564"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/use_cases?post=19564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}