Question

I am using SenTestKit to test an iOS app. I've split tests into methods which run For example: In

@interface simpleGameTests : SenTestCase

With tests:

- (void)testFindingFacebookFriends
- (void)testRegisterUsernameFromForm
- (void)testStartGame

It seems kind of random which of the tests that run first, second and third. Is it possible in Xcode to set the order which the tests run?

Was it helpful?

Solution

No. You should write your tests as isolated cases that can be run no independent of each other, no matter the order.

OTHER TIPS

Yes, although the accepted answer is idealistically true and your test cases should indeed be isolated you can set the order in actuality you can control the order and sometimes it is preferable to do so. They are executed in alphabetical order, so testACreateAccount will be executed before testBLoginToAccount. I use this to generate a password in setUp routine then use that in testACreateAccount to setup the account and testBLoginToAccount to test account login using the created one. In this way the test is full and complete (and also no longer strictly a unit test) but it is an invaluable test for my code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top