-
Notifications
You must be signed in to change notification settings - Fork 0
XCode configuration guide
Using Voodoo in Xcode is pretty straight forward. You can handle the setup in the setUp()
function override if all the tests in the suite need the same configuration, and perhaps tweak some responses in individual tests. Alternatively if the tests are too different in their requirements you can simply start the server inside each tests.
Either way if you take a look at the Xcode samples you will find a sample XCTestCase
that is both simple and flexible in how you can use it.
The summary of using Voodoo in a test suite is:
-
In the
setUp()
of your UI test suite you start and configure an instance of Voodoo. -
Using a launch argument, pass Voodoo's URL to your app. It's important to launch Voodoo before your app for two reasons. One to get and pass the URL, but also because if your app makes any calls during startup, that Voodoo is already configured and ready to handle them.
-
Finally in
teardown()
clear the Voodoo instance otherwise Voodoo and the port will stay allocated until the end of the test run.Note that I said "test run". Remember XCTest creates a new instance of the
XCTestCase
for each test within it, and it also keeps all of them in memory until the entire test run finishes. This means that if you do not dealloc Voodoo inteardown()
it will stay there consuming ports until the end of the test run and resulting in you running out of ports very fast.