2012-12-12 19 views
6

私のモノタッチアプリケーションのGUIをコマンドラインから自動的にテストする方法を探していますか?私は、CLからiOSシミュレータでGUIテストを実行することを意味します。 私が見つけたGUIテストの方法はTelericツールでしたが、not automated yetiOSモノタッチGUIテストをコマンドラインから自動的に実行する

いくつかのヒント? ありがとう

+0

はそれをしませんコマンドラインからのものでなければならないのですか?スクリプトは、一度だけ書いている限り、何度も実行されます(もちろん、完全に自動化されます)。 – Luke

答えて

0

UIAutomationフレームワークを使用して自動GUIテストを実行できます。厳密にはコマンドラインではありませんが、Instrumentsツールを使用してJavascriptスクリプトを実行します。それはMonotouch(私はそれを使用した時間、とにかく)と完全に動作します。スクリプトの例を与えることを

The apple documentation on UIAutomation is pretty in depth; and hopefully should cover everything else you need.

Credit to jacksonh from Gist for this script; shamelessly taken from there).

var target = UIATarget.localTarget(); 
var window = UIATarget.localTarget().frontMostApp().mainWindow(); 
var table = window.tableViews() [0]; 
var results_cell = table.cells() [0] 
var run_cell = table.cells() [1]; 
var passed = false; 
var results = ''; 

run_cell.tap(); 

while (true) { 

    target.delay (5); 

    try { 
     results = results_cell.name(); 
    } catch (e) { 
     UILogger.logDebug ('exception'); 
     continue; 
    } 

    if (results.indexOf ('failure') != -1) { 
     passed = false; 
     break; 
    } 
    if (results.indexOf ('Success!') != -1) { 
     passed = true; 
     break; 
    } 
} 

UIALogger.logDebug ('Results of test run: ' + results); 
UIALogger.logDebug ('Passed: ' + passed); 
関連する問題