MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
end
end

methods(TestMethodSetup)
function setupMethod1(testCase)
testCase.assumeEqual(1,0)
% remaining test code is not exercised
end
function setupMethod2(testCase)
disp('* Running setupMethod2 *')
testCase.assertEqual(1,1)
end
end

methods(Test)
function testA(testCase)
testCase.verifyTrue(true)
end
function testB(testCase)
testCase.assumeEqual(0,1)
% remaining test code is not exercised
end
function testC(testCase)
testCase.verifyFalse(true)
end
end
end

When you run the test, you see that the framework does not execute any of the methods
in the TestMethodSetup or Test.

ts = matlab.unittest.TestSuite.fromClass(?ExampleTest);
res = ts.run;

Running ExampleTest

================================================================================
All tests in ExampleTest were filtered.
Details
================================================================================

Done ExampleTest
__________

Failure Summary:

33 Unit Testing

Free download pdf