How to export all the Test sequences from Simulink Test Manager as an excel file.
15 views (last 30 days)
Show older comments
I am reviewing some older models, and I wish to be able to extract all Test Sequences for all Simulink Test Manager Files into an office document.
1 Comment
Shubham
on 17 Jul 2024
Hi Mark,
I understand that you are looking to export all the Test sequences from Simulink Test Manager as an excel file.
Currently, there's no automated way to achieve your task. However, you can use a workaround detailed in the following MATLAB Answer:
Hope it helps.
Answers (1)
Anshuman
on 11 Sep 2024
Hello,
To extract test sequences from Simulink Test Manager, you can use the appropriate Simulink Test API functions. Here's how you can do it:
% Load the test manager
sltest.testmanager.load;
% Load a specific test file
testFile = sltest.testmanager.TestFile('your_test_file.mldatx');
% Get test suites from the test file
testSuites = testFile.getTestSuites;
% Initialize a cell array to store test sequences
testSequences = {};
% Loop through each test suite
for i = 1:length(testSuites)
testCases = testSuites(i).getTestCases;
% Loop through each test case
for j = 1:length(testCases)
% Check if the test case has a Test Sequence block
testSequence = findTestSequence(testCases(j));
if ~isempty(testSequence)
% Store the test sequence information
testSequences{end+1} = testSequence;
end
end
end
% Display the extracted test sequences
disp(testSequences);
% Helper function to find Test Sequence blocks
function testSequence = findTestSequence(testCase)
% Initialize testSequence as empty
testSequence = [];
% Check for Test Sequence blocks in the model
blocks = find_system(model, 'BlockType', 'TestSequence');
% If Test Sequence blocks are found, store their names
if ~isempty(blocks)
testSequence = blocks;
end
end
Once you have extracted the test sequences, you can export them to an Office document using MATLAB's report generation capabilities. MATLAB's Report Generator toolbox helps in automating the creation of a Word or PDF document containing the test sequences. Here are few documentations links that you can refer for this purpose:
- https://in.mathworks.com/help/rptgen/ug/mlreportgen.dom.document-class.html?searchHighlight=document&s_tid=srchtitle_support_results_3_document
- https://in.mathworks.com/help/rptgen/ug/mlreportgen.dom.paragraph-class.html
- https://in.mathworks.com/help/rptgen/ug/mlreportgen.dom.paragraph.append.html?searchHighlight=append&s_tid=srchtitle_support_results_3_append
Hope this helps!
0 Comments
See Also
Categories
Find more on Inputs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!