fastlane-old / scan

The easiest way to run tests of your iOS and Mac app
https://fastlane.tools
221 stars 25 forks source link

Reinstalling app before Tests are run via scan #76

Closed devashish2203 closed 8 years ago

devashish2203 commented 8 years ago

I was looking for a way to reinstall the app on the simulator before the tests are run using scan. But could not find any way to do it.

snapshot has this feature snapshot --reinstall_app --app_identifier "tools.fastlane.app"

Would it be possible for scan to have this feature as well?

The use case I have:

I am using scan for CI to run tests against PRs raised. There are instances when one of the PRs makes changes in the NSUserDefaults which might not backward compatible. This causes the runs on any other PRs to fail subsequently. If I reinstall the app before running the tests the NSUserDefaults get cleared and the tests on the individual tests run successfully.

A solution to this is to use launchArguments in the XCUITests and clear the UserDefaults from my app code, but being able reinstall app via scan seems to me to be a better approach.

KrauseFx commented 8 years ago

The idea is that your tests should work no matter in which state your app is in. It's the same when you run tests from within Xcode.

devashish2203 commented 8 years ago

Thanks for clarifying. I updated my tests to clear the defaults using the launchArguments provided by Xcode to have the same default state for each test run.

Closing the issue.

KrauseFx commented 8 years ago

:+1:

fastlanebot commented 8 years ago

This issue was migrated to https://github.com/fastlane/fastlane/issues/3334. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo :rocket: