Main Content

openArtifact

Open testing artifact traced from the metric result

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:

  • Requirements open in the Requirements Editor.

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

Examples

collapse all

Collect metric data 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. At the command line, type dashboardCCProjectStart.

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.

updateArtifacts(metric_engine)

Collect results for the metric Requirements per test case 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
Test Case: Set button
  Number of Requirements: 0
Test Case: Decrement button hold
  Number of Requirements: 1
Test Case: Resume button
  Number of Requirements: 1
Test Case: Cancel button
  Number of Requirements: 1
Test Case: Decrement button short
  Number of Requirements: 2
Test Case: Increment button hold
  Number of Requirements: 1
Test Case: Increment button short
  Number of Requirements: 2
Test Case: Enable button
  Number of Requirements: 1

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.

Introduced in R2020b