From what I can see, it looks like Xcode runs tests from a given TestCase sequentially, but from different TestCases in parallel.
Is it possible to configure a project/target so that all the tests run sequentially ? For instance, this would be useful to run various integration tests that have side effects affecting the other tests. (e.g. access to same database tables)
EDIT: to clear out some confusion: I am not talking about forcing a specific sequence of tests, just about making sure that the tests do not interfere with each other.
Thanks
Enable test repetition in your test plan, xcodebuild , or by running your test from the test diamond by Control-clicking and selecting Run Repeatedly to bring up the test repetition dialog.
Using ⌃⌘U will run all the test cases without building the test target. It is the opposite of ⇧⌘U. This is especially useful when you want to skip a slow-building test target and jump straight into running all the test cases.
Adding a unit test in Xcode Go to File > New > Target. Select iOS Unit Testing Bundle and then click Next. When you create a new Unit Test target for your project, it consists of a template class.
If you need your objects to have a consistent starting state for tests, I would recommend adding calls to the setUp method of your test classes. setUp called before each of the tests in a test class.
If you need your suite to run in a certain order, it sounds like you don't have unit tests and are running integration tests. You can try to use setUp to initialize your lower-level objects. If you are only interested in the behavior of a higher-level class, try mocks. The OCMock framework is available for Objective-C.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With