Main Content


Generate report file that contains metric results


    reportFile = generateReport(metricEngine) creates a PDF report of the metric results from metricEngine in the root folder of the project. Before you generate the report, collect metric results for the engine by using the execute function.


    reportFile = generateReport(metricEngine,Name,Value) specifies options using one or more name-value arguments. For example, 'Type','html-file' generates an HTML file.


    collapse all

    Analyze the requirements-based testing artifacts in a project and generate a report file that contains the results.

    Open the project that you want to analyze. For this example, open the project by using the command dashboardCCProjectStart.


    Create a metric.Engine object for the project.

    metric_engine = metric.Engine;

    Update the trace information for metric_engine to reflect any pending artifact changes and ensure that all test results are tracked.


    Create a list of the available metric identifiers.

    metric_ids = getAvailableMetricIds(metric_engine);

    Collect results by executing the metric engine on the list of metric identifiers.

    execute(metric_engine, metric_ids);

    Generate an HTML report named metricResultsReport in the current directory, which is the root folder of the project.

    reportLocation = fullfile(pwd, 'metricResultsReport.html');

    Open the HTML report from the root folder of the project. To open the table of contents and navigate to results for each unit, click the menu icon in the top-left corner of the report. For each unit in the report, there is an artifact summary table that displays the number of artifacts in the requirements, design, and tests.

    Input Arguments

    collapse all

    Metric engine object for which you collected metric results, specified as a metric.Engine object.

    Name-Value Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'Type','html-file'

    File type for the generated report, specified as 'pdf' or 'html-file'.

    Example: 'html-file'

    Full file name for the generated report, specified as a character vector or string scalar. Use the location to specify the name of the report. By default, the report is named untitled.

    Example: 'C:\MyProject\Reports\RBTResults.html'

    Output Arguments

    collapse all

    Full file name of the generated report, returned as a character vector.

    Introduced in R2021a