How to Troubleshoot Apps for the Modern Connected Worker
Taras Kalapun ui testing
1. UI Testing
Taras Kalapun
1
вторник, 26 апреля 2011 г.
2. Why Create Automated Tests?
• Find bugs while you sleep
• Repeatable regressions tests
• Quickly turn around updates to your
application
2
вторник, 26 апреля 2011 г.
9. test("User Info screen", function(target, app) {
var window = app.mainWindow();
var tabBar = window.tabBars()[0];
tabBar.buttons()["Info"].tap();
var tableView = window.tableViews()[0];
// Choose User Info
waitVisible(tableView.cells()["User Info"]);
tableView.cells()["User Info"].tap();
//textFields()[0].setValue(name);
tableView = window.tableViews()[0];
tableView.cells()["name"].textFields()
[0].setValue("Vasya");
tableView.cells()["email"].textFields()
[0].setValue("test@example.com");
tableView.cells()["phone"].textFields()
[0].setValue("+77777");
});
9
вторник, 26 апреля 2011 г.
10. Handling Alerts
UIATarget.onAlert = function onAlert(alert) {
var title = alert.name();
UIALogger.logWarning("Alert with title '" +
title + "' encountered!");
if (title == "Warning") {
alert.buttons()["OK"].tap();
return true; // bypass default handler
}
return false; // use default handler
}
10
вторник, 26 апреля 2011 г.
11. Multitasking
• Deactivate application for a given time
• Reactivating the application is handled
automatically
UIALogger.logMessage("Deactivating app");
UIATarget.localTarget().deactivateAppForDuration(10);
UIALogger.logMessage("Resuming test after
deactivation");
11
вторник, 26 апреля 2011 г.
13. Record/playback functional testing tool
• Records high-level user actions
• Integrates with OCUnit
• Generation of OCUnit test scripts
• Generation of JavaScript UIAutomation scripts
• Validation commands
http://www.gorillalogic.com/fonemonkey
13
вторник, 26 апреля 2011 г.
15. Frank
iOS testing tool that uses UISpec's UIScript
to remotely drive an App
https://github.com/moredip/Frank
15
вторник, 26 апреля 2011 г.
16. Cucumber
Feature: Drive our SampleApp using Cucumber
Scenario: Plus button adds timestamp
Given the app is launched
When I touch the Plus button
16
вторник, 26 апреля 2011 г.
17. UIScript
$(@"textField with placeholder:'Username'
setText:'bkuser'");
$(@"textField with placeholder:'Password'
setText:'bkpassword'");
$(@"navigationButton label with text:'Login' touch");
17
вторник, 26 апреля 2011 г.