Advanced Test-Driven Development in Kotlin and Swift
This advanced TDD course is designed for experienced mobile engineers who want to master test-first development approaches in both greenfield and legacy contexts. Day 1 focuses on refining TDD techniques for new Kotlin and Swift codebases, covering advanced testing patterns, architecture design through tests, and modern mobile development practices. Day 2 tackles the complex challenges of applying TDD principles to legacy mobile applications, teaching practical strategies for safely introducing tests and refactoring existing code. The course emphasizes real-world scenarios that mobile engineers face daily, with hands-on exercises using contemporary mobile development frameworks and tools.
Objectives
- Master advanced TDD techniques for greenfield mobile development
- Design clean architecture through test-first approaches
- Implement sophisticated testing strategies for mobile UI and business logic
- Apply TDD principles to legacy mobile codebases safely and effectively
- Break complex dependencies in existing mobile applications
- Use advanced mocking and testing frameworks (MockK, XCTest, etc.)
- Implement characterization tests and safe refactoring techniques
- Integrate TDD practices into modern mobile development workflows
Prerequisites
- Advanced experience with Kotlin and/or Swift mobile development
- Current experience writing unit and integration tests
- Working knowledge of mobile app architecture patterns (MVVM, Clean Architecture, etc.)
- Experience with dependency injection and modern mobile development frameworks
Contents
TDD Principles and Mindset
- Unit Testing
- POUTing, GUTs and TDD
- Tests as specification
- Benefits of Good Quality TDD
- Red-Green-Refactor
- TDD mindset
- When to use TDD
Mocking
- What is Mocking
- Mocking in Kotlin with Kotest and MockK
- Mocking in Swift using XCTest, Cuckoo and Nimble
Effective Testing with Repositories
- Repository pattern and data layer testing
- Dependency injection containers and testable architecture
- Effective use of Mocking when testing Repositories
- Using MVVM with Repositories and applying TDD through implementation
Asynchronous and Network Testing
- Working with asynchronous code in Kotlin and Swift
- Testing coroutines in Kotlin
- Testing async/await in Swift
- Additional libraries for mocking network connections
Testing Error Conditions
- Importance of testing error conditions
- Tests as Specification around error conditions
- Techniques for testing error conditions
- Testing exception handling in Kotlin and Swift
- Best practices for error condition unit tests
Testing the View
- Test-driving Android Compose UI components
- Test-driving SwiftUI views and interactions
- Screen-level testing vs component-level testing
- Testing Databinding and UI interactions
- Best practices for View testing
Characterization Testing for Mobile Apps
- Capturing existing mobile app behavior
- Golden master testing for UI components
- Examples of Characterization tests
- Using Characterization tests
Legacy Mobile Code Assessment and Strategy
- Identifying legacy mobile app pain points
- Risk assessment for legacy mobile refactoring
- Creating a testing strategy for existing mobile apps
- Prioritizing areas for test coverage
Breaking Dependencies in Legacy Mobile Code
- Identifying and isolating Android activity/fragment dependencies
- Breaking iOS view controller and UIKit dependencies
- Singleton elimination in mobile contexts
- Network and persistence layer seams


