Is it possible to combine parameterized and non-parameterized tests in the same test class?
Show older comments
I am writing class-based units tests based on matlab.unittest.TestCase. The tests are currently parameterized in the following way, and everything works as expected:
classdef TestSomething < matlab.unittest.TestCase
properties
testParam
end
properties (MethodSetupParameter)
testParamInputs = {[1, 2], [3, 4]}
end
methods (TestMethodSetup, ParameterCombination="sequential")
function setupFunction(testCase, testParamInputs)
testCase.testParam = doSomething(testParamInputs);
end
end
methods (Test, ParameterCombination="sequential")
function testFunction(testCase)
% Test something.
end
end
end
My question is whether it is possible to also include non-parameterized tests (i.e., tests that run only once) in the same class?
I know it's possible if I just define properties(TestParameter) and have some tests that don't take the test parameter/s as an input. But I'm wondering if it's possible in my case given TestMethodSetup is parameterized.
Accepted Answer
More Answers (0)
Categories
Find more on Write Unit Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!