Hauptinhalt

digitalthread.uri.simulinktest.fromObject

R2026b

Get digital thread URI from Simulink Test object

Since R2026b

    Description

    uri = digitalthread.uri.simulinktest.fromObject(storageMap,testObj) returns the digital thread URI for the Simulink® Test™ object specified by testObj.

    A digital thread URI is a stable identifier for an artifact, such as a test file, or an artifact within that file, such as a test iteration. The digital thread uses these URIs as a consistent way to refer to artifacts across tools and inside metric results.

    Use this function to find the digital thread URI for a specific Simulink Test object. You can then use that URI as an identifier in your code to match and filter metric results for that specific object.

    If you need to convert from a digital thread URI to a Simulink Test object, use the function digitalthread.uri.simulinktest.toObject.

    example

    Examples

    collapse all

    Suppose you want to analyze metric results for a specific Simulink Test object, such as a test iteration in your test file.

    Create a storage map for the current project.

    storageMap = digitalthread.StorageMap.forProject();

    Get the Simulink Test object of interest by using the Simulink Test APIs. For example, to get a test iteration object:

    tf = sltest.testmanager.TestFile(which("myTests.mldatx"));
    tc = getAllTestCases(tf);
    myTestObj = tc.getIterations
    myTestObj = 
    
      TestIteration with properties:
    
                        Name: 'Iteration1'
                 Description: ''
                     Enabled: 1
                 ModelParams: {}
                  TestParams: {{1×3 cell}  ... }
                   Variables: {}
        RoadRunnerProperties: {}
                    TestCase: [1×1 sltest.testmanager.TestCase]

    Find the digital thread URI for that Simulink Test object.

    myURI = digitalthread.uri.simulinktest.fromObject(storageMap,myTestObj)
    myURI = 
    
        "mwdigitalthread://myProject/myTests.mldatx#addr=2a2aafdf-a5f4-4948-9d3d-94eb7fbbf780"

    Using that digital thread URI, you can index into metric results to identify and extract metric results related to this specific Simulink Test object.

    Input Arguments

    collapse all

    Storage map, specified as a digitalthread.StorageMap object.

    A storage map defines how digital thread URIs map to the actual artifact locations. The storage map determines which artifacts the digital thread can reference, trace, and associate with metric results.

    To create a storage map, use digitalthread.StorageMap.forProject.

    Example: digitalthread.StorageMap.forProject()

    Simulink Test object, specified as either a:

    Output Arguments

    collapse all

    Digital thread URI that identifies the Simulink Test object, returned as a string scalar.

    Use the URI as an identifier in your code to match and filter metric results for the specific test object.

    Note

    Do not manually parse or construct digital thread URIs. Use the digitalthread.uri APIs to work with digital thread URIs.

    The digital thread URI format is subject to change without notice.

    Example: "mwdigitalthread://myProject/myTests.mldatx#addr=123-abc"

    Data Types: string

    Version History

    Introduced in R2026b