Can I run an XCTest suite multiple times?

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

    One alternative is to do this via the command line. You can run a single test using the -only-testing argument, and avoid building using test-without-building i.e. (new lines added for clarity)

    for i in {1..10}; \
      do xcodebuild \
        test-without-building \
        -workspace MyApp.xcworkspace \
        -scheme Debug \
        -destination 'platform=iOS Simulator,OS=11.2,name=iPhone 8' \
        -only-testing:MyApp.Tests/TestFile/myTest;
    done
    

提交回复
热议问题