Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Testing RxRealm with RxBlocking

Testing RxRealm with RxBlocking

Realm + RxSwift testing with RxBlocking

Marin Todorov

December 06, 2017
Tweet

More Decks by Marin Todorov

Other Decks in Programming

Transcript

  1. Testing RxRealm

    with RxBlocking
    RxSwift Berlin
    Marin Todorov

    View full-size slide

  2. RxRealm
    realm.io

    View full-size slide

  3. • Completely Asynchronous

    • Notifications will be bundled by Realm

    • Objects can change over time
    Testing Realm

    View full-size slide

  4. Test: collection emits when objects added
    [Message1]
    Realm.rx.add(...)
    Observer
    Observable>
    [Message1]

    View full-size slide

  5. Test: collection emits when objects added
    [Message1]
    Realm.rx.add(...)
    Observer
    Observable>
    [Message1]

    View full-size slide

  6. Some Numbers
    RxRealm test suite with RxTest: 1570 loc
    RxRealm test suite with RxBlocking: 921 loc

    View full-size slide

  7. Test: observer handles error when observable errors out

    View full-size slide

  8. Test: collection emits when objects deleted

    View full-size slide

  9. Test: eventually changes from all threads will emit
    ... add objects on main queue, on background queque, sync on current queue, etc...

    View full-size slide

  10. Test: view model emits when speaker favorited

    View full-size slide

  11. Test: model emits when resultset changes
    ...
    ...

    View full-size slide

  12. • EventKit - github.com/realm/EventKit
    • RxRealm - github.com/RxSwiftCommunity/RxRealm

    RxBook - store.raywenderlich.com/products/rxswift
    Marin Todorov
    @icanzilb
    Updated!
    RxSwift 4

    View full-size slide