Can I run an XCTest suite multiple times?

前端 未结 6 1719
盖世英雄少女心
盖世英雄少女心 2021-01-12 05:37

Is it possible to have Xcode run your unit tests multiple times?

I had an issue in several unit tests that caused intermittent failures. Now that I think I\

6条回答
  •  情书的邮戳
    2021-01-12 06:29

    It might help you to use

    func testMultiple() {
        self.measureBlock() {
                ...
                XCTAssert(errMessage == nil, "no error expected")        
        }
    }
    

    This runs the code inside self.measureBlock() multiple times to measure the average time.

    It is work to change the code, but you might want to know the execution time anyways.

    This answer might be close enough to what you want and it is easy to do.

提交回复
热议问题