Fastfile 925 B

12345678910111213141516171819202122232425262728293031323334
  1. XC_PROJECT = File.absolute_path('../WebDriverAgent.xcodeproj')
  2. RETRIES = 3
  3. lane :test do
  4. test_run_block = lambda do |testrun_info|
  5. failed_test_count = testrun_info[:failed].size
  6. if failed_test_count > 0
  7. UI.important("Failed tests count: #{failed_test_count}")
  8. try_attempt = testrun_info[:try_count]
  9. if try_attempt < RETRIES
  10. UI.header("Re-running failing tests (attempt #{try_attempt} of #{RETRIES})")
  11. reset_simulator_contents
  12. end
  13. end
  14. end
  15. # https://docs.fastlane.tools/actions/scan/
  16. result = multi_scan(
  17. project: XC_PROJECT,
  18. try_count: RETRIES,
  19. fail_build: false,
  20. scheme: ENV['SCHEME'],
  21. sdk: ENV['SDK'],
  22. destination: ENV['DEST'],
  23. testrun_completed_block: test_run_block
  24. )
  25. unless result[:failed_testcount].zero?
  26. msg = "There are #{result[:failed_testcount]} legitimate failing tests"
  27. UI.message(msg)
  28. raise msg
  29. end
  30. end