diff --git a/README.md b/README.md index f05abe74..3c530b64 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,6 @@ Run tests with custom xcconfig file path: | `test_repetition_mode` | Determines how the tests will repeat. Available options: - `none`: Tests will never repeat. - `until_failure`: Tests will repeat until failure or up to maximum repetitions. - `retry_on_failure`: Only failed tests will repeat up to maximum repetitions. - `up_until_maximum_repetitions`: Tests will repeat up until maximum repetitions. The input value together with Maximum Test Repetitions (`maximum_test_repetitions`) input sets xcodebuild's `-run-tests-until-failure` / `-retry-tests-on-failure` or `-test-iterations` option. | | `none` | | `maximum_test_repetitions` | The maximum number of times a test repeats based on the Test Repetition Mode (`test_repetition_mode`). Should be more than 1 if the Test Repetition Mode is other than `none`. The input value sets xcodebuild's `-test-iterations` option. | required | `3` | | `relaunch_tests_for_each_repetition` | If this input is set, tests will launch in a new process for each repetition. By default, tests launch in the same process for each repetition. The input value sets xcodebuild's `-test-repetition-relaunch-enabled` option. | | `no` | -| `should_retry_test_on_fail` | If this input is set, the Step will rerun the tests in the case of failed tests. Note that all the tests will be rerun, not just the ones that failed. This input is not available if you are using Xcode 13+. In that case, we recommend using the `retry_on_failure` Test Repetition Mode (`test_repetition_mode`). | required | `no` | | `xcconfig_content` | Build settings to override the project's build settings, using xcodebuild's `-xcconfig` option. You can't define `-xcconfig` option in `Additional options for the xcodebuild command` if this input is set. If empty, no setting is changed. When set it can be either: 1. Existing `.xcconfig` file path. Example: `./ios-sample/ios-sample/Configurations/Dev.xcconfig` 2. The contents of a newly created temporary `.xcconfig` file. (This is the default.) Build settings must be separated by newline character (`\n`). Example: ``` COMPILER_INDEX_STORE_ENABLE = NO ONLY_ACTIVE_ARCH[config=Debug][sdk=*][arch=*] = YES ``` | | `COMPILER_INDEX_STORE_ENABLE = NO` | | `perform_clean_action` | If this input is set, `clean` xcodebuild action will be performed besides the `test` action. | required | `no` | | `xcodebuild_options` | Additional options to be added to the executed xcodebuild command. Prefer using `Build settings (xcconfig)` input for specifying `-xcconfig` option. You can't use both. | | | diff --git a/e2e/bitrise.yml b/e2e/bitrise.yml index 7b12c507..49cf5812 100644 --- a/e2e/bitrise.yml +++ b/e2e/bitrise.yml @@ -11,68 +11,12 @@ workflows: - TEST_PLAN: "" - DESTINATION: platform=iOS Simulator,name=Bitrise iOS default,OS=latest - LOG_FORMATTER: xcbeautify - - RETRY_ON_FAILURE: "no" - EXPECT_TEST_FAILURE: "false" - CACHE_LEVEL: swift_packages after_run: - _run - _check_outputs - test_rosetta_simulator: - description: Rosetta Simulator requires Xcode 14.3+. - steps: - - bitrise-run: - run_if: |- - {{ or (enveq "IS_LATEST_STACK_XCODE" "true") (not .IsCI) }} - inputs: - - workflow_id: utility_test_rosetta_simulator - - bitrise_config_path: ./e2e/bitrise.yml - - utility_test_rosetta_simulator: - envs: - - TEST_APP_URL: https://github.com/bitrise-io/Bitrise-iOS-x86-Framework-Sample.git - - TEST_APP_BRANCH: main - - BITRISE_PROJECT_PATH: Bitrise-iOS-x86-Framework-Sample.xcworkspace - - BITRISE_SCHEME: Bitrise-iOS-x86-Framework-Sample - - TEST_PLAN: "" - - DESTINATION: platform=iOS Simulator,name=iPhone 11,OS=latest,arch=x86_64 - - LOG_FORMATTER: xcbeautify - - RETRY_ON_FAILURE: "no" - - EXPECT_TEST_FAILURE: "false" - - CACHE_LEVEL: none - - COLLECT_SIM_DIAGNOSTICS: never - after_run: - - _run - - _check_outputs - - test_rosetta_simulator_failure: - description: Rosetta Simulator requires Xcode 14.3+. - steps: - - bitrise-run: - run_if: |- - {{ or (enveq "IS_LATEST_STACK_XCODE" "true") (not .IsCI) }} - is_skippable: true - inputs: - - workflow_id: utility_test_rosetta_simulator_failure - - bitrise_config_path: ./e2e/bitrise.yml - - utility_test_rosetta_simulator_failure: - envs: - - TEST_APP_URL: https://github.com/bitrise-io/Bitrise-iOS-x86-Framework-Sample.git - - TEST_APP_BRANCH: main - - BITRISE_PROJECT_PATH: Bitrise-iOS-x86-Framework-Sample.xcworkspace - - BITRISE_SCHEME: Bitrise-iOS-x86-Framework-Sample - - TEST_PLAN: "" - - DESTINATION: platform=iOS Simulator,name=iPhone 11,OS=latest - - LOG_FORMATTER: xcbeautify - - RETRY_ON_FAILURE: "no" - - EXPECT_TEST_FAILURE: "true" - - CACHE_LEVEL: none - - COLLECT_SIM_DIAGNOSTICS: never - after_run: - - _run - - _check_outputs - test_objc_xcpretty: envs: - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc-with-uitest.git @@ -82,7 +26,6 @@ workflows: - TEST_PLAN: "" - DESTINATION: platform=iOS Simulator,name=Bitrise iOS default,OS=latest - LOG_FORMATTER: xcpretty - - RETRY_ON_FAILURE: "no" - EXPECT_TEST_FAILURE: "false" - CACHE_LEVEL: none after_run: @@ -101,7 +44,6 @@ workflows: - TEST_PLAN: UnitTests - DESTINATION: platform=iOS Simulator,name=iPhone 12,OS=latest - LOG_FORMATTER: xcbeautify - - RETRY_ON_FAILURE: "no" - EXPECT_TEST_FAILURE: "false" - CACHE_LEVEL: swift_packages after_run: @@ -118,7 +60,6 @@ workflows: - TEST_PLAN: "" - DESTINATION: platform=iOS Simulator,name=Bitrise iOS default,OS=latest - LOG_FORMATTER: xcodebuild - - RETRY_ON_FAILURE: "no" - EXPECT_TEST_FAILURE: "false" - CACHE_LEVEL: none - XCCONFIG_CONTENT: ./_tmp2/p.xcconfig @@ -202,35 +143,9 @@ workflows: - perform_clean_action: "yes" - xcodebuild_options: -verbose - verbose_log: "yes" - - should_retry_test_on_fail: $RETRY_ON_FAILURE - cache_level: $CACHE_LEVEL - collect_simulator_diagnostics: $COLLECT_SIM_DIAGNOSTICS - _expose_xcode_version: - steps: - - script: - title: Expose Xcode major version - inputs: - - content: |- - #!/bin/env bash - set -e - - if [[ ! -z "$XCODE_MAJOR_VERSION" ]]; then - echo "Xcode major version already exposed: $XCODE_MAJOR_VERSION" - exit 0 - fi - - version=`xcodebuild -version` - regex="Xcode ([0-9]*)." - if [[ ! $version =~ $regex ]]; then - echo "Failed to determine Xcode major version" - exit 1 - fi - - xcode_major_version=${BASH_REMATCH[1]} - echo "Xcode major version: $xcode_major_version" - envman add --key XCODE_MAJOR_VERSION --value $xcode_major_version - _clear_outputs: steps: - script: diff --git a/main.go b/main.go index 838814e6..8d823923 100644 --- a/main.go +++ b/main.go @@ -76,7 +76,7 @@ func createConfigParser(logger log.Logger) step.XcodeTestConfigParser { deviceFinder := destination.NewDeviceFinder(logger, commandFactory, xcodeVersion) utils := step.NewUtils(logger) - return step.NewXcodeTestConfigParser(inputParser, logger, xcodeVersion, deviceFinder, pathModifier, utils) + return step.NewXcodeTestConfigParser(inputParser, logger, deviceFinder, pathModifier, utils) } func createStep(logger log.Logger, logFormatter string) (step.XcodeTestRunner, error) { diff --git a/step.yml b/step.yml index 07e1bd72..daeb87b3 100644 --- a/step.yml +++ b/step.yml @@ -93,7 +93,7 @@ inputs: - test_repetition_mode: none opts: category: Test Repetition - title: Test Repetition Mode (Available in Xcode 13+) + title: Test Repetition Mode summary: Determines how the tests will repeat. description: |- Determines how the tests will repeat. @@ -114,7 +114,7 @@ inputs: - maximum_test_repetitions: 3 opts: category: Test Repetition - title: Maximum Test Repetitions (Available in Xcode 13+) + title: Maximum Test Repetitions summary: The maximum number of times a test repeats based on the Test Repetition Mode (`test_repetition_mode`). description: |- The maximum number of times a test repeats based on the Test Repetition Mode (`test_repetition_mode`). @@ -126,7 +126,7 @@ inputs: - relaunch_tests_for_each_repetition: "no" opts: - title: Relaunch Tests for Each Repetition (Available in Xcode 13+) + title: Relaunch Tests for Each Repetition category: Test Repetition summary: If this input is set, tests will launch in a new process for each repetition. description: |- @@ -139,22 +139,6 @@ inputs: - "yes" - "no" -- should_retry_test_on_fail: "no" - opts: - category: Test Repetition - title: Should retry tests on failure? (Not available in Xcode 13+) - summary: If set, the Step will rerun the tests in the case of failed tests. - description: |- - If this input is set, the Step will rerun the tests in the case of failed tests. - - Note that all the tests will be rerun, not just the ones that failed. - - This input is not available if you are using Xcode 13+. In that case, we recommend using the `retry_on_failure` Test Repetition Mode (`test_repetition_mode`). - value_options: - - "yes" - - "no" - is_required: true - # xcodebuild configuration - xcconfig_content: COMPILER_INDEX_STORE_ENABLE = NO diff --git a/step/step.go b/step/step.go index 4dc9c451..0229b9ae 100644 --- a/step/step.go +++ b/step/step.go @@ -19,7 +19,6 @@ import ( "github.com/bitrise-io/go-xcode/v2/simulator" cache "github.com/bitrise-io/go-xcode/v2/xcodecache" "github.com/bitrise-io/go-xcode/v2/xcodecommand" - "github.com/bitrise-io/go-xcode/v2/xcodeversion" "github.com/bitrise-steplib/steps-xcode-test/output" "github.com/bitrise-steplib/steps-xcode-test/xcodebuild" "github.com/kballard/go-shellquote" @@ -37,7 +36,6 @@ type Input struct { TestRepetitionMode string `env:"test_repetition_mode,opt[none,until_failure,retry_on_failure,up_until_maximum_repetitions]"` MaximumTestRepetitions int `env:"maximum_test_repetitions,required"` RelaunchTestsForEachRepetition bool `env:"relaunch_tests_for_each_repetition,opt[yes,no]"` - RetryTestsOnFailure bool `env:"should_retry_test_on_fail,opt[yes,no]"` // xcodebuild configuration XCConfigContent string `env:"xcconfig_content"` @@ -76,7 +74,6 @@ const ( XcprettyTool = "xcpretty" ) -// Config ... type Config struct { ProjectPath string Scheme string @@ -85,12 +82,9 @@ type Config struct { Simulator destination.Device IsSimulatorBooted bool - XcodeMajorVersion int - TestRepetitionMode string MaximumTestRepetitions int RelaunchTestForEachRepetition bool - RetryTestsOnFailure bool XCConfigContent string PerformCleanAction bool @@ -110,24 +104,21 @@ type Config struct { type XcodeTestConfigParser struct { logger log.Logger inputParser stepconf.InputParser - xcodeVersion xcodeversion.Version deviceFinder destination.DeviceFinder pathModifier pathutil.PathModifier utils Utils } -func NewXcodeTestConfigParser(inputParser stepconf.InputParser, logger log.Logger, xcodeVersion xcodeversion.Version, deviceFinder destination.DeviceFinder, pathModifier pathutil.PathModifier, utils Utils) XcodeTestConfigParser { +func NewXcodeTestConfigParser(inputParser stepconf.InputParser, logger log.Logger, deviceFinder destination.DeviceFinder, pathModifier pathutil.PathModifier, utils Utils) XcodeTestConfigParser { return XcodeTestConfigParser{ logger: logger, inputParser: inputParser, - xcodeVersion: xcodeVersion, deviceFinder: deviceFinder, pathModifier: pathModifier, utils: utils, } } -// XcodeTestRunner ... type XcodeTestRunner struct { logger log.Logger commandFactory command.Factory @@ -140,7 +131,6 @@ type XcodeTestRunner struct { utils Utils } -// NewXcodeTestRunner ... func NewXcodeTestRunner(logger log.Logger, commandFactory command.Factory, xcodebuild xcodebuild.Xcodebuild, simulatorManager simulator.Manager, cache cache.SwiftPackageCache, outputExporter output.Exporter, pathModifier pathutil.PathModifier, pathProvider pathutil.PathProvider, utils Utils) XcodeTestRunner { return XcodeTestRunner{ logger: logger, @@ -155,7 +145,6 @@ func NewXcodeTestRunner(logger log.Logger, commandFactory command.Factory, xcode } } -// ProcessConfig ... func (s XcodeTestConfigParser) ProcessConfig() (Config, error) { var input Input err := s.inputParser.Parse(&input) @@ -166,12 +155,6 @@ func (s XcodeTestConfigParser) ProcessConfig() (Config, error) { stepconf.Print(input) s.logger.EnableDebugLog(input.VerboseLog) - s.logger.Printf("- xcodebuild_version: %s (%s)", s.xcodeVersion.Version, s.xcodeVersion.BuildVersion) - s.logger.Println() - if err := s.validateXcodeVersion(&input, int(s.xcodeVersion.MajorVersion)); err != nil { - return Config{}, err - } - // validate project path projectPath, err := s.pathModifier.AbsPath(input.ProjectPath) if err != nil { @@ -214,10 +197,9 @@ func (s XcodeTestConfigParser) ProcessConfig() (Config, error) { return Config{}, fmt.Errorf("`-xcconfig` option found in 'Additional options for the xcodebuild command' (xcodebuild_options), please clear 'Build settings (xcconfig)' (`xcconfig_content`) input as only one can be set") } - return s.utils.CreateConfig(input, projectPath, int(s.xcodeVersion.MajorVersion), sim, additionalOptions, additionalLogFormatterOptions), nil + return s.utils.CreateConfig(input, projectPath, sim, additionalOptions, additionalLogFormatterOptions), nil } -// InstallDeps ... func (s XcodeTestRunner) InstallDeps() { logFormatterVersion, err := s.xcodebuild.GetXcodeCommadRunner().CheckInstall() if err != nil { @@ -233,7 +215,6 @@ func (s XcodeTestRunner) InstallDeps() { } } -// Result ... type Result struct { Scheme string DeployDir string @@ -244,7 +225,6 @@ type Result struct { SimulatorDiagnosticsPath string } -// Run ... func (s XcodeTestRunner) Run(cfg Config) (Result, error) { enableSimulatorVerboseLog := cfg.CollectSimulatorDiagnostics != never launchSimulator := !cfg.IsSimulatorBooted && !cfg.HeadlessMode @@ -287,7 +267,6 @@ func (s XcodeTestRunner) Run(cfg Config) (Result, error) { return result, nil } -// Export ... func (s XcodeTestRunner) Export(result Result, testFailed bool) error { // export test run status s.outputExporter.ExportTestRunResult(testFailed) @@ -345,23 +324,6 @@ func (s XcodeTestConfigParser) parseAdditionalLogFormatterOptions(logFormatter, } } -func (s XcodeTestConfigParser) validateXcodeVersion(input *Input, xcodeMajorVersion int) error { - if xcodeMajorVersion == 0 { - s.logger.Printf("Skipping Xcode major version check as it is not available.") - return nil - } - - if input.TestRepetitionMode != xcodebuild.TestRepetitionNone && xcodeMajorVersion < 13 { - return errors.New("Test Repetition Mode (test_repetition_mode) is not available below Xcode 13") - } - - if input.RetryTestsOnFailure && xcodeMajorVersion > 12 { - return errors.New("Should retry tests on failure? (should_retry_test_on_fail) is not available above Xcode 12; use test_repetition_mode=retry_on_failure instead") - } - - return nil -} - func (s XcodeTestConfigParser) getSimulatorForDestination(destinationSpecifier string) (destination.Device, error) { simulatorDestination, err := destination.NewSimulator(destinationSpecifier) if err != nil { diff --git a/step/step_test.go b/step/step_test.go index 08d697cc..0614709d 100644 --- a/step/step_test.go +++ b/step/step_test.go @@ -9,7 +9,6 @@ import ( "github.com/bitrise-io/go-steputils/v2/stepconf" "github.com/bitrise-io/go-utils/v2/log" "github.com/bitrise-io/go-xcode/v2/destination" - "github.com/bitrise-io/go-xcode/v2/xcodeversion" commonMocks "github.com/bitrise-steplib/steps-xcode-test/mocks" "github.com/bitrise-steplib/steps-xcode-test/step/mocks" "github.com/hashicorp/go-version" @@ -46,14 +45,12 @@ func Test_GivenStep_WhenRuns_ThenXcodebuildGetsCalled(t *testing.T) { ProjectPath: "./project.xcodeproj", Scheme: "Project", - XcodeMajorVersion: 13, Simulator: destination.Device{ID: "1234"}, IsSimulatorBooted: true, TestRepetitionMode: "none", MaximumTestRepetitions: 0, RelaunchTestForEachRepetition: true, - RetryTestsOnFailure: false, LogFormatter: "xcodebuild", PerformCleanAction: false, @@ -72,72 +69,6 @@ func Test_GivenStep_WhenRuns_ThenXcodebuildGetsCalled(t *testing.T) { mocks.xcodebuilder.AssertCalled(t, "RunTest", mock.Anything) } -func Test_GivenStep_WhenXcodeVersionUnreadable_ThenSuccess(t *testing.T) { - // Given - envValues := defaultEnvValues() - - xcodeVersion := xcodeversion.Version{} - configParser, mocks := createConfigParser(t, envValues, xcodeVersion) - path := strings.TrimPrefix(envValues["project_path"], ".") - mocks.pathModifier.On("AbsPath", mock.Anything).Return(path, nil) - mocks.deviceFinder.On("FindDevice", mock.Anything, mock.Anything).Return(defaultSimulator(), nil) - - // When - _, err := configParser.ProcessConfig() - - // Then - require.NoError(t, err) -} - -func Test_GivenXcode13OrNewer_WhenShouldRetryTestOnFailIsSet_ThenFails(t *testing.T) { - // Given - envValues := defaultEnvValues() - envValues["should_retry_test_on_fail"] = "yes" - - xcodeVersion := newVersion(13) - configParser, _ := createConfigParser(t, envValues, xcodeVersion) - - // When - _, err := configParser.ProcessConfig() - - // Then - require.Error(t, err) -} - -func Test_GivenXcode12OrOlder_WhenTestRepetitionModeIsSet_ThenFails(t *testing.T) { - // Given - envValues := defaultEnvValues() - envValues["test_repetition_mode"] = "retry_on_failure" - - ver := newVersion(12) - configParser, _ := createConfigParser(t, envValues, ver) - - // When - _, err := configParser.ProcessConfig() - - // Then - require.Error(t, err) -} - -func Test_GivenTestRepetitionModeIsNone_WhenRelaunchTestsForEachRepetitionIsSet_ThenFails(t *testing.T) { - // Given - envValues := defaultEnvValues() - envValues["relaunch_tests_for_each_repetition"] = "yes" - - xcodeVersion := newVersion(12) - configParser, mocks := createConfigParser(t, envValues, xcodeVersion) - - path := strings.TrimPrefix(envValues["project_path"], ".") - mocks.pathModifier.On("AbsPath", mock.Anything).Return(path, nil) - mocks.deviceFinder.On("FindDevice", mock.Anything, mock.Anything).Return(defaultSimulator(), nil) - - // When - _, err := configParser.ProcessConfig() - - // Then - require.Error(t, err) -} - func Test_GivenStep_WhenInstallXcpretty_ThenInstallIt(t *testing.T) { // Given step, mocks := createStepAndMocks(t) @@ -163,8 +94,7 @@ func Test_GivenLogFormatterIsXcbeautify_WhenParsesConfig_ThenAdditionalOptionsWo envValues["log_formatter"] = "xcbeautify" envValues["xcbeautify_options"] = "'--is-ci' '-q'" - xcodeVersion := newVersion(13) - configParser, mocks := createConfigParser(t, envValues, xcodeVersion) + configParser, mocks := createConfigParser(t, envValues) path := strings.TrimPrefix(envValues["project_path"], ".") mocks.pathModifier.On("AbsPath", mock.Anything).Return(path, nil) @@ -184,12 +114,9 @@ func Test_GivenLogFormatterIsXcbeautify_WhenParsesConfig_ThenAdditionalOptionsWo Simulator: device, IsSimulatorBooted: false, - XcodeMajorVersion: 13, - TestRepetitionMode: "none", MaximumTestRepetitions: 3, RelaunchTestForEachRepetition: false, - RetryTestsOnFailure: false, XcodebuildOptions: []string{}, @@ -305,7 +232,7 @@ func defaultResult() Result { } } -func createConfigParser(t *testing.T, envValues map[string]string, xcodeVersion xcodeversion.Version) (XcodeTestConfigParser, configParserMocks) { +func createConfigParser(t *testing.T, envValues map[string]string) (XcodeTestConfigParser, configParserMocks) { envRepository := mocks.NewRepository(t) if envValues != nil { @@ -323,7 +250,7 @@ func createConfigParser(t *testing.T, envValues map[string]string, xcodeVersion pathModifier := mocks.NewPathModifier(t) utils := NewUtils(logger) - configParser := NewXcodeTestConfigParser(inputParser, logger, xcodeVersion, deviceFinder, pathModifier, utils) + configParser := NewXcodeTestConfigParser(inputParser, logger, deviceFinder, pathModifier, utils) mocks := configParserMocks{ deviceFinder: deviceFinder, pathModifier: pathModifier, @@ -356,11 +283,3 @@ func createStepAndMocks(t *testing.T) (XcodeTestRunner, stepMocks) { return step, mocks } - -func newVersion(major int64) xcodeversion.Version { - return xcodeversion.Version{ - Version: "test-version", - BuildVersion: "test-build", - MajorVersion: major, - } -} diff --git a/step/utils.go b/step/utils.go index 64745f59..869764c3 100644 --- a/step/utils.go +++ b/step/utils.go @@ -12,7 +12,7 @@ import ( type Utils interface { PrintLastLinesOfXcodebuildTestLog(rawXcodebuildOutput string, isRunSuccess bool) - CreateConfig(input Input, projectPath string, xcodeMajorVersion int, sim destination.Device, additionalOptions, additionalLogFormatterOptions []string) Config + CreateConfig(input Input, projectPath string, sim destination.Device, additionalOptions, additionalLogFormatterOptions []string) Config CreateTestParams(cfg Config, xcresultPath, swiftPackagesPath string) xcodebuild.TestRunParams } @@ -51,7 +51,6 @@ that will attach the file to your build as an artifact!`)) func (u utils) CreateConfig(input Input, projectPath string, - xcodeMajorVersion int, sim destination.Device, additionalOptions, additionalLogFormatterOptions []string) Config { return Config{ @@ -62,12 +61,9 @@ func (u utils) CreateConfig(input Input, Simulator: sim, IsSimulatorBooted: sim.Status != simulatorShutdownState, - XcodeMajorVersion: xcodeMajorVersion, - TestRepetitionMode: input.TestRepetitionMode, MaximumTestRepetitions: input.MaximumTestRepetitions, RelaunchTestForEachRepetition: input.RelaunchTestsForEachRepetition, - RetryTestsOnFailure: input.RetryTestsOnFailure, XCConfigContent: input.XCConfigContent, PerformCleanAction: input.PerformCleanAction, @@ -97,7 +93,6 @@ func (u utils) CreateTestParams(cfg Config, xcresultPath, swiftPackagesPath stri RelaunchTestsForEachRepetition: cfg.RelaunchTestForEachRepetition, XCConfigContent: cfg.XCConfigContent, PerformCleanAction: cfg.PerformCleanAction, - RetryTestsOnFailure: cfg.RetryTestsOnFailure, AdditionalOptions: cfg.XcodebuildOptions, } diff --git a/xcodebuild/utils.go b/xcodebuild/utils.go index d3687eb0..9e8ff293 100644 --- a/xcodebuild/utils.go +++ b/xcodebuild/utils.go @@ -52,7 +52,6 @@ type TestParams struct { RelaunchTestsForEachRepetition bool XCConfigContent string PerformCleanAction bool - RetryTestsOnFailure bool AdditionalOptions []string } @@ -162,7 +161,6 @@ func (b *xcodebuild) handleTestRunError(prevRunParams TestRunParams, prevRunResu if prevRunParams.RetryOnTestRunnerError { b.logger.Printf("Automatic retry is enabled - retrying...") - prevRunParams.TestParams.RetryTestsOnFailure = false prevRunParams.RetryOnTestRunnerError = false return b.cleanOutputDirAndRerunTest(prevRunParams) } @@ -172,14 +170,5 @@ func (b *xcodebuild) handleTestRunError(prevRunParams TestRunParams, prevRunResu } } - if prevRunParams.TestParams.RetryTestsOnFailure { - b.logger.Warnf("Test run failed") - b.logger.Printf("'Should retry tests on failure?' (should_retry_test_on_fail) is enabled - retrying...") - - prevRunParams.TestParams.RetryTestsOnFailure = false - prevRunParams.RetryOnTestRunnerError = false - return b.cleanOutputDirAndRerunTest(prevRunParams) - } - return prevRunResult.xcodebuildLog, prevRunResult.exitCode, prevRunResult.err } diff --git a/xcodebuild/xcodebuild_test.go b/xcodebuild/xcodebuild_test.go index d9c5a573..5237180f 100644 --- a/xcodebuild/xcodebuild_test.go +++ b/xcodebuild/xcodebuild_test.go @@ -165,16 +165,6 @@ func Test_GivenTestRunError_WhenAnUnknownErrorHappened_ThenActsBasedOnTheConfig( numberOfCalls int parameters func() TestRunParams }{ - { - name: "Reruns tests when should_retry_test_on_fail is enabled", - numberOfCalls: 2, - parameters: func() TestRunParams { - parameters := runParameters() - parameters.TestParams.RetryTestsOnFailure = true - - return parameters - }, - }, { name: "Does nothing when should_retry_test_on_fail is disabled", numberOfCalls: 1, @@ -260,7 +250,6 @@ func runParameters() TestRunParams { RelaunchTestsForEachRepetition: true, XCConfigContent: "XCConfigContent", PerformCleanAction: false, - RetryTestsOnFailure: false, AdditionalOptions: []string{"AdditionalOptions"}, }