Android システム・アプリのテスト

Android システム・アプリで実行する UFT One テストを作成する前に,関連する Android プロパティ値を取得し,それらを UFT One または Digital Lab(UFT Mobile) プロパティにマッピングする必要があります。

これらのプロパティは,UFT One テスト・ステップの引数値として使用します。

このトピックの内容:

Android のプロパティ値の取得とマッピング

uiAutomatorViewer ツールを使用して,必要なプロパティ値を取得します。

次の手順を実行します。

  1. uiAutomatorViewer ツールにアクセスします。詳細については,アプリのユーザ・インタフェースの分析を参照してください。
  2. 次のプロパティの値を取得します。

    package

    現在表示されているアプリケーションの識別子。

    App テスト・オブジェクトの identifier プロパティにマッピングされます。

    content-desc

    オブジェクトの accessibilityid プロパティ。

    class

    テスト・オブジェクトの class プロパティにマッピングされます。

  3. UFT One でテストを開き,任意のアプリでステップを記録します。例:

    Device("Device").App("UICatalog").MobileList("List").Select 0
  4. 次の例に従って,ステップの各部分を手動で調整します。

    Device("micclass:=Device").App("Identifier:=com.sec.android.app.launcher", "systemApp:=True”).MobileView("class:=Label", "accessibilityId:=Applications").Tap

    Device

    次の手順のいずれかを実行します。

    Device("DeviceName") デバイス・テスト・オブジェクトがオブジェクト・リポジトリで定義されている場合

    Device("micclass:=Device") プログラム的記述を使用する場合

    Identifier

    アプリケーションの識別子を定義します。

    この値は,uiAutomatorViewer の package プロパティにマッピングされます。

    systemApp systemApp:=True を設定します。
    class

    テスト・オブジェクトの class プロパティを定義します。

    accessibilityId "accessibilityId:=Applications" を設定します。

追加のテスト・ステップを作成し,テストを実行して続行します。

詳細については,モバイル・テストの記録モバイル・テストの編集モバイル・テストの実行を参照してください。

先頭に戻る

Android システム・アプリのテスト例

次のステップは,電卓システム・アプリにアクセスし,数値を追加し,結果を計算して,表示をクリアする方法を示しています。

'デバイスのホームページに移動する
Device("micclass:=Device").Home
'デバイス上のアプリのリストに移動する
Device("micclass:=Device").App("Identifier:=com.sec.android.app.launcher", "systemApp:=True”).MobileView("class:=Label", "accessibilityId:=Applications").Tap
'スワイプして電卓アプリに移動する
While Not Device("micclass:=Device").App("Identifier:=com.sec.android.app.launcher", "systemApp:=True").MobileView("class:=Label", "accessibilityId:=Calculator").Exist(5)
    Device("micclass:=Device").Swipe "left"
Wend

'電卓アプリを開く
Device("micclass:=Device").App("Identifier:=com.sec.android.app.launcher", "systemApp:=True").MobileView("class:=Label", "accessibilityId:=Calculator").Tap
'電卓で 1 を押す
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=1").Tap
'電卓で + を押す
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=Addition").Tap
'電卓で 5 を押す
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=5").Tap
'電卓で = を押す
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=Equal").Tap
'電卓で C(クリア)を押す
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=Clear").Tap

先頭に戻る

その他の参照項目: