Hauptinhalt

digitalthread.uri.simulinktest.toObject

R2026b

Convert digital thread URI to Simulink Test object

Since R2026b

    Description

    testObj = digitalthread.uri.simulinktest.toObject(storageMap,testURI) returns the Simulink® Test™ object identified by the digital thread URI and loads the associated test file.

    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 retrieve the Simulink Test object identified by the digital thread URI. You can then work directly with that object.

    You might already have a digital thread URI of interest from your metric results. If not, you can get the digital thread URI from a specific Simulink Test object by using the other functions in the digitalthread.uri.simulinktest namespace, such as digitalthread.uri.simulinktest.fromObject.

    example

    testObj = digitalthread.uri.simulinktest.toObject(___,Load=false) returns the Simulink Test object without loading the test file.

    Examples

    collapse all

    Suppose you already have a digital thread URI for a Simulink Test object that appears in your metric results. You can get the associated object by using the digitalthread.uri.simulinktest.toObject function.

    For example, suppose the ScopeId property for one of your metric results shows a digital thread URI mwdigitalthread://myProject/myTests.mldatx#addr=7b897a66-28bd-4111-95ec-6096ab814a7c and you save that URI to a variable.

    myURI = "mwdigitalthread://myProject/myTests.mldatx#addr=7b897a66-28bd-4111-95ec-6096ab814a7c";

    Create a storage map for the current project.

    storageMap = digitalthread.StorageMap.forProject();

    Find the Simulink Test object associated with that digital thread URI.

    myObj = digitalthread.uri.simulinktest.toObject(storageMap,myURI)
    myObj = 
    
      TestIteration with properties:
    
                        Name: 'Iteration1'
                 Description: ''
                     Enabled: 1
                 ModelParams: {}
                  TestParams: {{1×3 cell}  ...}
                   Variables: {}
        RoadRunnerProperties: {}
                    TestCase: [1×1 sltest.testmanager.TestCase]

    You can use the object properties and Simulink Test functions, such as sltest.testmanager.load and sltest.testmanager.view, to work with the 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()

    Digital thread URI for Simulink Test object, specified as a string scalar.

    You can get digital thread URIs from metric results, functions in the digitalthread.uri.simulinktest namespace, and other functions in the digitalthread.uri namespace.

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

    Data Types: string

    Output Arguments

    collapse all

    Simulink Test object, returned as either a:

    Version History

    Introduced in R2026b