GimmeTheCodeTDD

A swift package with examples of unit tests in iOS development.

Requirements

Xcode 13

Content

Dependency Injection

  • Constructor Injection
  • Setter Injection
  • Interface Injection]

Expectations

  • XCTestExpectation
  • XCTKVOExpectationExpectedValue
  • XCTKVOExpectationHandler
  • XCTNSNotificationExpectation
  • XCTNSPredicateExpectation
  • Waiting for Expectations

Easy Tests

  • Properties
  • Delegation

Target-Action

  • Sending All Actions

View Controller

  • View Loading
  • View Appearing
  • View Disappearing

View

  • Existence of Subviews
  • Update of Subviews

Table View Controller

  • Populating Cell
  • Populating Header
  • Insert Rows
  • Delete Rows
  • Move Row
  • Batch Updates

Table View Data Source

  • Number Of Rows
  • Header Title
  • Delete Row
  • Insert Row
  • ReorderRows

Table View Delegate

  • Will Display For Row
  • Indentation Level For Row
  • WillSelect Row
  • Select Cell
  • Height For Row

Collection View

  • Populating Cell
  • Populating Supplementary View
  • Insert Row
  • Delete Items

Collection View Data Source

  • Number Of Items
  • Setup Cell
  • Setup Supplementary View

Collection View Delegate

  • Should Select Item
  • Select Cell

Collection View Flow Layout

  • UICollectionViewFlowLayoutMinimumLineSpacing

Navigation Controller

  • Push
  • Pop

Presentation

  • PresentViewController

Coordinator Pattern

  • Start
  • PushNext

Notifications

  • Sending
  • Sending With User Info
  • Receiving

Networking

  • Stubbing With URLProtocol
  • Stubbing With URLSession
  • Stubbing With UploadTask
  • Stubbing async/await

Alerts

  • Simple
  • Swizzling Complete
  • Action With Factory

Core Location

  • Location Services Enabled
  • NSLocationWhenInUseUsageDescription
  • Request When In Use
  • Setting Delegate
  • Setting Distance Filter
  • Setting Desired Accuracy
  • Start Updating Location
  • Stop Updating Location
  • Request Location

Date

  • DateFilterFutureEvents

Storyboards

  • Overview
  • Storyboard Identifier
  • Outlet
  • Segue

Author

Dominik Hauser, @dasdom

Licence

MIT

GitHub

https://github.com/dasdom/GimmeTheCodeTDD