帮助中心帮助中心
类: matlab.unittest.plugins.Parallelizable 包: matlab.unittest.plugins
指定插件何时支持并行运行测试
自 R2019b 起
tf = supportsParallel(plugin)
示例
如果 plugin 支持并行运行测试,则 tf = supportsParallel(plugin) 返回逻辑值 1 (true);如果 plugin 仅支持在串行模式下运行测试,则返回逻辑值 0 (false)。
plugin
1
true
0
false
在某些情况下,当 TestRunner 通过插件进行扩展后,将无法并行运行测试。覆盖 supportsParallel 以指定插件不能用于并行运行测试的情况。
TestRunner
supportsParallel
并行运行测试需要 Parallel Computing Toolbox™。
全部展开
Parallelizable
插件对象,指定为插件类的实例,该插件类子类化 matlab.unittest.plugins.Parallelizable 接口。
matlab.unittest.plugins.Parallelizable
ExamplePlugin 是可并行化的插件,默认情况下将文本输出定向到屏幕。覆盖 supportsParallel,以指定当插件将文本输出写入文件时,测试仅在串行模式下运行。
ExamplePlugin
classdef ExamplePlugin < ... matlab.unittest.plugins.TestRunnerPlugin & ... matlab.unittest.plugins.Parallelizable properties Output (1,1) string = "StandardOutput" end methods function plugin = ExamplePlugin(stream) if nargin == 1 plugin.Output = stream; end end function tf = supportsParallel(plugin) tf = (plugin.Output == "StandardOutput"); end end end
在 R2019b 中推出
matlab.unittest.plugins.TestRunnerPlugin | matlab.automation.streams.OutputStream
matlab.unittest.plugins.TestRunnerPlugin
matlab.automation.streams.OutputStream
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office