xcodebuildfastlanefastlane-snapshot

iOS - How to pass build params in fastlane snapshot


I am using fastlane snapshot tool for taking snapshot for app screens.

According to fastlane community, i need to run,

fastlane snapshot init

Then after configuring project ui test target, i need to run

fastlane snapshot

But if I want to provide some build parameters like, xcodebuild test test-only params, how can I do that. For example i want to build like,

xcodebuild test -workspace <path>
                -scheme <name>
                -destination <specifier>
                -only-testing:TestBundleA/TestSuiteA/TestCaseA
                -only-testing:TestBundleB/TestSuiteB
                -only-testing:TestBundleC

I see,

fastlane snapshot --help

enter image description here

Then I added in Snapfile,

xcargs -only-testing:TestBundleB/TestSuiteB

But this gives error

(eval):36: syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '(' only-testing:TestBundleB/TestSuiteB

How can i solve this error?


Solution

  • I am not familiar with running snapshot from the command line, so if you can, I would recommend creating a fastlane/Fastfile (or editing it if it already exists) to have a lane that calls snapshot with the options that you are looking for. You can call it with its various parameters as explained in the docs

    The example shows you how snapshot could be called, and the Parameters table describes the other parameters you can pass to the fastlane Action.

    To pass xcargs via the Snapfile, try xcargs "-only-testing:TestBundleB/TestSuiteB" in your Snapfile. See this Issue.