How do I programmatically change the external file location for sltest.tes​tmanager.T​estCase?

3 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Sep 2022
Edited: MathWorks Support Team on 29 Sep 2022
To change the checkbox for "Create Test Case from External File", use the "setProperty" method with the argument "IsTestDataReferenced".
Additionally, you can change the file with the "TestDataPath" argument to change the external file location.
For example, given a test case "tc" in the workspace:
tc = createTestCase(ts, 'my_test');
setProperty(tc,'Model', 'my_test_model');
tc.setProperty('IsTestDataReferenced', true);
tc.setProperty('TestDataPath', 'some/path/to/file');
This syntax allows the programmatic use you desired. You will need to add a model to the test case beforehand for this to apply.
Note that although the "IsTestDataReferenced" and "TestDataPath" properties have only been documented since R2021b, they have been available since the feature was introduced in R2018b.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!