How do I programmatically change the external file location for sltest.testmanager.TestCase?
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 25 Jun 2020
Edited: MathWorks Support Team
on 29 Sep 2022
How do I programmatically change the external file location for the sltest.testmanager.TestCase class?
Accepted Answer
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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Test Scripts in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!