Main Content

getRequirementLinks

Get locally stored requirement traceability links from OSLC test resource object

    Description

    example

    reqs = getRequirementLinks(testResource) returns the requirement resource associated with the rdf:resource attribute of the RDF/XML element oslc_qm:validatesRequirement for the test case or test script specified by testResource. For more information about RDF/XML elements, see An XML Syntax for RDF on the World Wide Web Consortium website and QM Resource Definitions on the Open Services for Lifecycle Collaboration (OSLC) website.

    Examples

    collapse all

    This example shows how to add, remove, and get OSLC requirement resources linked to a test case resource with a previously configured OSLC client.

    After you have created and configured an OSLC client myClient as described in Create and Configure an OSLC Client for the Quality Management Domain, create a query capability for the test case resource type.

    myQueryCapability = getQueryService(myClient,'TestCase');

    Submit a query request to the service provider for the available test case resources.

    testCases = queryTestCases(myQueryCapability)
    testCases = 
    
      1×5 TestCase array with properties:
    
        ResourceUrl
        Dirty
        IsFetched
        Title
        Identifier

    Retrieve the requirement resources linked to one of the test cases. Fetch the resource properties from the service provider for the test case.

    myTestCase = testCases(1);
    fetch(myTestCase,myClient);
    reqs = getRequirementLinks(myTestCase)
    reqs = 
    
        Requirement with properties:
    
        ResourceUrl: 'https://localhost:9443/rm/resources/_aQ1gRg8bEeuLWbFe'
              Dirty: 1
          IsFetched: 0
              Title: ''
         Identifier: ''

    Remove the existing link to the requirement resource from the test case resource. Commit the changes to the service provider.

    removeRequirementLink(myTestCase,reqs.ResourceUrl);
    status = commit(myTestCase,myClient)
    status = 
    
      StatusCode enumeration
    
        OK

    To add a link to a requirement, in the OSLC service provider, locate the requirement resource that you want to link to the test case resource. Identify the resource URL. Create a variable URL and set the value of the variable to the requirement URL that you found in the service provider.

    URL = 'https://localhost:9443/rm/resources/_oJNtgWrqEeup0a6t';

    Create a traceability link between the requirement resource and the test case. Commit the change to the service provider.

    addRequirementLink(myTestCase,URL);
    status = commit(myTestCase,myClient)
    status = 
    
      StatusCode enumeration
    
        OK

    View the test case in the system browser.

    show(myTestCase)

    Input Arguments

    collapse all

    OSLC test resource, specified as an oslc.qm.TestCase or oslc.qm.TestScript object.

    Output Arguments

    collapse all

    OSLC requirement or requirement collection resource object, returned as an oslc.rm.Requirement or oslc.rm.RequirementCollection object.

    Introduced in R2021a