0

I gave my iOS app a URL scheme.

Is it possible to somehow test it either in a unit test or uitest?

iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
esbenr
  • 1,356
  • 1
  • 11
  • 34
  • Test what about it, precisely? – matt Sep 30 '16 at 22:52
  • That it works? Is it possible to write a test that fires the open url to the OS and verifies that the app is started and performs the implemented actions? – esbenr Sep 30 '16 at 22:58
  • "and verifies that the app is started" If the app _ex hypothesi_ isn't running when the test starts, this can hardly be a unit test or UI test belonging to this app, can it? – matt Sep 30 '16 at 23:12

2 Answers2

2

Dunno about unit testing, but you can certainly enter a URL with that scheme in mobile Safari and make sure that it opens your app and that your app takes the proper action.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
1

So, Duncan is right. Manual test is possible. But I wasn't clear enough as I meant automatic tests. As Matt states it's not actually possible to test whether the app starts.

But i managed to do automatic as follows:

So I implemented a url scheme handler (service class), that I call right away, when the app is started from a url scheme.

Then I can unit test this class, and that it takes the expected action upon different url schemes. (i.e. pushing certain view controllers etc.)

I suppose this is sufficient to verify that my url schemes cause the expected actions.

esbenr
  • 1,356
  • 1
  • 11
  • 34