Can I run an XCTest suite multiple times?

前端 未结 6 1664
盖世英雄少女心
盖世英雄少女心 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:15

    I had used the invokeTest() override in the past (Xcode 10) with great success. But now in Xcode 11 its not working (for me at least). What I ended up doing was:

    func test99Loop() {
        for i in 0.. 0 { tearDown(); sleep(1); setUp() }
            test3NineUrls()
            do { tearDown(); sleep(1) }
            setUp()
            test6NineCombine()
    
            print("Finished Loop \(i)")
        }
    }
    

    I obviously use setup/teardown, and this is the proper way to do those multiple times (since the first and last are called by Xcode).

提交回复
热议问题