ios ui testing in xcode

18
iOS UI Testing in Xcode Mark Chang [email protected] Test Corner

Upload: jz-chang

Post on 14-Jan-2017

474 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: iOS UI Testing in Xcode

iOS UI Testing in Xcode

Mark [email protected]

Test Corner

Page 2: iOS UI Testing in Xcode

About Me• Mark Chang

• Testing Engineer in the KKBOX Inc.

• One of contributors in the “Testing with KK” blog.

Page 3: iOS UI Testing in Xcode

Overview• Record and Playback

• Test script (Swift or Objective-C)

• Running UI automation testing in iOS

• Code coverage and test reports

Page 4: iOS UI Testing in Xcode

Demo 1UI Recording - Record and PlaybackYouTube Link

Page 5: iOS UI Testing in Xcode

How does UI automation work ?

Page 6: iOS UI Testing in Xcode

Locate the element

Operate the element

Verify the element

Page 7: iOS UI Testing in Xcode

ExampleTesting the Add button

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Page 8: iOS UI Testing in Xcode

ExampleTesting the Add button

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Page 9: iOS UI Testing in Xcode

ExampleTesting the Add button

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Page 10: iOS UI Testing in Xcode

ExampleTesting the Add button

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Page 11: iOS UI Testing in Xcode

Example

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Testing the Add button

Page 12: iOS UI Testing in Xcode

Example

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Testing the Add button

Page 13: iOS UI Testing in Xcode

Example

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Testing the Add button

Page 14: iOS UI Testing in Xcode

Example

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Testing the Add button

Page 15: iOS UI Testing in Xcode

ExampleTesting the Add button

// application: let app = XCUIApplication() app.launch()

// element and query: let addButton = app.buttons[“Add”] addButton.tap()

// assertion: XCTAssertEqual(app.tables.cells.count, 1)

Page 16: iOS UI Testing in Xcode

Demo 2Code coverage and test reportsYouTube Link

Page 17: iOS UI Testing in Xcode

For more information please visit

Any Questions ?

Page 18: iOS UI Testing in Xcode

Reference• 使⽤ Xcode 執⾏ UI ⾃動化測試 _ 科科和測試

• https://kkboxsqa.wordpress.com/2015/11/09/%E4%BD%BF%E7%94%A8-xcode-%E5%9F%B7%E8%A1%8C-ui-%E8%87%AA%E5%8B%95%E5%8C%96%E6%B8%AC%E8%A9%A6/

• 使⽤ Xcode Server 持續整合建置 _ 科科和測試• https://kkboxsqa.wordpress.com/2015/12/10/xcode-server-continuous-integration/

• UI Testing in Xcode - WWDC 2015 - Videos - Apple Developer• https://developer.apple.com/videos/play/wwdc2015-406/

• UI Testing in Xcode 7 · masilotti.com• http://masilotti.com/ui-testing-xcode-7/

• Xcode 7 UI testing, a first look• http://www.mokacoding.com/blog/xcode-7-ui-testing/

• How do I test this with UI Testing?• https://github.com/joemasilotti/UI-Testing-Cheat-Sheet