Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geektree0101/rxbdd
RxSwift & RxCocoa Behavior Driven Development Unit Test (iOS only)
https://github.com/geektree0101/rxbdd
bdd behavior-driven-development ios rxcocoa rxswift testing
Last synced: 8 days ago
JSON representation
RxSwift & RxCocoa Behavior Driven Development Unit Test (iOS only)
- Host: GitHub
- URL: https://github.com/geektree0101/rxbdd
- Owner: GeekTree0101
- License: mit
- Created: 2019-05-14T08:46:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-16T01:28:10.000Z (over 5 years ago)
- Last Synced: 2024-12-10T07:50:43.243Z (about 1 month ago)
- Topics: bdd, behavior-driven-development, ios, rxcocoa, rxswift, testing
- Language: Swift
- Size: 74.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![CI Status](https://travis-ci.com/GeekTree0101/RxBDD.svg?branch=master)
[![Version](https://img.shields.io/cocoapods/v/RxBDD.svg?style=flat)](https://cocoapods.org/pods/RxBDD)
[![License](https://img.shields.io/cocoapods/l/RxBDD.svg?style=flat)](https://cocoapods.org/pods/RxBDD)
[![Platform](https://img.shields.io/cocoapods/p/RxBDD.svg?style=flat)](https://cocoapods.org/pods/RxBDD)## Example
> Basic Usege
```swift
RxBDD.init(inputObservable: #INPUT_OBSERVABLETYPE, // Relay or Subject
outputType: #EXPECTED_OUTPUT_TYPE)
.given(#INPUT_EVENTS) // [Recorded>]
.when(#OUTPUT_OBSERVABLE) // Observable<#EXPECTED_OUTPUT_TYPE>
.then({ outputs in
XCTAssertEqual(outputs,
#EXPECTED_EVENTS) // [Recorded>]
})
```> Share given events
```swift
let shared = RxBDD.init(inputObservable: #INPUT_OBSERVABLETYPE, // Relay or Subject
outputType: #EXPECTED_OUTPUT_TYPE)
.given(#INPUT_EVENTS) // [Recorded>]
.share()
shared.when(#OUTPUT_OBSERVABLE) // Observable<#EXPECTED_OUTPUT_TYPE>
.then({ outputs in
XCTAssertEqual(outputs,
#EXPECTED_EVENTS) // [Recorded>]
})
shared.when(#OUTPUT_OBSERVABLE) // Observable<#EXPECTED_OUTPUT_TYPE>
.then({ outputs in
XCTAssertEqual(outputs,
#EXPECTED_EVENTS) // [Recorded>]
})
```> Description
```swift
func testMultiplyWithRxBDD() {
let integerInput = PublishSubject.init()
let multiplyOutput: Observable = 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](https://github.com/GeekTree0101/RxBDD/blob/master/Example/Tests/RxBDDTests.swift)
## 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](https://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
target 'YOUR_PROJECT_Example' dotarget '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.