matlab.uitest.TestCase.forInteractiveUse
クラス: matlab.uitest.TestCase
パッケージ: matlab.uitest
対話型で使用するテスト ケースを作成
説明
tc = matlab.uitest.TestCase.forInteractiveUse
は、対話型テスト用に構成されたテスト ケースを作成します。返される TestCase
インスタンスはコマンド プロンプトでの実験に適しています。パスと失敗の両方のイベントについて、画面にメッセージを出力して検定に反応します。
例
対話型の TestCase を作成
ボタンを押すと赤から緑に変わるランプ コンポーネントを作成します。
fig = uifigure; lamp = uilamp(fig,'Position',[50 100 20 20],'Color','red'); button = uibutton(fig,'ButtonPushedFcn',@(btn,event) set(lamp,'Color','green'));
MATLAB® コマンド プロンプトで対話型での使用のために設定された TestCase
オブジェクトを作成します。
tc = matlab.uitest.TestCase.forInteractiveUse;
ボタンを押します。
tc.press(button)
ランプの色が緑であることを確認します。ランプの色は RGB 3 成分として格納されているため、このテストは失敗します。
tc.verifyEqual(lamp.Color,'green')
Verification failed. --------------------- Framework Diagnostic: --------------------- verifyEqual failed. --> Classes do not match. Actual Class: double Expected Class: char Actual Value: 0 1 0 Expected char: green
ランプの色が緑の RGB 3 成分であることを確認します。
tc.verifyEqual(lamp.Color,[0 1 0])
Verification passed.
バージョン履歴
R2018a で導入
MATLAB コマンド
次の 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:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)