メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

sltest.testmanager.TestResultReport クラス

名前空間: sltest.testmanager

生成された結果レポートをカスタマイズする

説明

sltest.testmanager.TestResultReport は、テスト マネージャーからの結果のレポート生成をカスタマイズできるクラスです。クラスを派生させて、さまざまなメソッドをオーバーライドしてレポートをカスタマイズできます。メソッドをカスタマイズすることで、レポート タイトル、プロット、テーブル、ヘッダー、アイコンなどを変更できます。

レポートのカスタマイズの詳細と例については、Customize Test Results Reportsを参照してください。

sltest.testmanager.TestResultReport クラスは handle クラスです。

クラス属性

HandleCompatible
true

クラス属性の詳細については、クラスの属性を参照してください。

作成

Obj = sltest.testmanager.TestResultReport(resultObjects,reportFilePath) は、レポート生成オブジェクトを作成します。

このクラスを使用するには、このクラスから継承する必要があります。クラスから継承するには、次のコードを、クラス定義コードの最初の行として使用します。

% class definition
classdef CustomReport < sltest.testmanager.TestResultReport
    %
    % Report customization code here
    %
end

入力引数

すべて展開する

結果を取得する結果セット オブジェクト。sltest.testmanager.ResultSet オブジェクトとして指定します。

生成されるレポートのファイル名とパス。ファイル パスには、ファイル拡張子 pdf、docx、または zip を含める必要があります。これらのファイル タイプのみがサポートされます。

例: 'C:\MATLAB\Report.pdf'

プロパティ

すべて展開する

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

本文段落のテキストのフォント カラー。文字ベクトルとして指定します。

例: 'Red'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

本文段落のテキストのフォント スタイル名。文字ベクトルとして指定します。

例: 'Times New Roman'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

本文段落のテキストのフォント サイズ。ポイント単位で文字ベクトルとして指定します。

例: '14pt'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

第 1 レベルの節のインデント幅。ミリメートル単位で文字ベクトルとして指定します。

例: '5mm'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

第 2 レベルの節のインデント幅。ミリメートル単位で文字ベクトルとして指定します。

例: '8mm'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

第 3 レベルの節のインデント幅。ミリメートル単位で文字ベクトルとして指定します。

例: '10mm'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

レポートのカスタマイズに使用する Microsoft® Word テンプレート ファイルのファイル名とパス。文字ベクトルとして指定します。テンプレート ファイルの使用の詳細については、Generate Reports Using Templatesを参照してください。この引数の使用は、MATLAB® Report Generator™ のライセンスがある場合にのみ有効です。

例: 'C:\MATLAB\CustomReportTemplate.dotx'

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

節の見出しのテキストのフォント カラー。文字ベクトルとして指定します。

例: 'Blue'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

節の見出しのテキストのフォント スタイル名。文字ベクトルとして指定します。

例: 'Times New Roman'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

節の見出しのテキストのフォント サイズ。ポイント単位で文字ベクトルとして指定します。

例: '16pt'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

無効なテスト結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\disabled_test_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

失敗したテスト結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\failed_test_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

未完了のテスト結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\incomplete_test_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

不整合なテスト結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\misaligned_test_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

パスしたテスト結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\passed_test_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

テスト ケース結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\test_case_result_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

テスト ファイル結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\test_file_result_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

反復結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\iteration_result_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

テスト スイート結果のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\test_suite_result_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

カバレッジ レポートのモデル参照のアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\model_reference_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

カバレッジ レポートの最上位モデルのアイコン イメージのファイル名とパス。文字ベクトルとして指定します。指定されたアイコン ファイルは、既定のアイコン イメージを置き換えます。アイコン イメージは 16x16 ピクセルに縮小されます。

例: 'C:\MATLAB\top_level_model_icon.png'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

レポートに信号比較プロットを含めます。true または false として指定します。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

レポートにカバレッジ結果を含めます。true または false として指定します。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

レポートにエラー メッセージを含めます。true または false として指定します。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

レポートに、テストの実行に使用された MATLAB のバージョンを含めます。true または false として指定します。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

レポートにシミュレーション メタデータを含めます。true または false として指定します。メタデータには、Simulink® モデル、モデル バージョン、モデル パス、シミュレーション モード、SIL または PIL モードのオーバーライド、構成セット、バリアント構成、ソルバーの名前とタイプ、最大ステップ サイズ、開始時間と終了時間、チェックサム、ユーザー ID、マシン名、プラットフォーム、Simulink のバージョンとリリースが含まれます。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

レポートにシミュレーション信号出力プロットを含めます。true または false として指定します。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

レポートに、テスト ファイル、テスト スイート、またはテスト ケースにリンクされているテスト要件を含めます。true または false として指定します。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

すべてまたは一部のテスト結果をレポートに含めます。パスした結果と失敗した結果をすべて選択 (値 0 として指定) するか、パスした結果のみを選択 (値 1 として指定) するか、失敗した結果のみを選択 (値 2 として指定) できます。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

レポートの生成が完了したら開きます。ブール値の true または false (レポートを開かない場合) として指定します。

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

レポートのタイトル。文字ベクトルとして指定します。

例: 'Test Case Report'

属性:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

節の間隔。ミリメートル単位で文字ベクトルとして指定します。

例: '5mm'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

プロットの高さ。ピクセル単位で文字ベクトルとして指定します。

例: '500px'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

プロットの幅。ピクセル単位で文字ベクトルとして指定します。

例: '400px'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

テーブルのフォント カラー。文字ベクトルとして指定します。

例: 'Blue'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

テーブルのフォント スタイル名。文字ベクトルとして指定します。

例: 'Times New Roman'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

テーブルのフォント サイズ。ポイント単位で文字ベクトルとして指定します。

例: '10pt'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

タイトルのフォント カラー。文字ベクトルとして指定します。

例: 'Blue'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

タイトルのフォント スタイル名。文字ベクトルとして指定します。

例: 'Times New Roman'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

タイトルのフォント サイズ。ポイント単位で文字ベクトルとして指定します。

例: '20pt'

属性:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

メソッド

すべて展開する

すべて折りたたむ

% class definition
classdef CustomReport < sltest.testmanager.TestResultReport
    % This custom class used by Test Manager 
    % adds a custom message in the title page

    % Class constructor
    methods
        function this = CustomReport(resultObjects, reportFilePath)
            this@sltest.testmanager.TestResultReport...
               (resultObjects,reportFilePath);
        end
    end

    methods(Access=protected)
        function addTitlePage(obj)
            import mlreportgen.dom.*;

            % Call the superclass method to get the default behavior
            addTitlePage@sltest.testmanager.TestResultReport(obj);

            % Add a custom message
            label = Text('Some custom content can be added here');
            append(obj.TitlePart,label);
        end
    end
end
% import existing results or use sltest.testmanager.run to run tests
% and collect results
result = sltest.testmanager.importResults('testResults.mldatx');
filePath = 'testreport.zip';
sltest.testmanager.report(result,filePath,...
			'Author','User',...
			'Title','Test',...
			'IncludeMLVersion',true,...
			'IncludeTestResults',int32(0),...
			'CustomReportClass','CustomReport',...
			'LaunchReport',true);

バージョン履歴

R2016a で導入