문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top