Latest 1.0.0
Homepage https://github.com/Geektree0101/RxBDD
License MIT
Platforms ios 9.0
Dependencies RxSwift, RxCocoa, RxTest
Frameworks XCTest
Authors

CI Status
Version
License
Platform

Example

Basic Usege

RxBDD.init(inputObservable: #INPUT_OBSERVABLETYPE, // Relay or Subject
outputType: #EXPECTED_OUTPUT_TYPE)
.given(#INPUT_EVENTS) // [Recorded<Event<#INPUT_OBSERVABLETYPE_ELEMENT>>]
.when(#OUTPUT_OBSERVABLE) // Observable<#EXPECTED_OUTPUT_TYPE>
.then({ outputs in
XCTAssertEqual(outputs,
#EXPECTED_EVENTS) // [Recorded<Event<#EXPECTED_OUTPUT_TYPE>>]
})

Share given events


let shared = RxBDD.init(inputObservable: #INPUT_OBSERVABLETYPE, // Relay or Subject
outputType: #EXPECTED_OUTPUT_TYPE)
.given(#INPUT_EVENTS) // [Recorded<Event<#INPUT_OBSERVABLETYPE_ELEMENT>>]
.share()

shared.when(#OUTPUT_OBSERVABLE) // Observable<#EXPECTED_OUTPUT_TYPE>
.then({ outputs in
XCTAssertEqual(outputs,

EXPECTED_EVENTS) // [Recorded<Event<#EXPECTED_OUTPUT_TYPE>>]

  })

shared.when(#OUTPUT_OBSERVABLE) // Observable<#EXPECTED_OUTPUT_TYPE>
.then({ outputs in
XCTAssertEqual(outputs,

EXPECTED_EVENTS) // [Recorded<Event<#EXPECTED_OUTPUT_TYPE>>]

  })

> Description
```swift
    func testMultiplyWithRxBDD() {
        let integerInput = PublishSubject<Int>.init()
        let multiplyOutput: Observable<Int> = input.map({ $0 * $0 }).asObservable()

        let test = RxBDD.init(inputObservable: integerInput,
                              outputType: Int.self)

        // Given: I have 10, 20, 30 Integer input events
        test.given([.next(100, 10),
                    .next(200, 20),
                    .next(300, 30)])  

        // When: It should multiply input integer events
        test.when(output)

        // Then: It should have multiplied integer events
        test.then({ outputs in
                XCTAssertEqual(outputs,
                               [.next(100, 100),
                                .next(200, 400),
                                .next(300, 900)])
            })
    }

More See

Requirements

  • Xcode, ~> 10.x
  • Swift, 4.2 // 5.0 coming soon!
  • RxSwift, ~> 4.0
  • RxCocoa, ~> 4.0
  • RxTest, ~> 4.0

Installation

RxBDD is available through CocoaPods. To install
it, simply add the following line to your Podfile:

target 'YOUR_PROJECT_Example' do

  target 'YOUR_PROJECT_Tests' do
    pod 'RxBDD'
  end
end

Author

Geektree0101, [email protected]

License

RxBDD is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RxBDD",
    "version": "1.0.0",
    "summary": "RxSwift & RxCocoa Behavior Driven Develpment Unit Test Kit",
    "description": "BDD(Behavior Driven Develpment) Unit Test Kit for RxSwift & RxCocoa (* iOS Only)",
    "homepage": "https://github.com/Geektree0101/RxBDD",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Geektree0101": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Geektree0101/RxBDD.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "frameworks": "XCTest",
    "source_files": "RxBDD/Classes/**/*",
    "dependencies": {
        "RxSwift": [
            "~> 4.0"
        ],
        "RxCocoa": [
            "~> 4.0"
        ],
        "RxTest": [
            "~> 4.0"
        ]
    }
}

Pin It on Pinterest

Share This