Rajkanth

Q: What is the order of calling XCTest test functions in Xcode 8?

XCTest test functions(also classes) was called in alphabetical order (before Xcode 8). With Xcode 8, I can not assume in which order the test cases are called by the system.

Can someone throw some light on it?

Posted on Sep 29, 2016 4:08 AM

Close

Q: What is the order of calling XCTest test functions in Xcode 8?

  • All replies
  • Helpful answers

  • by hokanst,

    hokanst hokanst Sep 29, 2016 8:39 AM in response to Rajkanth
    Level 2 (300 points)
    Sep 29, 2016 8:39 AM in response to Rajkanth

    There is no official order, test methods should be written so that they can be run in any order. This is needed when using Xcode to manually run single test methods to e.g. speed up the debug/test cycle when fixing a buggy method.

     

    A test class can implement -setUp and -tearDown to setup/clean up the test environment before and after each test method run. There are also +setUp and +tearDown methods to do the same on a per test class level.