MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

methods (Test)
function testClass(testCase,dim1,dim2,type)
testCase.verifyClass(rand(dim1,dim2,type), type)
end
end
end


Create Suite from All Tests


At the command prompt, create a suite from TestRand.m class.


suite = matlab.unittest.TestSuite.fromClass(?TestRand)


suite =


1×279 Test array with properties:


Name
ProcedureName
TestClass
BaseFolder
Parameterization
SharedTestFixtures
Tags


Tests Include:
17 Unique Parameterizations, 0 Shared Test Fixture Classes, 0 Tags.


The test suite contains 279 test elements. For a given TestClassSetup and
TestMethodSetup parameterization, the framework creates 3+10+18=31 test elements.
These 31 elements are called three times—once for each TestMethodSetup
parameterization resulting in 331=93 test elements for each TestClassSetup
parameterization. There are three TestClassSetup parameterizations resulting in a
total of 3
93=279 test elements.


Examine the names of the first test element.


suite(1).Name


ans =


'TestRand[generator=twister]/[seed=value1]testClass(dim1=small,dim2=small,type=single)'


The name of each element is constructed from the combination of the following:


Create Advanced Parameterized Test
Free download pdf