Simulink Design Verifier Test Generation Problem
조회 수: 3 (최근 30일)
이전 댓글 표시
Good Morning,
I'm facing some problems while using the Simulink Verifier Toolbox to generate a couple of test cases to be used as a unit-test later. My Matlab version is R2018b, the problems are the following:
- The option sldvoptions seems not to be working properly. I have noticed that certain properties does not produce the wanted results.
- When generating test while keeping the expected outputs, it sometimes store the input cutting the last sample of the signal.
In detail, I've encountered problem #1 while using the following options:
sldvoptions.Parameters
sldvoptions.ParametersConfigName
sldvoptions.SaveDataFile
They all seems to behave accordingly to what the GUI specifies (under Analysis > Design Verifier > Options), instead of being overwrited depending on what I write in the code.
For problem #2 I noticed that the "error" is connected to the Test Suite Optimization mode I chose. Indeed if I choose:
sldvoptions.TestSuiteOptimization = 'LongTestCases'
it works perfectly, and all the saved signals have the proper length. Whereas if I use:
sldvoptions.TestSuiteOptimization = 'LargeModel (Nonlinear Extended)'
which is better suited for my model and much quicker, the results produced miss the last sample. When the test case are stored in the modelname_sldvdata.mat file, timeValues and dataValues fields are long n-1, while the expectedOutput is n.
The implementation is the following
load_system(mdlFileName)
% Testing options
opts = sldvoptions;
opts.Mode = 'TestGeneration';
opts.TestSuiteOptimization = 'LargeModel (Nonlinear Extended)';
opts.AutomaticStubbing = 'off';
opts.OutputDir = 'test/sldv_output/$ModelName$';
opts.MaxProcessTime = 1200;
opts.MakeOutputFilesUnique = 'off';
opts.Parameters = 'on';
opts.ParametersConfigFileName = 'sldv_params.m';
opts.ModelCoverageObjectives = 'MCDC';
opts.SaveDataFile = 'on';
opts.SaveExpectedOutput = 'on';
opts.DisplayResultsOnModel = 'on';
opts.SaveHarnessModel = 'on';
otps.SaveReport = 'on';
opts.ReportIncludeGraphics = 'on';
opts.DisplayReport = 'on';
tic
% Generate tests and outputs
[status, files] = sldvrun(mdlFileName, opts, true);
% Coverage generation options
runOpts = sldvruntestopts;
runOpts.testIdx = [];
runOpts.coverageEnabled = true;
% Evaluate coverage
[outData, startCov] = sldvruntest(mdlFileName, files.DataFile, runOpts);
% Create coverage report
cvhtml([opts.OutputDir, 'cov_report'], startCov, '-bTC=1');
disp(' ')
disp("[INFO]: Tests were successfully generated. Check report for coverage information.")
toc
I hope I explained clearly. Thank you for the help.
댓글 수: 0
답변 (1개)
Pat Canny
2018년 11월 9일
Hi Davide,
Thanks for your question.
I recommend you contact MathWorks Support, as your issues may require an example model to be analyzed.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Generate Tests에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!