Main Content

openArtifact

Open traced artifact from metric result

Since R2020b

Description

example

openArtifact(metricEngine,artifactID) opens the artifact that has the specified identifier in the specified metric.Engine object. The editor that opens depends on the type of artifact, for example:

  • Requirements open in the Requirements Editor.

  • Test cases and test results open in the Test Manager.

Note that there is also a function openArtifact (Fixed-Point Designer) in the Fixed-Point Designer™ documentation.

Examples

collapse all

Collect metric results on the number of requirements linked to each test in a project. Then, open one of the test cases in the Test Manager.

Open the project. For this example, in the MATLAB® Command Window, enter:

openExample("slcheck/ExploreTestingMetricDataInModelTestingDashboardExample");
openProject("cc_CruiseControl");

Create a metric.Engine object for the project.

metric_engine = metric.Engine();

Update the trace information for metric_engine to ensure that the artifact information is up to date.

updateArtifacts(metric_engine)

Collect results for the metric 'RequirementsPerTestCase' by executing the metric engine.

execute(metric_engine,'RequirementsPerTestCase');

Use the function getMetrics to access the results.

results = getMetrics(metric_engine,'RequirementsPerTestCase');
for n = 1:length(results)
    disp(['Test Case: ',results(n).Artifacts(1).Name])
    disp(['  Number of Requirements: ',num2str(results(n).Value)])
end

Open the first test case in the Test Manager by using the artifact identifier.

openArtifact(metric_engine,results(1).Artifacts(1).UUID)

Input Arguments

collapse all

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

Artifact identifier, specified as a character vector or string scalar. In a metric.Result object, the Artifacts field contains a structure for each artifact that the result traces to. To get the identifier for an artifact, use the UUID field of the structure for the artifact.

Version History

Introduced in R2020b