How can I add Fakery to UITesting?
touchdiamond58 opened this issue · 1 comments
touchdiamond58 commented
I want to populate fields with fake data, how can I add it to my UITests!?
vadymmarkov commented
@touchdiamond58 One way of doing this would be to pass launch arguments and then populate fields with fake data directly in your app. This is a simplified example:
// In UI tests
override func setUp() {
super.setUp()
continueAfterFailure = false
app = XCUIApplication()
app.launchArguments.append("--UITests")
}
// In your app target
if CommandLine.arguments.contains("--UITests") {
// Use fake data
} else {
// Use actual data
}
It would be easier to achieve that by using some kind of abstractions, such as data providers, mock services, etc.
Hope it answers your question.