- Set data saving format as "Dataset" in "Data Import/Export" section of Model configuration parameters.
- In Simulink Test Manager, navigate to Custom Crieria section and assign the Iteration Results in the base workspace.
How to export test manager results to a dataset programmatically?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
William Curry
el 18 de Dic. de 2019
Editada: Shishir Dwivedi
el 22 de En. de 2020
I'm trying to export test manager results to a dataset object so I can later import it into the Simulink Data Inspector. When you use the sl.testmanager.exportResults function it only exports in the '.mldatx' format. You can manually export test manager results but only on individual result sets so it take a lot of time to export a large list of tests.
0 comentarios
Respuesta aceptada
Shishir Dwivedi
el 27 de Dic. de 2019
Hello William,
You can perform following steps to achive the goal.
assignin('base', sltest_iterationName, sltest_simout);
This will create SimulationOutput variable(s) in the base workspace corresponding to Iteration names, once test execution is done you can extract Dataset values from SimulationOutput for further processing.
-Shishir.
2 comentarios
Joseph Krese
el 21 de En. de 2020
Hi Shishir,
I attempted to use this command, but it wil not return the name of the test. When I run the test with that command in the custom criteria, I get an error that the sltest_iterationName variable is blank. Working with Bill, we tried several different things to return the current test case name, but have been unsuccessful so far. sltest_iterationName is listed in the comments of the custom criteria as being available, so I'm not sure why we can't get the test name? Can you provide any help with that?
Shishir Dwivedi
el 22 de En. de 2020
Editada: Shishir Dwivedi
el 22 de En. de 2020
Hello Joseph,
I understand that you want to get Test case name from the execution results. Can you please try following command(s) in custom criteria section and let me know if it answers your query.
assignin('base', 'TestCaseName', sltest_testCase.Name);
This command will create a variable in Base Workspace with name "TestCaseName", the value of this variable would store test case name as defined in Test manager.
Now, if you want the test case name to store test case object, you can use following commands.
tcName = matlab.lang.makeValidName(sltest_testCase.Name);
%Note: The test case name can contain spaces/special characters which might not be %valid variable name(s), hence creating a valid variable name here to assign in the %base workspace
assignin('base', tcName, sltest_testCase); %copy test case object to the test case variable.
In case you want to know test iterations name, please use following commands in custom criteria section.
testIterations = getIterations(sltest_testCase);
assignin('base', 'testIterations', {testIterations.Name});
Hope this helps !
Best Regards,
Shishir.
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!