Unit test with several data sets
Afficher commentaires plus anciens
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,
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Results, Reporting, and Test File Management dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!