How to export all the Test sequences from Simulink Test Manager as an excel file.
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Shubham
am 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.
Antworten (1)
Anshuman
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Inputs finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!