Clear Filters
Clear Filters

How to export all the Test sequences from Simulink Test Manager as an excel file.

24 views (last 30 days)
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
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.

Sign in to comment.

Answers (1)

Anshuman
Anshuman on 11 Sep 2024 at 7:53
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:
Hope this helps!

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!