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

15 次查看(过去 30 天)
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 个评论
Shubham
Shubham 2024-7-17
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.

请先登录,再进行评论。

回答(1 个)

Anshuman
Anshuman 2024-9-11
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!

类别

Help CenterFile Exchange 中查找有关 Inputs 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by