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

3 visualizaciones (últimos 30 días)
How do I programmatically change the external file location for the sltest.testmanager.TestCase class?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 29 de Sept. de 2022
Editada: MathWorks Support Team el 29 de Sept. de 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.

Más respuestas (0)

Categorías

Más información sobre Test Scripts en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by