filmov
tv
Combine framework tutorial - Part 4 - How to include unit testing and dependency injection
![preview_player](https://i.ytimg.com/vi/2Cjs6bRGStU/maxresdefault.jpg)
Показать описание
Let's see how we can write unit test for code that uses the Combine framework. We need to first use dependency injection to replace URLSession data task publisher with a Result publisher in the mock service.
I will write a few tests to show you different test cases and use Combine operators like collect, first, output(at). You can find the full list of Combine operators at the official Apple documentation here:
You need to scroll down a lot. Some of the operators have examples. They don't show a good use case but are a good example for implementation details.
overview:
00:00 intro
01:17 dependency injection
07:19 writing tests with Combine publishers
20:41 testing error cases
22:22 dependency injection with the Result publisher
29:05 testing if data stream completes
34:24 wrap up
The other parts of this series are:
If you liked what you learned and you want to see more, check out one of my courses!
#CombineFramework #UnitTesting
I will write a few tests to show you different test cases and use Combine operators like collect, first, output(at). You can find the full list of Combine operators at the official Apple documentation here:
You need to scroll down a lot. Some of the operators have examples. They don't show a good use case but are a good example for implementation details.
overview:
00:00 intro
01:17 dependency injection
07:19 writing tests with Combine publishers
20:41 testing error cases
22:22 dependency injection with the Result publisher
29:05 testing if data stream completes
34:24 wrap up
The other parts of this series are:
If you liked what you learned and you want to see more, check out one of my courses!
#CombineFramework #UnitTesting
Combine framework tutorial: transforming Operators part 1 - map, compactMap and tryMap
Combine framework tutorial - Part 4 - How to include unit testing and dependency injection
Combine framework tutorial - Part 2 - nested publisher streams with switchToLatest and flatMap
Combine framework tutorial - Part 3 - Error handling with mapError, setFailureType, & flatMap
Combine Tutorial | API Call using Future, DataTaskPublisher | Swift | Xcode
Swift: Combine Basics & Intro (2023, Xcode 12, Swift 5) - iOS Development
Combine framework iOS (Tutorial Series)
Short Swift Combine Introduction
Computer Architecture - Lecture 27: Cutting-Edge Research in Computer Architecture III (Fall 2024)
Master The Combine Framework: From Beginner to Advanced
How to master Combine like a Pro – The Basics 📱 (free iOS tutorial)
How to master Combine like a Pro – The Operators 📱 (free iOS tutorial)
Swift: Intro to Combine
Introduction to Combine Framework in Swift: Learn Reactive Programming
What problem does Combine solve – Daniel Steinberg on Swiftly Speaking
Getting started with Swift Combine - Easy to follow tutorial
Combine Tutorial | Publishers, Subscribers | iOS | Swift | XCode
Getting started with Combine + UIKit in Swift
How to make request using Combine framework? URLRequest + Combine!
Part 1 - iOS Redux with Swift, SwiftUI and Combine
Combine CurrentValueSubject
How to bind tableView cell with Combine framework - Unit Test (Part 3/3)
Combine Framework in iOS Swift
How Backpressure Works in Apple's Combine Framework
Комментарии