Created
May 11, 2016 06:34
-
-
Save goodmorningcody/49b695c8cf94f89af5ac6c0bf5502f8f to your computer and use it in GitHub Desktop.
Utility Method for TDD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func playWithAutomatic(number:Int) { | |
let app = XCUIApplication() | |
let numberButton = app.buttons["number"] | |
let fizzButton = app.buttons["fizz"] | |
let buzzButton = app.buttons["buzz"] | |
let fizzBuzzButton = app.buttons["fizzbuzz"] | |
for index in 0...number { | |
if index%15==0 { | |
fizzBuzzButton.tap() | |
} | |
else if index%5==0 { | |
buzzButton.tap() | |
} | |
else if index%3==0 { | |
fizzButton.tap() | |
} | |
else { | |
numberButton.tap() | |
} | |
} | |
} | |
func testTapFizzBuzzButtonIncrementsTo15() { | |
let app = XCUIApplication() | |
let numberButton = app.buttons["number"] | |
playWithAutomatic(15) | |
XCTAssertEqual(numberButton.label, "15") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment