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

How do I programmatically change the external file location for the sltest.testmanager.TestCase class?

 採用された回答

MathWorks Support Team
MathWorks Support Team 2022 年 9 月 29 日
編集済み: MathWorks Support Team 2022 年 9 月 29 日
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 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink Test についてさらに検索

製品

リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by