Simulink Design Verifier Test Generation Problem
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Pat Canny
el 9 de Nov. de 2018
Hi Davide,
Thanks for your question.
I recommend you contact MathWorks Support, as your issues may require an example model to be analyzed.
0 comentarios
Ver también
Categorías
Más información sobre Generate Tests en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!