How do I programmatically change the external file location for sltest.testmanager.TestCase?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 25 de Jun. de 2020
Editada: MathWorks Support Team
el 29 de Sept. de 2022
How do I programmatically change the external file location for the sltest.testmanager.TestCase class?
Respuesta aceptada
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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Test Scripts en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!