Clear Filters
Clear Filters

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

2 views (last 30 days)
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 Comment
Nikhil Boddula
Nikhil Boddula on 27 May 2021
Even I'm trying for the same. Please post line of code how to catch the linked requirement inside the Test Sequence step if you have got resolved.

Sign in to comment.

Answers (1)

Raymond Estrada
Raymond Estrada on 10 Feb 2023
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

Community Treasure Hunt

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

Start Hunting!