MATLAB: Programmatically Change sltest.tes​tmanager.T​estCase external file location

externalfilemanagersimulink testtest

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

Best Answer

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.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 the test case beforehand for this to apply.