Testing 101: What Are UI Tests & How to Write Them in Swift/iOS

Опубликовано: 19 Ноябрь 2024
на канале: Swift and Tips
723
27

In this episode of Testing 101, we explore UI tests and explain how they differ from other types of testing. While unit tests focus on individual components, UI tests ensure that the user interface behaves correctly as a whole.

I’ll walk you through a real-world demo, setting up a UI test in Xcode, simulating user actions, and making your tests more reliable by mocking a Web API call.

Content:
0:00 - Intro
3:02 - UI Test Target
6:11 - UI Test File from Template
7:22 - App Object
8:27 - Recording a UI Test
11:07 - Creating Identifiers
15:51 - waitForExistence
17:35 - ProgressView not detected
19:46 - Cells in UI Tests
23:18 - Labels as Identifiers
23:59 - Simulating user actions
26:41 - Recording UI sometimes fails.
29:10 - CartList’s Alerts and Views
32:09 - Fails in UI Test
34:00 - Mocking UI Test
42:25 - Fixing unexpected issue with alert
47:13 - UI Tests are expensive!
48:57 - BONUS: Testing Error Flows
50:00 - Outro

Demo: https://github.com/pitt500/OnlineStor...

---

What is a Unit Test?:    • Testing 101: What is a Unit Test & Ho...  
What is an Integration Test?:    • Testing 101: What Are Integration Tes...  
setUp & tearDown:    • Mastering Swift Testing: Migrating XC...  
Swift Testing Playlist:    • Swift Testing  
SwiftUI Modifiers:    • Developing Custom Modifiers in SwiftUI  


-----

Other videos from my channel:
Podcast:    • Swift and Tips Podcast  
Swift Concurrency:    • Swift Concurrency  
any Protocol (Existential Types):    • "any" Keyword and Existential types i...  
The Composable Architecture (TCA):    • The Composable Architecture  
Apple Watch Layout using Geometry Reader:    • Building Apple Watch Layout with Geom...  
Key Paths:    • The Anatomy of a Key Path  
Result Builders to build a web framework:    • Result Builders in Action: Simplifyin...  
Types of Access Control:    • All types of Access Control in Swift ...  
Generics:    • Generics  

-----
My Contact:
https://www.swiftandtips.com
  / swiftandtips  
https://iosdev.space/@swiftandtips
  / pedrorojaslo