matlabtest.codequalitydashboard.exportMetrics - Export Code Quality Dashboard metrics to JSON - MATLAB (original) (raw)
Main Content
Export Code Quality Dashboard metrics to JSON
Since R2024a
Syntax
Description
[filePath](#mw%5Fa1aaf8f6-55e8-44b2-bc62-097746392ab2) = matlabtest.codequalitydashboard.exportMetrics([Name=Value](#namevaluepairarguments))
specifies options using one or more name-value arguments.
Examples
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.
Run the tests in the project, collect coverage for the tests, verify the requirements, and update the metrics in the dashboard.
matlabtest.codequalitydashboard.runTestsAndRefreshData
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"
This example shows how to specify the file name when you export metrics from the Code Quality Dashboard.
Open the ShortestPath
project.
openProject("MATLABShortestPath");
Open the Code Quality Dashboard.
Run the tests in the project, collect coverage for the tests, verify the requirements, and update the metrics in the dashboard.
matlabtest.codequalitydashboard.runTestsAndRefreshData
Export the metrics to a JSON file called CQDMetrics
.
filePath = matlabtest.codequalitydashboard.exportMetrics( ... Filename="CQDMetrics")
filePath = "C:\Users\jdoe\MATLAB\MATLABShortestPath\CQDMetrics.json"
Name-Value Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, where Name
is the argument name and Value
is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.
Example: Filename="myMetrics"
JSON file name, specified as a string scalar or a character vector. If you do not specify this name-value argument, the software names the fileCodeQualityMetrics
.
Example: Filename="myMetrics"
Folder in which to store the JSON file, specified as a string scalar or character vector. You can specify the folder by using a relative or absolute file path. If you do not specify this name-value argument, the software stores the JSON file in the current folder.
Example: FolderPath="reports"
Output Arguments
File path to the JSON file, returned as a string scalar. The software returns the file path as an absolute path unless you specify a relative path by using the FolderPath argument.
Version History
Introduced in R2024a