简体   繁体   中英

Fastlane: Run iOS unit test without build

I have fastlane setup which builds app for UI test & unit test. Problem is that when I run fastlane build (to generate.app file for ui test) and fastlane test (for unit test), it's building project 2 times. So my question is, is there anyway to unit test iOS app without building project again(maybe we can use build output from fastlane build command)?

Thanks

desc "Build for UI tests"
lane :build do
  xcbuild(
     workspace: "test.xcworkspace",
     scheme: "Debug",
     configuration: "Debug",
  )
end

desc "Run Swift tests"
lane :test do
  scan(
    scheme: "AppTests"
  )
end

Use scan for building too and derived_data_path parameter to share compiled sources. Something like this:

desc "Build for UI tests"
lane :build do
  scan(
    workspace: "test.xcworkspace",
    scheme: "Debug",
    skip_build: false,
    derived_data_path: "derived_data",
    build_for_testing: true
  )
end

desc "Run Swift tests"
lane :test do
  scan(
    workspace: "test.xcworkspace",
    scheme: "AppTests",
    test_without_building: true
    derived_data_path: "derived_data"
  )
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM