17
UI Testing Taras Kalapun 1 вторник, 26 апреля 2011 г.

Taras Kalapun ui testing

Embed Size (px)

Citation preview

Page 1: Taras Kalapun ui testing

UI TestingTaras Kalapun

1

вторник, 26 апреля 2011 г.

Page 2: Taras Kalapun ui testing

Why Create Automated Tests?

2

• Find bugs while you sleep

• Repeatable regressions tests

• Quickly turn around updates to your application

вторник, 26 апреля 2011 г.

Page 3: Taras Kalapun ui testing

UI Automation

3

вторник, 26 апреля 2011 г.

Page 4: Taras Kalapun ui testing

4

вторник, 26 апреля 2011 г.

Page 5: Taras Kalapun ui testing

5

вторник, 26 апреля 2011 г.

Page 6: Taras Kalapun ui testing

Logging

6

var testName = "My first test";UIALogger.logStart(testName); // test code

UIALogger.logPass(testName);

вторник, 26 апреля 2011 г.

Page 7: Taras Kalapun ui testing

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 г.

Page 8: Taras Kalapun ui testing

8

вторник, 26 апреля 2011 г.

Page 9: Taras Kalapun ui testing

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("[email protected]"); tableView.cells()["phone"].textFields()[0].setValue("+77777"); });

вторник, 26 апреля 2011 г.

Page 10: Taras Kalapun ui testing

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 г.

Page 11: Taras Kalapun ui testing

• 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 г.

Page 12: Taras Kalapun ui testing

12

FoneMonkey

вторник, 26 апреля 2011 г.

Page 13: Taras Kalapun ui testing

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 г.

Page 14: Taras Kalapun ui testing

14

вторник, 26 апреля 2011 г.

Page 15: Taras Kalapun ui testing

15

Frank

https://github.com/moredip/Frank

iOS testing tool that uses UISpec's UIScript to remotely drive an App

вторник, 26 апреля 2011 г.

Page 16: Taras Kalapun ui testing

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 г.

Page 17: Taras Kalapun ui testing

17

UIScript$(@"textField with placeholder:'Username' setText:'bkuser'");

$(@"textField with placeholder:'Password' setText:'bkpassword'");

$(@"navigationButton label with text:'Login' touch");

вторник, 26 апреля 2011 г.