Questions tagged [rxtest]
23 questions
7
votes
0 answers
Embedding/excluding certain SPM libraries in specific build configuration
Currently our project are utilising come libraries added through SPM which contains some forbidden symbols, e.g RxTest, so before uploading the build to AppStore Connect we have to remove those libraries manually in Target -> Frameworks and…

peakingcube
- 1,388
- 15
- 32
4
votes
2 answers
RxTest is still using libswiftXCTest.dylib
I'm facing an issue of "Disallowed framework" when submitting to App Store. The issue is as follows
"ITMS-90726: Disallowed frameworks - Your app submission contains usages of the restricted framework libswiftXCTest.dylib. Remove these, rebuild and…

Shiva Kumar
- 53
- 3
4
votes
1 answer
RxSwift TestScheduler don't work if subscribeOn background
I have mock interactor and router for unit tests on presenter
presenter method:
private func presenterMethod(_ isOn: Bool) -> Driver {
return interactor.interactorMethod(isOn)
.subscribeOn(ConcurrentDispatchQueueScheduler(qos:…

SickMan
- 75
- 7
4
votes
1 answer
RxTest: Undefined symbols for architecture x86_64 and arm64
I am trying to run the following test from Chapter 16: Testing with RxTest of Raywenderlich RxSwift book:
import XCTest
import RxSwift
import RxTest
@testable import Testing
class TestingViewModel : XCTestCase {
var viewModel: ViewModel!
var…

Hamed Ghadirian
- 6,159
- 7
- 48
- 67
3
votes
2 answers
RxTest - How to compare Event as Void is not Equatable
A ViewModel has an input (an observer) which is bound to tap event of UIButton in UIViewController. This observer is of type AnyObserver.
In my unit test, this is what I'm expecting:
let correctValues: [Recorded>] =…

HitMan
- 195
- 1
- 9
3
votes
1 answer
Testing ViewModel in RxSwift
I would like to perform a test in one of my ViewModels that contains a BehaviorRelay object called "nearByCity" that it is bind to BehaviorRelay called "isNearBy". That's how my view model looks like.
class SearchViewViewModel: NSObject {
…

Reimond Hill
- 4,278
- 40
- 52
2
votes
1 answer
RxSwift/RxTest How to test async function with Observable return
I'm quite new to RxSwift and I trying to create some unit tests. In this case I want to test If the fetch objects from Realtime database Firebase is occurring correctly.
func getAllPosts() -> Observable<[PostItem]> {
ref =…

Marco Antonio
- 49
- 6
2
votes
0 answers
Testing ViewModel with Rx and GIPHY
I am a complete beginner in writing unit tests and trying to figure out how to test a ViewModel that makes use of the Giphy API.
This is my ViewModel:
import androidx.hilt.lifecycle.ViewModelInject
import androidx.lifecycle.ViewModel
import…

Joc
- 21
- 2
2
votes
1 answer
Trigger an event and wait for multiple events RxTest
It's my first time using RxTest and I am struggling how to do the following approach:
protocol ViewModelType {
func transform(input: ViewModel.Input) -> ViewModel.Output
}
struct ViewModel: ViewModelType {
private let isLoading =…

Eironeia
- 771
- 8
- 20
2
votes
1 answer
iOS RxSwift - testing with RxTest and TestScheduler does not end / terminate test case
I'm trying to understand how to correctly use TestScheduler from RxTest 4.2 for RxSwift 4.2.
How do I correctly create TestScheduler and pass it events which would terminate the scheduler after all events are executed?
The code below goes into…

Alex Stone
- 46,408
- 55
- 231
- 407
1
vote
1 answer
RxSwift/RxTest how to test error response
i want to test error from api using RxTest but i don't know how to get the response value from the error.
func submitForm() {
guard let denom = selectedDenom, let bal = accountBalance else { return }
…

ferryawijayanto
- 569
- 4
- 18
1
vote
1 answer
How can we test class which generates random states, and which can not generate same states twice?
We have three states.How can we test(with unit tests) our class which generates random state every 5 seconds, and which can not generate the same state twice in a row? The code of our random generator class is below
`
final class…

Анна Овчинникова
- 43
- 5
1
vote
1 answer
Mocking and Validating Results in RxSwift Unit Testing
I have just started learning RxSwift and trying to build a sample application to practice these concepts.
I have written a QuestionViewModel that loads list of questions from QuestionOps class. QuestionOps has a function getQuestions that returns…

Bilal Ahmad
- 187
- 1
- 12
1
vote
1 answer
Is `tearDown` calling necessary?
Something consider me a long time. Lets say that we have written test class:
final class BearerTokenManagerTests: XCTestCase {
private var bearerTokenManager: BearerTokenManager!
private var bearerTokenProvider: BearerTokenProvider!
…

Kamil Harasimowicz
- 4,684
- 5
- 32
- 58
1
vote
1 answer
How can I assert the output of an observable that uses latest from text inputs
I have a property on my view model:
let isValid: Driver
let credentials: Driver<(String, String)>
......
credentials = .combineLatest(bindings.username, bindings.password, resultSelector: { (username, password) -> (String,…

Teddy K
- 820
- 1
- 6
- 17