SlideShare una empresa de Scribd logo
1 de 18
Descargar para leer sin conexión
iOS UI Testing in Xcode
Mark Chang

markchang@kkbox.com
Test Corner
About Me
• Mark Chang

• Testing Engineer in the KKBOX Inc.

• One of contributors in the “Testing with KK” blog.
Overview
• Record and Playback

• Test script (Swift or Objective-C)

• Running UI automation testing in iOS

• Code coverage and test reports
Demo 1

UI Recording - Record and Playback

YouTube Link
How does UI automation work ?
Locate the element
Operate the element
Verify the element
Example
Testing 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)
Example
Testing 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)
Example
Testing 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)
Example
Testing 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)
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
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
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
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
Example
Testing 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)
Demo 2

Code coverage and test reports

YouTube Link
For more information please visit
Any Questions ?
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


Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App Testing
 
UI Testing with Earl Grey
UI Testing with Earl GreyUI Testing with Earl Grey
UI Testing with Earl Grey
 
Xcode7 UI Automation
Xcode7 UI AutomationXcode7 UI Automation
Xcode7 UI Automation
 
SwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasySwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made Easy
 
SWTBot Tutorial
SWTBot TutorialSWTBot Tutorial
SWTBot Tutorial
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI Testing
 
Swtbot
SwtbotSwtbot
Swtbot
 
Functional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and TestersFunctional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and Testers
 
UI testing in Xcode 7
UI testing in Xcode 7UI testing in Xcode 7
UI testing in Xcode 7
 
Automating UI testing
Automating UI testingAutomating UI testing
Automating UI testing
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
 
JsUnit
JsUnitJsUnit
JsUnit
 
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnitWriting and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
 
Mobile Worshop Lab guide
Mobile Worshop Lab guideMobile Worshop Lab guide
Mobile Worshop Lab guide
 
Active x
Active xActive x
Active x
 
Secret unit testing tools
Secret unit testing toolsSecret unit testing tools
Secret unit testing tools
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
 
Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with Espresso
 
iOS UI Automation
iOS UI AutomationiOS UI Automation
iOS UI Automation
 

Destacado

CNY Distribution of Oranges, Uplifting the spirit [@TPCTMC]
CNY Distribution of Oranges, Uplifting the spirit [@TPCTMC]CNY Distribution of Oranges, Uplifting the spirit [@TPCTMC]
CNY Distribution of Oranges, Uplifting the spirit [@TPCTMC]
Kenneth Poon
 

Destacado (6)

Page Object in XCUITest
Page Object in XCUITestPage Object in XCUITest
Page Object in XCUITest
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
 
Advanced Project 1: Heart Bleed
Advanced Project 1: Heart BleedAdvanced Project 1: Heart Bleed
Advanced Project 1: Heart Bleed
 
PropertyGuru is Hiring. iOS / Android Engineer (Bangkok, Thailand)
PropertyGuru is Hiring. iOS / Android Engineer (Bangkok, Thailand)PropertyGuru is Hiring. iOS / Android Engineer (Bangkok, Thailand)
PropertyGuru is Hiring. iOS / Android Engineer (Bangkok, Thailand)
 
Sunrise pc support heart bleed scam alert
Sunrise pc support heart bleed scam alertSunrise pc support heart bleed scam alert
Sunrise pc support heart bleed scam alert
 
CNY Distribution of Oranges, Uplifting the spirit [@TPCTMC]
CNY Distribution of Oranges, Uplifting the spirit [@TPCTMC]CNY Distribution of Oranges, Uplifting the spirit [@TPCTMC]
CNY Distribution of Oranges, Uplifting the spirit [@TPCTMC]
 

Similar a iOS UI Testing in Xcode

Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Selenium
elliando dias
 
qtp 9.2 features
qtp 9.2 featuresqtp 9.2 features
qtp 9.2 features
krishna3032
 
Qtp 92 Tutorial Anil
Qtp 92 Tutorial AnilQtp 92 Tutorial Anil
Qtp 92 Tutorial Anil
guest3373d3
 
Qtp 9.2 Tutorial
Qtp 9.2 TutorialQtp 9.2 Tutorial
Qtp 9.2 Tutorial
guest37ae7f
 

Similar a iOS UI Testing in Xcode (20)

Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Selenium
 
UIAutomator
UIAutomatorUIAutomator
UIAutomator
 
Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769
 
Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769
 
qtp 9.2 features
qtp 9.2 featuresqtp 9.2 features
qtp 9.2 features
 
Qtp 92 Tutorial
Qtp 92 TutorialQtp 92 Tutorial
Qtp 92 Tutorial
 
Ppt Qtp
Ppt QtpPpt Qtp
Ppt Qtp
 
Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769
 
Qtp 92 Tutorial Anil
Qtp 92 Tutorial AnilQtp 92 Tutorial Anil
Qtp 92 Tutorial Anil
 
Qtp 9.2 Tutorial
Qtp 9.2 TutorialQtp 9.2 Tutorial
Qtp 9.2 Tutorial
 
Test Complete
Test CompleteTest Complete
Test Complete
 
Qtp day 3
Qtp day 3Qtp day 3
Qtp day 3
 
Lightning Components Workshop
Lightning Components WorkshopLightning Components Workshop
Lightning Components Workshop
 
Espresso workshop
Espresso workshopEspresso workshop
Espresso workshop
 
UI Testing with Spec
 UI Testing with Spec UI Testing with Spec
UI Testing with Spec
 
How to Use Material UI Tooltip Component Like a Pro
How to Use Material UI Tooltip Component Like a ProHow to Use Material UI Tooltip Component Like a Pro
How to Use Material UI Tooltip Component Like a Pro
 
SoapUI Pro Plugin Workshop #SoapUIPlugins
SoapUI Pro Plugin Workshop #SoapUIPluginsSoapUI Pro Plugin Workshop #SoapUIPlugins
SoapUI Pro Plugin Workshop #SoapUIPlugins
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
 
Lightning Components Workshop
Lightning Components WorkshopLightning Components Workshop
Lightning Components Workshop
 
Testing view controllers with Quick and Nimble
Testing view controllers with Quick and NimbleTesting view controllers with Quick and Nimble
Testing view controllers with Quick and Nimble
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Último (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 

iOS UI Testing in Xcode

  • 1. iOS UI Testing in Xcode Mark Chang markchang@kkbox.com Test Corner
  • 2. About Me • Mark Chang • Testing Engineer in the KKBOX Inc. • One of contributors in the “Testing with KK” blog.
  • 3. Overview • Record and Playback • Test script (Swift or Objective-C) • Running UI automation testing in iOS • Code coverage and test reports
  • 4. Demo 1 UI Recording - Record and Playback YouTube Link
  • 5. How does UI automation work ?
  • 6. Locate the element Operate the element Verify the element
  • 7. Example Testing 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)
  • 8. Example Testing 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)
  • 9. Example Testing 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)
  • 10. Example Testing 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)
  • 11. 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
  • 12. 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
  • 13. 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
  • 14. 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
  • 15. Example Testing 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)
  • 16. Demo 2 Code coverage and test reports YouTube Link
  • 17. For more information please visit Any Questions ?
  • 18. 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