Main Content

matlabtest.codequalitydashboard.runTestsAndRefreshData

Run tests and refresh data in Code Quality Dashboard

Since R2024a

    Description

    matlabtest.codequalitydashboard.runTestsAndRefreshData runs the tests in the open project and its referenced projects, collects coverage for the tests, verifies requirements that link to tests, and updates the metrics in the Code Quality Dashboard.

    Note

    This function collects coverage using the metric level specified in the MATLAB Test Manager. The function enables and collects coverage even if coverage is disabled in the MATLAB Test Manager.

    example

    Examples

    collapse all

    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"
    

    Alternative Functionality

    App

    Clicking the Run button in the Code Quality Dashboard is equivalent to executing this function.

    Version History

    Introduced in R2024a