Skip to main content
Skip table of contents

Desktop Application Testing

デスクトップアプリケーションのテストは、1 台のワークステーション内で「ローカルデスクトップ」接続を使用する方法と、第 2 の仮想環境または物理環境への「VNC サーバー」接続を使用する方法があります。

上記のどちらの接続タイプでも、テスト環境(SUT)全体を制御することができるため、そこにインス トールされているすべてのアプリケーションを本質的に制御することができます。しかし、この種のテストは単一のアプリケーションに限定されるものではなく、アプリケーションのインストールや削除、システムプロパティの表示や調整なども含まれます。

実際、一旦目的の SUT に接続すれば、マウスとキーボードを使ってその環境を操作し、その結果の表示を視覚的に 分析しながら、ユーザーが行うのと全く同じ方法で、その環境のあらゆる側面を制御することができる。

ここで重要なことは、ロボットが区別するのはアプリケーションの種類ではなく、使用されている接続の種類だけであるということです。したがって、ネイティブのデスクトップアプリケーションは、例えばウェブ、.NET、Java、Flashなどのアプリケーションと全く同じように処理され、自動化されます。

アプリケーションを起動する例を見てみよう。

まず、電卓のような標準的なデスクトップアプリを起動するには、Robot:

JS
Press Windows
Typeline Calc
Comparing that against the code required to launch a web browser application:
Press Windows
Typeline "iexplore www.gmail.com"

アプリケーションが起動したら、それを自動化するために必要なステップは、メニューやフィールドのナビゲーション、データ入力など、アプリケーション自体のデザインに依存します。これにより、マウスを使うかキーボードを使うかが決まります。

例えば、Windowsの電卓で方程式を実行するには、次のようにします:

JS
Typeline 5*5
And logging into the Gmail web application, as follows:
Type T-Plan@gmail.com
Press Tab
Typeline testing123

ウィンドウズ電卓のサンプル動画

しかし、もしあなたのアプリケーションがキーボードナビゲーションなどをサポートしていないことが分かっている場合、画像検索やテキスト検索をマウスのベースとして使用することができます。

画像検索に基づく電卓の例

JS
Procedure Click {
Waitfor match template="{1}.png" method=search2 timeout=10s
if ({_EXIT_CODE} > 0) {
Step "Click {1}." result=fail
Exit "1"
} else{
Step "Click {1}"
Mouse click to=x:{_COMPARETO_CLICK_X},y:{_COMPARETO_CLICK_Y}
}
}
Click WinStart 
Typeline Calc
Click 5
Click Times
Click 5
Click Equals 

同様に、ウェブアプリケーションのテストも同じようになります:

JS
Procedure Click {
Waitfor match template="{1}.png" method=search2 timeout=10s
if ({_EXIT_CODE} > 0) {
Step "Click {1}." result=fail
Exit 1
} else{
Step "Click {1}"
Mouse click to=x:{_COMPARETO_CLICK_X},y:{_COMPARETO_CLICK_Y}
}
}
Click WinStart
Typeline "iexplore www.gmail.com"
Click Email
Type T-Plan@gmail.com
Click Password
Type testing123
Click SignIn

ジグソーパズルの最後の部分は、適用されたアクションの検証を実行することです。これもまた、典型的な画像検索やテキスト検索など、さまざまな方法で実現できます。

このような検証をプロシージャーにまとめるということは、スクリプトの各ステップに検証ポイントを置くことができるということでもあります。

プロシージャーには必要なコードを含めることができますが、典型的な検証アクションは次のようになります:

JS
Procedure Verify {
Waitfor match template="{1}.png" method=search2 timeout=10s
if ({_EXIT_CODE} > 0) {
Step "Verify {1}." result=fail
Exit 1
} else{
Step "Verify {1}"
Screenshot "Verification_{1}.png"
}
}

このプロシージャーは、スクリプトの必要な箇所で次のように呼び出されます:

ベリファイ25

T-Plan RobotによるローカルWebアプリケーションの自動化については、Google Mapsのビデオをご覧ください:T-Planロボットを使ったマップテスト.

Once the application has been started the steps needed to automate it depend on the design of the application itself in terms of the menu/field navigation, data entry, etc. This will in turn determine whether you want to use the mouse or keyboard to perform such actions.

For example, performing an equation in the Windows Calculator could be achieved as follows:

JS
Typeline 5*5
And logging into the Gmail web application, as follows:
Type T-Plan@gmail.com
Press Tab
Typeline testing123

Video of Windows Calculator Sample

However, if you are unsure or indeed know that your application does not support keyboard navigation etc you can use Image and/or text searching as a basis for your mouse.

Calculator example based on image searches:

JS
Procedure Click {
Waitfor match template="{1}.png" method=search2 timeout=10s
if ({_EXIT_CODE} > 0) {
Step "Click {1}." result=fail
Exit "1"
} else{
Step "Click {1}"
Mouse click to=x:{_COMPARETO_CLICK_X},y:{_COMPARETO_CLICK_Y}
}
}
Click WinStart 
Typeline Calc
Click 5
Click Times
Click 5
Click Equals 

Similarly, testing of the web application would look the same:

JS
Procedure Click {
Waitfor match template="{1}.png" method=search2 timeout=10s
if ({_EXIT_CODE} > 0) {
Step "Click {1}." result=fail
Exit 1
} else{
Step "Click {1}"
Mouse click to=x:{_COMPARETO_CLICK_X},y:{_COMPARETO_CLICK_Y}
}
}
Click WinStart
Typeline "iexplore www.gmail.com"
Click Email
Type T-Plan@gmail.com
Click Password
Type testing123
Click SignIn

The final part of the jigsaw is then to perform the verification of the applied action. This can again be achieved a number of different ways including typically an image or text search.

Wrapping such a verification into a procedure also means that you can place a verification point at each desired step of your script.

A procedure can include any code you require but a typical verification action may look as follows: 

JS
Procedure Verify {
Waitfor match template="{1}.png" method=search2 timeout=10s
if ({_EXIT_CODE} > 0) {
Step "Verify {1}." result=fail
Exit 1
} else{
Step "Verify {1}"
Screenshot "Verification_{1}.png"
}
}

This procedure is then called wherever needed throughout your script like so:

Verify 25

For further example of T-Plan Robot automating local web application please see our Google Maps video: Map testing with T-Plan Robot.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.