メインコンテンツ

supportsParallel

クラス: matlab.unittest.plugins.Parallelizable
名前空間: matlab.unittest.plugins

プラグインがテストの並列実行をサポートしているかどうかを判別

説明

tf = supportsParallel(plugin) は、plugin がテストの並列実行をサポートする場合は logical 1 (true) を返し、plugin が逐次モードでのみテストの実行をサポートする場合は logical 0 (false) を返します。

特定の状況では、テスト ランナーがプラグインで拡張されているとテストを並列実行できません。supportsParallel をオーバーライドし、テストを並列実行するためにプラグインを使用できない状況を指定します。

テストを並列実行するには Parallel Computing Toolbox™ が必要です。

入力引数

すべて展開する

プラグイン。matlab.unittest.plugins.Parallelizable インターフェイスをサブクラス化するプラグイン クラスのインスタンスとして指定します。

すべて展開する

テキスト出力を既定で画面に送る並列化可能プラグインを作成します。プラグインがテキストをファイルに書き込む場合は逐次モードでのみテストを実行するように、supportsParallel メソッドをオーバーライドします。

classdef ExamplePlugin < ...
        matlab.unittest.plugins.TestRunnerPlugin & ...
        matlab.unittest.plugins.Parallelizable

    properties (SetAccess = immutable)
        Output
    end

    methods
        function plugin = ExamplePlugin(stream)
            arguments
                stream (1,1) string = "StandardOutput"
            end
            plugin.Output = stream;
        end

        function tf = supportsParallel(plugin)
            tf = (plugin.Output == "StandardOutput");
        end
    end
end

バージョン履歴

R2019b で導入