Main Content

padv.util.getTestCaseID

Find ID for test case that contains artifact

    Description

    testCaseID = padv.util.getTestCaseID(artifact) returns the ID for the test case that contains artifact.

    This functionality requires CI/CD Automation for Simulink Check.

    example

    Examples

    collapse all

    Find the test case ID for a test case by using padv.util.getTestCaseID.

    Open the Process Advisor example project. In the MATLAB® Command Window, enter:

    processAdvisorExampleStart

    Create a query that can find the test cases in the project. Since test cases are part of a larger test file, test cases are subfile artifacts and you must specify FilterSubFileArtifacts as false to stop the query from filtering out the test cases.

    q = padv.builtin.query.FindArtifacts(ArtifactType = "sl_test_case",...
    FilterSubFileArtifacts = false);

    Find the test cases in the project by running the query. The query returns the as an array of padv.Artifact objects.

    testCaseArtifacts = run(q);

    Find the test case ID for one of the test cases returned by the query.

    id = padv.util.getTestCaseID(testCaseArtifacts(1))

    Input Arguments

    collapse all

    Artifact information, specified as a padv.Artifact object.

    You can create a padv.Artifact object either by:

    • Running a built-in query. When you run a built-in query, the query returns either a padv.Artifact object or an array of padv.Artifact objects.

    • Using the padv.Artifact class.

    Example: padv.Artifact("sl_model_file",padv.util.ArtifactAddress(fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx")))

    Output Arguments

    collapse all

    ID for the test case that contains the artifact, returned as a string.