- 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?
19 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Shishir Dwivedi
2019-12-27
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 个评论
Joseph Krese
2020-1-21
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
2020-1-22
编辑:Shishir Dwivedi
2020-1-22
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Test Scripts 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!