Now the axesPropertiesTest.m file is complete with a main function, file fixture
functions, fresh fixture functions, and two local test functions. You are ready to run the
tests.
Run Tests
The next step is to run the tests using the runtests function. In this example, the call to
runtests results in the following steps:
(^1) The main function creates a test array.
(^2) The file fixture records the working folder, creates a temporary folder, sets the
temporary folder as the working folder, then generates and saves a figure.
3 The fresh fixture setup opens the saved figure and finds the handles.
(^4) The testDefaultXLim test is run.
(^5) The fresh fixture teardown closes the figure.
(^6) The fresh fixture setup opens the saved figure and finds the handles.
(^7) The surfaceColorTest test is run.
(^8) The fresh fixture teardown closes the figure.
(^9) The file fixture teardown deletes the saved figure, changes back to the original path
and deletes the temporary folder.
At the command prompt, generate and run the test suite.
results = runtests('axesPropertiesTest.m')
Running axesPropertiesTest
..
Done axesPropertiesTest
results =
1x2 TestResult array with properties:
Name
Passed
Failed
Incomplete
Duration
Details
Write Test Using Setup and Teardown Functions