View
265
Download
2
Category
Preview:
Citation preview
UI TestingTaras Kalapun
1
вторник, 26 апреля 2011 г.
Why Create Automated Tests?
2
• Find bugs while you sleep
• Repeatable regressions tests
• Quickly turn around updates to your application
вторник, 26 апреля 2011 г.
UI Automation
3
вторник, 26 апреля 2011 г.
4
вторник, 26 апреля 2011 г.
5
вторник, 26 апреля 2011 г.
Logging
6
var testName = "My first test";UIALogger.logStart(testName); // test code
UIALogger.logPass(testName);
вторник, 26 апреля 2011 г.
7
test("Food screen", function(target, app) { var window = app.mainWindow(); window.tabBars()[0].buttons()["Food"].tap(); var e; // Choose Provider e = window.tableViews()[0].cells()[0]; waitVisible(e); e.tap(); delay(1); // Choose food e = window.tableViews()[0].cells()[0]; waitVisible(e); e.tap(); delay(1); // Put in basket e = window.tableViews()[0].cells()[0]; waitVisible(e); e.tap();
вторник, 26 апреля 2011 г.
8
вторник, 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"); });
вторник, 26 апреля 2011 г.
Handling Alerts
10
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 }
вторник, 26 апреля 2011 г.
• Deactivate application for a given time
• Reactivating the application is handled automatically
11
Multitasking
UIALogger.logMessage("Deactivating app");UIATarget.localTarget().deactivateAppForDuration(10);UIALogger.logMessage("Resuming test after deactivation");
вторник, 26 апреля 2011 г.
12
FoneMonkey
вторник, 26 апреля 2011 г.
13
http://www.gorillalogic.com/fonemonkey
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
вторник, 26 апреля 2011 г.
14
вторник, 26 апреля 2011 г.
15
Frank
https://github.com/moredip/Frank
iOS testing tool that uses UISpec's UIScript to remotely drive an App
вторник, 26 апреля 2011 г.
16
Feature: Drive our SampleApp using Cucumber
Scenario: Plus button adds timestamp Given the app is launched When I touch the Plus button
Cucumber
вторник, 26 апреля 2011 г.
17
UIScript$(@"textField with placeholder:'Username' setText:'bkuser'");
$(@"textField with placeholder:'Password' setText:'bkpassword'");
$(@"navigationButton label with text:'Login' touch");
вторник, 26 апреля 2011 г.
Recommended