Saranjith
Saranjith

Reputation: 11577

Execute UITests In Different Order

I have many test methods added to my project. I want to test by changing the order of tests each time.

For example if i have 3 test methods. I want to run 6 tests like

i) 1 2 3

ii) 1 3 2

iii) 2 1 3

iv) 3 1 2

v) 2 3 1

vi) 3 2 1

How can i achive this in XCode?

Note: It is in means like test 1 creates setup things for test 2. Input or UI somethings like that. Thats why i need to keep a sequence

Upvotes: 0

Views: 394

Answers (1)

Fogmeister
Fogmeister

Reputation: 77661

Tests should not have any effect on state at all. And they should not depend on previous state either.

Running 1, 2, 3. Should have the exact same results as running 3, 2, 1.

Before running, each test should set up the required conditions that it is testing.

After running, each test should tear down the system so that there is nothing hanging around for the next test.

So, in answer to your question, I don't know if it's possible to specify an order... but you really shouldn't care what order they run in. If you do then that's a sign that your tests are not independent of each other.

Upvotes: 1

Related Questions