XcodeSelectiveTesting
XcodeSelectiveTesting copied to clipboard
xcodebuild: error: Scheme SCHEME is not currently configured for the test action.
I encountered an issue where the xctestplan has 0 test case.
Is it acceptable to handle this situation in this way? Thanks.
Hey @Wei18 , I also encounted this; this is a tricky case, as the xcodebuild test process is returning a failure code. What I did in practice is to call the XcodeSelectiveTesting tool with --json flag, then parse the JSON and check if it has any targets:
targets_affected_string = `mint run mikeger/XcodeSelectiveTesting --json --verbose --base-branch origin/$BITRISEIO_GIT_BRANCH_DEST`
targets_affected = JSON.parse(targets_affected_string)
if targets_affected.empty?
UI.message "No targets to test. Skipping test."
sh("envman add --key TESTS_SKIPPED --value \"true\"")
else
UI.message "Targets affected directly: " + targets_affected.to_a.join(', ')
Hey @mikeger, Thanks for this idea.
But your current method processes the test plan twice. Is it possible to provide a new command that can directly return the current number of test cases?
Like is pseudocode
mint run mikeger/XcodeSelectiveTesting testplan
mint run mikeger/XcodeSelectiveTesting --count testplan