Unit test with several data sets
古いコメントを表示
Hi,
Suppose I'd like to write unit test for an image segmentation function. I'd like to know how would you perform unit tests with several data sets (i.e., testing that single function on several image samples, which have different expected values).
I tried these codes, but I am not sure if this is the way to go (especially the for ... end). Also, I want to track for which image the test didn't pass, but verifyEqual does not return a value to test that.
So far, I created a subfolder for each image test where I put data like expected value for that image.
for iCase = 1:length(testCase.TestData.data)
data = testCase.TestData.data(iCase); % read/load the current data, with the expected value for the current image sample
actSol = functionToBeTested(); % computed value
expSol = data.value; % expected value
verifyEqual(testCase, actSol, expSol);
end
I found this solution in 2014:
I don't know if this is an appropriate approach for me.
Thank you,
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Results, Reporting, and Test File Management についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!