Fails a simple test case using KIF

391 Views Asked by At

I try to use KIF in swift project. I run test case on iPhone simulator. Probably I did not set up correctly KIF because use it first time. I used this manual

Test fails in this simple code

func testSelectingOrganizerRole() { tester().tapView(withAccessibilityLabel: "ORGANIZE") }

with reason: enter image description here

A button with Accessibility label "ORGANIZE" exists on initial ViewConroller of storyboard.

1

There are 1 best solutions below

2
Paulo Mattos On

Why don't you switch to the UI tests framework available since Xcode 7? A quick intro:

UI testing gives you the ability to find and interact with the UI of your app in order to validate the properties and state of the UI elements.

UI testing includes UI recording, which gives you the ability to generate code that exercises your app's UI the same way you do, and which you can expand upon to implement UI tests. This is a great way to quickly get started writing UI tests.

Using this framework, your simple test would look like this:

let app = XCUIApplication()
app.launch()
app["ORGANIZE"].tap()