matlabtest.codequalitydashboard.getMetrics
Description
returns information about the current project and the code quality metrics from the Code Quality
Dashboard.info
= matlabtest.codequalitydashboard.getMetrics
Examples
Programmatically Update, Get, and Export Code Quality Dashboard Metrics
This example shows how to update, get, and export metrics from the Code Quality Dashboard.
Open the ShortestPath
project.
openProject("MATLABShortestPath");
Open the Code Quality Dashboard.
codeQualityDashboard
Run the tests in the project, collect coverage for the tests, verify the requirements, and update the metrics in the dashboard.
matlabtest.codequalitydashboard.runTestsAndRefreshData
pathLength = 3
Get the metrics from the Code Quality Dashboard.
metrics = matlabtest.codequalitydashboard.getMetrics
metrics = struct with fields:
ProjectPath: "C:\Users\jdoe\MATLAB\MATLABShortestPath"
Metrics: [1×1 struct]
Export the metrics to a JSON file.
filePath = matlabtest.codequalitydashboard.exportMetrics
filePath = "C:\Users\jdoe\MATLAB\MATLABShortestPath\CodeQualityMetrics.json"
Output Arguments
info
— Code quality metric information
structure
Code quality metric information, returned as a structure with these fields:
ProjectPath
— Project root folder path
string
Project root folder path, returned as a string.
Metrics
— Code Quality Dashboard metric results
structure
Code Quality Dashboard metric results, returned as a structure with these fields:
CodeAnalyzer
— Code Analyzer metric results
structure
Code Analyzer metric results, returned as a structure with these fields:
LastUpdated
— Date and time when software collected the results
character vector
Date and time when the software collected the results, returned as a character vector.
Stale
— Stale metric indicator
logical
Stale metric indicator, returned as a 1
or 0
of data type logical
.
Data
— Code Analyzer metric data
structure
Code Analyzer metric data, returned as a structure with these fields:
Error
— Number of errors
double
Number of errors, returned as a double
.
Warning
— Number of warnings
double
Number of warnings, returned as a double
.
Info
— Number of informational messages
double
Number of informational messages, returned as a double
.
Tests
— Test metric results
structure
Test metric results, returned as a structure with these fields:
LastUpdated
— Date and time when software collected the results
character vector
Date and time when the software collected the results, returned as a character vector.
Stale
— Stale metric indicator
logical
Stale metric indicator, returned as a 1
or 0
of data type logical
.
Data
— Test result metric data
structure
Test result metric data, returned as a structure with these fields:
Passed
— Number of passed tests
double
Number of passed tests, returned as a double
.
Failed
— Number of failed tests
double
Number of failed tests, returned as a double
.
Incomplete
— Number of incomplete tests
double
Number of incomplete tests, returned as a double
.
NotRun
— Number of tests that have not run
double
Number of tests that have not run, returned as a double
.
Total
— Total number of tests
double
Total number of tests, returned as a double
.
CodeCoverage
— Code coverage metric results
structure
Code coverage metric results, returned as a structure with these fields:
LastUpdated
— Date and time when software collected the results
character vector
Date and time when the software collected the results, returned as a character vector.
Stale
— Stale metric indicator
logical
Stale metric indicator, returned as a 1
or 0
of data type logical
.
Data
— Code coverage metric data
structure
Code coverage metric data, returned as a structure with these fields:
Function
— Function coverage percentage
double
Function coverage percentage, returned as a double
.
Statement
— Statement coverage percentage
double
Statement coverage percentage, returned as a double
.
Decision
— Decision coverage percentage
double
Decision coverage percentage, returned as a double
.
Condition
— Condition coverage percentage
double
Condition coverage percentage, returned as a double
.
MCDC
— MC/DC coverage percentage
double
MC/DC coverage percentage, returned as a double
.
GeneratedCodeCoverage
— Generated code coverage metric results
structure
Since R2024b
Generated code coverage metric results, returned as a structure with these fields:
LastUpdated
— Date and time when software collected the results
character vector
Date and time when the software collected the results, returned as a character vector.
Stale
— Stale metric indicator
logical
Stale metric indicator, returned as a 1
or 0
of data type logical
.
Data
— Code coverage metric data
structure
Code coverage metric data, returned as a structure with these fields:
Function
— Function coverage percentage
double
Function coverage percentage, returned as a double
.
Statement
— Statement coverage percentage
double
Statement coverage percentage, returned as a double
.
Decision
— Decision coverage percentage
double
Decision coverage percentage, returned as a double
.
Condition
— Condition coverage percentage
double
Condition coverage percentage, returned as a double
.
MCDC
— MC/DC coverage percentage
double
MC/DC coverage percentage, returned as a double
.
Requirements
— Requirements verification metric results
structure
Requirement verification metric results, returned as a structure with these fields:
LastUpdated
— Date and time when software collected the results
character vector
Date and time when the software collected the results, returned as a character vector.
Stale
— Stale metric indicator
logical
Stale metric indicator, returned as a 1
or 0
of data type logical
.
Data
— Requirement verification metric data
structure
Requirement verification metric data, returned as a structure with these fields:
Passed
— Number of requirements that link to passed tests
double
Number of requirements that link to passed tests, returned
as a double
.
Failed
— Number of requirements that link to failed tests
double
Number of requirements that link to failed tests, returned
as a double
.
NotRun
— Number of requirements that link to tests that have not run
double
Number of requirements that link to tests that have not run,
returned as a double
.
NotLinked
— Number of requirements that do not link to tests
double
Number of requirements that do not link to tests, returned
as a double
.
Total
— Total number of requirements
double
Total number of requirements, returned as a double
.
Version History
Introduced in R2024aR2024b: Get metrics for generated code coverage
If you have Embedded Coder®, the returned structure contains the GeneratedCodeCoverage
structure, which returns information about the generated code coverage metric
results.
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)