Reputation: 103
I am trying to find out how to test GUI of my monotouch app automatically from command line? I mean execute GUI tests in iOS simulator from CL. Only way of GUI testing I found was Teleric tool, but it is not automated yet
Some tips? Thanks
Upvotes: 6
Views: 287
Reputation: 972
If you are looking for something to help you with TDD, you might be interested in calabash: https://github.com/calabash/calabash-ios
Upvotes: 1
Reputation: 3655
You can use the UIAutomation
framework to achieve automated GUI tests. It's not strictly from the command line but you run Javascript scripts through the Instruments tool. It works perfectly with Monotouch (the time's I've used it, anyway).
To give an example of a script (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);
Upvotes: 0