{"id":3098,"date":"2023-08-30T04:04:22","date_gmt":"2023-08-30T08:04:22","guid":{"rendered":"https:\/\/blogs.mathworks.com\/developer\/?p=3098"},"modified":"2023-08-30T04:04:22","modified_gmt":"2023-08-30T08:04:22","slug":"weve-got-you-covered","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/developer\/2023\/08\/30\/weve-got-you-covered\/","title":{"rendered":"We\u2019ve got you covered!"},"content":{"rendered":"<div class=\"rtcContent\">\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In the <a href=\"https:\/\/blogs.mathworks.com\/developer\/2023\/08\/16\/introducing-matlab-test\/\"><span style=\"text-decoration: underline;\">previous blog post<\/span><\/a> of this series, I gave an overview of MATLAB Test and went into the details of the Test Manager. Today\u2019s topic is code coverage.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Code coverage is a measure of \u201chow much\u201d of your code has been executed. By measuring and examining code coverage, you can gain insights into which parts of your code have not been fully tested, and therefore where you should direct your efforts in writing more test cases. Similarly, if the code coverage report is saying that some parts of your code are not being executed and you know you\u2019re satisfying your requirements, chances are you can delete this dead logic.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">There are a variety of ways of measuring code coverage. Base MATLAB provides function and statement coverage whilst MATLAB Test adds to that by providing decision, condition, and modified condition\/decision coverage metrics. Here\u2019s a summary of the different coverage metrics:<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 691px; height: 216px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_1.png\" alt=\"coverageSummary.png\" width=\"691\" height=\"216\" \/><\/div>\r\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">What level of coverage do I need?<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Given the above coverage types, which one(s) should you use and what level of coverage do you need to achieve? The answer to is that it\u2019s largely your choice based on your project\u2019s requirements and constraints.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Statement coverage is the starting point for general purpose applications. However, you may have constraints imposed by regulations if you\u2019re working in a safety critical environment such as medical (IEC 62304), aerospace (DO-178), or automotive (ISO 26262).<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">One of my colleagues likes to use the analogy of choosing an insurance policy \u2013 if the risk is low and the impact of anything going wrong is also low, you\u2019ll likely choose the cheapest, most basic insurance. However, when the risk and consequences of something going wrong are high, you\u2019ll want a comprehensive policy which comes at additional cost. In the world of testing, that more comprehensive insurance corresponds to achieving increasing levels of coverage with more advanced metrics. The cost is your time to write the additional tests.<\/div>\r\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Collecting coverage<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">How do we collect coverage? There are three ways!<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Test Browser<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">If you\u2019re using the Test Browser (MATLAB R2023a onwards), click the coverage button, check \u201cEnable Coverage reporting\u201d, and add the files or folders of code that you want to measure coverage for. Then run your tests and an easy-to-read HTML coverage report will open.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 352px; height: 425px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_2.png\" alt=\"testBrowser.png\" width=\"352\" height=\"425\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Collecting statement coverage via the Test Browser.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Note that if you want to record decision, condition, or MC\/DC, you will still need a MATLAB Test licence.<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Test Manager<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">If you\u2019re using the Test Manager (MATLAB Test, R2023a onwards), click the coverage button and check \u201cEnable Coverage\u201d in the pop-out menu.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 488px; height: 141px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_3.png\" alt=\"testManager.png\" width=\"488\" height=\"141\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Collecting statement coverage via the Test Manager.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Run the tests and then view the report by clicking the adjacent menu button:<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 313px; height: 79px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_4.png\" alt=\"testManager_viewReport.png\" width=\"313\" height=\"79\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Opening the coverage report from the Test Manager.<\/span><\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Command Window<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Finally, if you\u2019re running your tests programmatically using <a href=\"https:\/\/uk.mathworks.com\/help\/matlab\/ref\/runtests.html\"><span style=\"text-decoration: underline;\">runtests<\/span><\/a>, you can use the <a href=\"https:\/\/uk.mathworks.com\/help\/matlab\/ref\/runtests.html#mw_413b9753-858b-49f4-a822-b2b26f5bf0fa\"><span style=\"text-decoration: underline;\">ReportCoverageFor<\/span><\/a> option to specify the files, folders, and packages that you want to record coverage for.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">(This will give you the default statement and function coverage. If you want to use the more advanced coverage metrics, you\u2019ll need to use the longhand method to create your own <a href=\"https:\/\/uk.mathworks.com\/help\/matlab\/ref\/matlab.unittest.testrunner-class.html?s_tid=doc_ta\"><span style=\"text-decoration: underline;\">TestRunner<\/span><\/a> and add the <a href=\"https:\/\/uk.mathworks.com\/help\/matlab\/ref\/matlab.unittest.plugins.codecoverageplugin-class.html\"><span style=\"text-decoration: underline;\">CodeCoveragePlugin<\/span><\/a> here you can specify the coverage level.)<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Once your tests have finished running, a hyperlink will appear in the Command Window taking you to the coverage report.<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Interactive HTML coverage report<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The code coverage report looks like this:<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 602px; height: 465px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_5.png\" alt=\"coverageReportOverview.png\" width=\"602\" height=\"465\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example code coverage report.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The top section provides a summary of all the code you have measured coverage for, for all the different coverage types you have selected. Use the \u201cCurrently viewing\u201d drop-down menu to choose which type of coverage is being shown in the rest of the report.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The middle section provides a breakdown on a per file basis. Click a line in the table to choose which file is displayed in the bottom section.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The bottom section provides coverage information on a line-by-line basis for the selected coverage type and the selected file. We\u2019ll explore the details of this next.<\/div>\r\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Types of coverage<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In the following, I expand on what\u2019s covered in the documentation for <a href=\"https:\/\/uk.mathworks.com\/help\/matlab-test\/ug\/types-of-code-coverage-for-matlab-source-code.html\"><span style=\"text-decoration: underline;\">types of coverage available with MATLAB Test<\/span><\/a>. This is a great reference so keep it to hand!<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Function coverage<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Function and statement coverage are the default coverage metrics that MATLAB records. Function coverage indicates whether each function in your code gets executed at least once. (This is not to be confused with <span style=\"font-style: italic;\">functional<\/span>coverage which relates to the overall functionality being correct. This and requirements-based testing are topics for another day!)<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In the following example, we have three functions \u2013 the top-level function <span style=\"font-style: italic;\">myFunction<\/span> and two nested functions <span style=\"font-style: italic;\">fcnOne<\/span> and <span style=\"font-style: italic;\">fcnTwo<\/span>. I\u2019ve recorded coverage for when I call <span style=\"font-style: italic;\">myFunction(0,0,0)<\/span>.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 513px; height: 321px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_6.png\" alt=\"functionCoverage.png\" width=\"513\" height=\"321\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example function coverage report with 67% coverage.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">This executes <span style=\"font-style: italic;\">myFunction<\/span> itself and <span style=\"font-style: italic;\">fcnTwo<\/span> but not <span style=\"font-style: italic;\">fcnOne<\/span>. We therefore have 3 functions in total of which 2 have been executed, giving 2\/3 = 67% function coverage. There are clearly holes on our testing so let\u2019s move onto statement coverage.<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Statement coverage<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Statements are small chunks of code that MATLAB executes that are separated by a comma, semicolon, or newline character. To achieve 100% statement coverage, each statement much be executed at least once.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The following snippet from the coverage report shows statement coverage for when I call <span style=\"font-style: italic;\">myFunction(0,0,0)<\/span>.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 582px; height: 324px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_7.png\" alt=\"statementCoverage.png\" width=\"582\" height=\"324\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example statement coverage report with 60% coverage.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The branch is not executed so lines 4 and 12 are not covered and show in red. We have 5 statements in total, 3 of which have been executed, so the statement coverage is 3\/5 = 60%. By inspection we can see that the <span style=\"font-style: italic;\">if<\/span>statement is only ever false; we\u2019re missing the case of it being true. Let\u2019s look at how we can view this more formally.<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Decision coverage<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Decisions are expressions that alter the execution flow of the code in conjunction with the MATLAB keywords <span style=\"font-style: italic;\">if<\/span>, <span style=\"font-style: italic;\">elseif<\/span>, <span style=\"font-style: italic;\">switch<\/span>, <span style=\"font-style: italic;\">for<\/span>, or <span style=\"font-style: italic;\">while<\/span>. Decision coverage measures the extent to which all these decisions have been tested to be both true and false. It therefore provides you with a view of code branches with missing tests.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">(In addition, the <a href=\"https:\/\/uk.mathworks.com\/help\/matlab\/ref\/shortcircuitand.html?s_tid=doc_ta#mw_38d6751d-c98d-47f5-8da9-57de4d9d4cc0_sep_mw_3138c467-a676-4889-bf7b-576c224b967f\"><span style=\"text-decoration: underline;\">short-circuit operators<\/span><\/a> || and &amp;&amp; are also decisions since the value on the left-hand side of the expression determines whether the right-hand side is evaluated. However, to be consistent with Simulink Coverage, these expressions (\u201cnon-branch decisions\u201d) are excluded from the metrics when recording decision coverage but <span style=\"font-style: italic;\">are<\/span> included when recording MC\/DC.)<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In the previous example we achieved full statement coverage for the <span style=\"font-style: italic;\">if<\/span> decision on line 3. In the following example, I\u2019ve once again tested my code by calling <span style=\"font-style: italic;\">myFunction(0,0,0)<\/span> and have measured decision coverage.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 602px; height: 266px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_8.png\" alt=\"decisionCoverage_partial.png\" width=\"602\" height=\"266\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example decision coverage report with 50% coverage.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">We now see that line 3 is only partially covered (orange) as it only evaluates to false. There is 1 decision with 2 possible values, so 2 combinations in total. We hit 1 of them so that\u2019s 1\/2 = 50% decision coverage.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">I\u2019ll now add in an additional test point so that I\u2019m now calling <span style=\"font-style: italic;\">myFunction(0,0,0) <\/span>and<span style=\"font-style: italic;\"> myFunction(1,0,0).<\/span> This achieves full decision coverage:<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 602px; height: 267px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_9.png\" alt=\"decisionCoverage_full.png\" width=\"602\" height=\"267\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example decision coverage report with 100% coverage.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">You may also have noticed that the coverage recording level is cumulative \u2013 recording decision coverage also includes statement and function coverage.<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Condition coverage<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Decisions can be composed of two or more logical expressions separated by a short-circuit operator (|| or &amp;&amp;) \u2013 these are called conditions. Here is an example with 1 decision and 2 conditions:<\/div>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px; padding: 10px 10px 10px 5px;\">\r\n<div style=\"border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12px; border: 0px none #212121;\"><span style=\"white-space: pre;\"><span style=\"color: #0e00ff;\">if <\/span>(x &gt; -3) || (x == -5) <span style=\"color: #b7312c;\">\u2026<\/span><\/span><\/div>\r\n<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The following contains one decision but no conditions as there are no expressions separated by a short-circuit operator:<\/div>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px; padding: 10px 10px 10px 5px;\">\r\n<div style=\"border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12px; border: 0px none #212121;\"><span style=\"white-space: pre;\"><span style=\"color: #0e00ff;\">if <\/span>x == 0 <span style=\"color: #b7312c;\">\u2026<\/span><\/span><\/div>\r\n<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Below is the condition coverage report for our test code when I call <span style=\"font-style: italic;\">myFunction(0,0,0) <\/span>and<span style=\"font-style: italic;\"> myFunction(1,0,0)<\/span>. Remember how we achieved full coverage previously? Not anymore! Condition coverage reveals yet more holes in our testing.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 472px; height: 160px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_10.png\" alt=\"conditionCoverage_partial.png\" width=\"472\" height=\"160\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example condition coverage report with 50% coverage.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The x condition is covered (green) as it takes values of both true and false. The y condition is partially covered (orange) as it only evaluates to false. The z condition is not covered (red) as it is never executed \u2013 why? y is always false and so the &amp;&amp; short circuits and doesn\u2019t bother evaluating z.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">We have 3 conditions, each of which can take two values (true or false), so there are 6 combinations in total. We\u2019re hitting 3\/6 = 50% coverage.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Let\u2019s modify our tests to fill in the missing coverage:<\/div>\r\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">myFunction(0,0,0)<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">myFunction(1,0,0)<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">myFunction(0,1,0)<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">myFunction(0,1,1)<\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 472px; height: 144px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_11.png\" alt=\"conditionCoverage_full.png\" width=\"472\" height=\"144\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example condition coverage report with 100% coverage.<\/span><\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">MC\/DC<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">MC\/DC stands for Modified condition\/decision coverage. It identifies how tests independently exercise conditions within decisions. To achieve full MC\/DC, both of the following must be achieved:<\/div>\r\n<ol style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">All conditions within decisions are evaluated to both true and false.<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Every condition within a decision independently affects the outcome of the decision.<\/li>\r\n<\/ol>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">MC\/DC is both stricter than condition coverage whilst allowing full coverage to be achieved with fewer tests than would be required to test all combinations of conditions exhaustively. Consider our <span style=\"font-style: italic;\">if<\/span> statement of 1 decision with 3 conditions:<\/div>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px; padding: 10px 10px 10px 5px;\">\r\n<div style=\"border-radius: 0px; padding: 0px; line-height: 15.6px; min-height: 16px; white-space: pre; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12px; border: 0px none #212121;\"><span style=\"white-space: pre;\"><span style=\"color: #0e00ff;\">if <\/span>x || (y &amp;&amp; z) <span style=\"color: #b7312c;\">\u2026<\/span><\/span><\/div>\r\n<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">All the possible combinations of x, y, and z and the corresponding result are listed in the table below.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 500px; height: 213px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_12.png\" alt=\"mcdcCombinations.png\" width=\"646\" height=\"276\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Looking at this table, we can identify test combinations that satisfy the requirements of MC\/DC. Each condition must evaluate to true and false, and independently affect the result. For example:<\/div>\r\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">x \u2013 2 and 6.<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">y \u2013 2 and 4.<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">z \u2013 3 and 4.<\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">We can therefore achieve full MC\/DC with test combinations 2, 3, 4, and 6. Here\u2019s the corresponding coverage report when I run these test combinations:<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 469px; height: 148px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_13.png\" alt=\"mcdc_full.png\" width=\"469\" height=\"148\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example MC\/DC report with 100% coverage.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Under the \u201cTest Pairs\u201d heading, you can see the various combinations of input values used to achieve 100% MC\/DC. \u201cT\u201d denotes true, \u201cF\u201d false, and \u201cx\u201d is don\u2019t care.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 638px; height: 313px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_14.png\" alt=\"mcdc_explanation.png\" width=\"640\" height=\"313\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">By contrast, here\u2019s an example of incomplete MC\/DC when I only ran test combinations 2 &amp; 6:<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 473px; height: 141px;\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_15.png\" alt=\"mcdc_partial.png\" width=\"473\" height=\"141\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><span style=\"font-style: italic;\">Example MC\/DC report with 33% coverage.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">As per the bulleted list above, test combinations 2 &amp; 6 provide full MC\/DC for x, and for y to independently produce a result of false. Note how the framework has used test condition 2 (FFx) in the first test pair as opposed to test condition 3 previously.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">We have 1 out of our 3 conditions achieving MC\/DC, so the overall coverage is 1\/3 = 33%. By comparison, we have tested 3\/6 conditions so have achieved 50% condition coverage. This demonstrates how MC\/DC is a stricter metric than condition coverage.<\/div>\r\n<h2 style=\"margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Summary<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">We\u2019ve looked at the following types of coverage:<\/div>\r\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Function (MATLAB)<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Statement (MATLAB)<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Decision (MATLAB Test)<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Condition (MATLAB Test)<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Modified Condition \/ Decision Coverage (MCDC) (MATLAB Test).<\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">These metrics can be used to guide your testing and therefore help you to produce high quality software whether that\u2019s for everyday desktop use or for safety critical applications. Remember, getting 100% coverage is not the goal \u2013 the goal is better quality software consistent with the time budget of the project, the needs of the end deliverable, and where it will be deployed.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In the next post in this series, we\u2019ll look at MATLAB Test\u2019s Code Quality dashboard.<\/div>\r\n<\/div>\r\n<script type=\"text\/javascript\">var css = ''; var head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); head.appendChild(style); style.type = 'text\/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); }<\/script>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/developer\/files\/article_3.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>\r\nIn the previous blog post of this series, I gave an overview of MATLAB Test and went into the details of the Test Manager. Today\u2019s topic is code coverage.\r\nCode coverage is a measure of \u201chow much\u201d... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/developer\/2023\/08\/30\/weve-got-you-covered\/\">read more >><\/a><\/p>","protected":false},"author":178,"featured_media":3077,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[44,7],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/3098"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/users\/178"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/comments?post=3098"}],"version-history":[{"count":4,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/3098\/revisions"}],"predecessor-version":[{"id":3110,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/3098\/revisions\/3110"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/media\/3077"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/media?parent=3098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/categories?post=3098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/tags?post=3098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}