Main Content


Run tests and refresh data in Code Quality Dashboard

Since R2024a



    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.


    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.


    collapse all

    This example shows how to update, get, and export metrics from the Code Quality Dashboard.

    Open the ShortestPath project.


    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.


    Get the metrics from the Code Quality Dashboard.

    metrics = matlabtest.codequalitydashboard.getMetrics
    metrics = struct with fields:
        ProjectPath: "C:\Users\jdoe\MATLAB\MATLABShortestPath"
         ExportTime: '2023-11-17T15:49:53***'
            Metrics: [1×1 struct]

    Export the metrics to a JSON file.

    filePath = matlabtest.codequalitydashboard.exportMetrics
    filePath = 

    Alternative Functionality


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

    Version History

    Introduced in R2024a