Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I add Fakery to UITesting? #78

Closed
touchdiamond58 opened this issue Sep 26, 2017 · 1 comment
Closed

How can I add Fakery to UITesting? #78

touchdiamond58 opened this issue Sep 26, 2017 · 1 comment

Comments

@touchdiamond58
Copy link

I want to populate fields with fake data, how can I add it to my UITests!?

@vadymmarkov
Copy link
Owner

vadymmarkov commented Oct 2, 2017

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants