Can I find/see the requirement I linked inside a test sequence that is inside a test harness in Simulink with Matlab script?

3 次查看(过去 30 天)
I tried using the line of code below...
sltest.testsequence.readStep([model,'/Test Sequence'],steps{g})
...hoping to catch the linked requirement inside the Test Sequence step. However I only get the struct with the fields:
Name:
Action:
IsWhenStep:
IsWhenSubStep:
Description:
TransitionCount:
Is there a way I could try to see the requirement just through Matlab Script?

回答(1 个)

Raymond Estrada
Raymond Estrada 2023-2-10
Here's how you can do this via existing APIs (using our do178CaseStudyStart demo)
%Block path to test sequence diagram
myTS = 'AHRS_Voter_Harness_HLR_12/Test Sequence';
%extract steps
myTS_steps = sltest.testsequence.findStep("AHRS_Voter_Harness_HLR_12/Test Sequence");
%Get the Stateflow object for the Test Sequence block
tsObj = root.find("-isa", "Stateflow.ReactiveTestingTableChart", "Path", "AHRS_Voter_Harness_HLR_12/Test Sequence");
%Loop through all steps to extract requirement information
for ii=1:length(myTS_steps)
state_step = tsObj.find('-isa', 'Stateflow.State', 'Name', myTS_steps{ii}); %Stateflow object for the step "chart"
outlinks = slreq.outLinks(state_step); %Get outlinks for the step "chart"
dest = arrayfun(@(x) x.destination, outlinks{ii,1}); %Get the destination information
%Example of packaging the data
reqInfo.(myTS_steps{ii}).path = state_step.Path;
reqInfo.(myTS_steps{ii}).stepContent = state_step.LabelString;
reqInfo.(myTS_steps{ii}).reqLinks = dest{ii,1};
end

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by