The testing framework can divide the test suite into separate groups and run each group on the current parallel pool (requires Parallel Computing Toolbox™). Create a plugin that adds the group number to TestResult
objects.
In a file in your current folder, create the parallelizable plugin class
ExamplePlugin
, which overrides the
runTestSuite
method of TestRunnerPlugin
. Add a
Group
field containing the group number to the
Details
property of the TestResult
objects
corresponding to the group.
In your current folder, create a file named ExampleTest.m
containing this parameterized test class. This class results in 300 tests for
comparing pseudorandom integers between 1 and 10.
At the command prompt, create a test suite from the ExampleTest
class.
Create a TestRunner
instance with no plugins, add
ExamplePlugin
to the runner, and then run the tests in
parallel.
Split tests into 18 groups and running them on 6 workers.
----------------
Finished Group 1
----------------
----------------
Finished Group 2
----------------
----------------
Finished Group 3
----------------
----------------
Finished Group 4
----------------
----------------
Finished Group 5
----------------
----------------
Finished Group 6
----------------
----------------
Finished Group 7
----------------
----------------
Finished Group 8
----------------
----------------
Finished Group 9
----------------
-----------------
Finished Group 10
-----------------
-----------------
Finished Group 11
-----------------
-----------------
Finished Group 12
-----------------
-----------------
Finished Group 13
-----------------
-----------------
Finished Group 14
-----------------
-----------------
Finished Group 15
-----------------
-----------------
Finished Group 16
-----------------
-----------------
Finished Group 17
-----------------
-----------------
Finished Group 18
-----------------
Retrieve the group number for the first and last Test
elements.
groupOfFirst =
1
groupOfLast =
18