The test collection in XCUI Test happens in alphabetical order
So, if there are test like
Test collection is done by using reflection on the object to get all the method names. Im not sure if this is done via the Objective-C runtime in Swift test cases but its not important.
You are close with your ordering but you can observe that this is the correct alphabetical order for your test names.
let things:[String] = ["test-2","test-1","test-10"] let sorted = things.sorted() //["test-1", "test-10", "test-2"]
Pad out the names to get your desired order.
let things:[String] = ["test-02","test-01","test-10"] let sorted = things.sorted() //["test-01", "test-02", "test-10"]
At a more structural level the requirement to run test in a particular order might indicate that the tests are not decoupled. i.e
test-10 should not depend on state setup by