table
クラス: matlab.unittest.TestResult
名前空間: matlab.unittest
TimeResult 配列から timetable への変換
説明
入力引数
テスト スイートの実行結果。matlab.unittest.TestResult 配列として指定します。
例
一連のテスト結果から table を作成し、table を使用して結果を並べ替え、CSV ファイルにエクスポートします。
現在のフォルダー内に、ExampleTest クラスを含むファイルを作成します。
classdef ExampleTest < matlab.unittest.TestCase methods(Test) function testOne(testCase) testCase.verifySize([1 2 3; 4 5 6],[2 3]); end function testTwo(testCase) testCase.verifyClass(@sin,?function_handle); end function testThree(testCase) testCase.assertEqual(7*2,14) end end end
コマンド プロンプトで ExampleTest クラスからテスト スイートを作成してテストを実行します。
results = run(testsuite('ExampleTest'));
Running ExampleTest ... Done ExampleTest __________
配列 results から table を作成します。
rt = table(results)
rt =
3×6 table
Name Passed Failed Incomplete Duration Details
_________________________ ______ ______ __________ _________ ____________
{'ExampleTest/testOne' } true false false 0.0063632 {1×1 struct}
{'ExampleTest/testTwo' } true false false 0.0073147 {1×1 struct}
{'ExampleTest/testThree'} true false false 0.0027218 {1×1 struct}
table を使用してテスト結果の概要を表示します。
summary(rt)
Variables:
Name: 3×1 cell array of character vectors
Passed: 3×1 logical
Values:
True 3
False 0
Failed: 3×1 logical
Values:
True 0
False 3
Incomplete: 3×1 logical
Values:
True 0
False 3
Duration: 3×1 double
Values:
Min 0.0027218
Median 0.0063632
Max 0.0073147
Details: 3×1 cell
table の行を降順に並べ替えて、最も長いテスト時間を見つけます。
sorted = sortrows(rt,'Duration','descend')
sorted =
3×6 table
Name Passed Failed Incomplete Duration Details
_________________________ ______ ______ __________ _________ ____________
{'ExampleTest/testTwo' } true false false 0.0073147 {1×1 struct}
{'ExampleTest/testOne' } true false false 0.0063632 {1×1 struct}
{'ExampleTest/testThree'} true false false 0.0027218 {1×1 struct}
並べ替えた結果を CSV ファイルにエクスポートして、ファイルの内容を表示します。
writetable(sorted,'myTestResults.csv') type 'myTestResults.csv'
Name,Passed,Failed,Incomplete,Duration,Details ExampleTest/testTwo,1,0,0,0.0073147, ExampleTest/testOne,1,0,0,0.0063632, ExampleTest/testThree,1,0,0,0.0027218,
拡張機能
スレッドベースの環境
MATLAB® の backgroundPool を使用してバックグラウンドでコードを実行するか、Parallel Computing Toolbox™ の ThreadPool を使用してコードを高速化します。
バージョン履歴
R2014b で導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)