diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04e5860c..906c3aa4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,6 +186,7 @@ jobs: -scheme Tests \ -configuration Debug \ -destination '${{ steps.select_sim.outputs.destination }}' \ + -parallel-testing-enabled NO \ -enableCodeCoverage YES | xcbeautify && exit ${PIPESTATUS[0]} - name: Upload coverage to Codecov diff --git a/Tests/UnitTests/AddDownloadHandlersTests.swift b/Tests/UnitTests/AddDownloadHandlersTests.swift index d152eb1b..a2ab3e29 100644 --- a/Tests/UnitTests/AddDownloadHandlersTests.swift +++ b/Tests/UnitTests/AddDownloadHandlersTests.swift @@ -12,6 +12,14 @@ import XCTest class AddDownloadHandlersTests: XCTestCase { let crowdinSDKConfig = CrowdinSDKConfig.config().with(crowdinProviderConfig: CrowdinProviderConfig(hashString: "5290b1cfa1eb44bf2581e78106i", sourceLanguage: "en")) + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) + } + override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. CrowdinSDK.removeAllDownloadHandlers() diff --git a/Tests/UnitTests/AddErrorHandlersTests.swift b/Tests/UnitTests/AddErrorHandlersTests.swift index 86a9b94e..57d3ff87 100644 --- a/Tests/UnitTests/AddErrorHandlersTests.swift +++ b/Tests/UnitTests/AddErrorHandlersTests.swift @@ -10,6 +10,14 @@ import XCTest @testable import CrowdinSDK class AddErrorHandlersTests: XCTestCase { + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) + } + override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. CrowdinSDK.removeAllErrorHandlers() diff --git a/Tests/UnitTests/CrowdinSDKTests.swift b/Tests/UnitTests/CrowdinSDKTests.swift index fe843105..43f72ca4 100644 --- a/Tests/UnitTests/CrowdinSDKTests.swift +++ b/Tests/UnitTests/CrowdinSDKTests.swift @@ -10,9 +10,13 @@ import XCTest @testable import CrowdinSDK class CrowdinSDKTests: XCTestCase { - override func setUp() { + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) CrowdinSDK.deintegrate() - super.setUp() } override func tearDown() { diff --git a/Tests/UnitTests/CrowdinStringTests.swift b/Tests/UnitTests/CrowdinStringTests.swift index 3c035c85..10594827 100644 --- a/Tests/UnitTests/CrowdinStringTests.swift +++ b/Tests/UnitTests/CrowdinStringTests.swift @@ -12,6 +12,14 @@ import XCTest class CrowdinStringTestsLocalization: XCTestCase { let crowdinSDKConfig = CrowdinSDKConfig.config().with(crowdinProviderConfig: CrowdinProviderConfig(hashString: "5290b1cfa1eb44bf2581e78106i", sourceLanguage: "en")) + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) + } + override func tearDown() { CrowdinSDK.removeAllDownloadHandlers() CrowdinSDK.deintegrate() @@ -78,4 +86,3 @@ class CrowdinStringTestsLocalization: XCTestCase { wait(for: [expectation], timeout: 60.0) } } - diff --git a/Tests/UnitTests/CrowdinSupportedLanguagesThreadSafetyTests.swift b/Tests/UnitTests/CrowdinSupportedLanguagesThreadSafetyTests.swift index 955dd6d5..e16cccf1 100644 --- a/Tests/UnitTests/CrowdinSupportedLanguagesThreadSafetyTests.swift +++ b/Tests/UnitTests/CrowdinSupportedLanguagesThreadSafetyTests.swift @@ -11,6 +11,14 @@ import XCTest class CrowdinSupportedLanguagesThreadSafetyTests: XCTestCase { + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) + } + override func setUp() { super.setUp() CrowdinSDK.deintegrate() @@ -141,6 +149,8 @@ class CrowdinSupportedLanguagesThreadSafetyTests: XCTestCase { let initialLoadExpectation = XCTestExpectation(description: "Initial load") supportedLanguages.downloadSupportedLanguages(completion: { initialLoadExpectation.fulfill() + }, error: { _ in + initialLoadExpectation.fulfill() }) wait(for: [initialLoadExpectation], timeout: 60.0) @@ -223,6 +233,8 @@ class CrowdinSupportedLanguagesThreadSafetyTests: XCTestCase { DispatchQueue.global(qos: .background).async { manifest.crowdinSupportedLanguages.downloadSupportedLanguages(completion: { expectation.fulfill() + }, error: { _ in + expectation.fulfill() }) } } @@ -318,6 +330,8 @@ class CrowdinSupportedLanguagesThreadSafetyTests: XCTestCase { // Write operation through download supportedLanguages.downloadSupportedLanguages(completion: { expectation.fulfill() + }, error: { _ in + expectation.fulfill() }) } } diff --git a/Tests/UnitTests/CrowdinTesterTests.swift b/Tests/UnitTests/CrowdinTesterTests.swift index 0393e85a..89ccbca2 100644 --- a/Tests/UnitTests/CrowdinTesterTests.swift +++ b/Tests/UnitTests/CrowdinTesterTests.swift @@ -10,8 +10,12 @@ import XCTest @testable import CrowdinSDK class CrowdinTesterTests: XCTestCase { - override func setUp() { - super.setUp() + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) // Put setup code here. This method is called before the invocation of each test method in the class. let crowdinProviderConfig = CrowdinProviderConfig(hashString: "5290b1cfa1eb44bf2581e78106i", sourceLanguage: "en") diff --git a/Tests/UnitTests/EnableSDKLocalizationTests.swift b/Tests/UnitTests/EnableSDKLocalizationTests.swift index e7fbb754..bdf4a76c 100644 --- a/Tests/UnitTests/EnableSDKLocalizationTests.swift +++ b/Tests/UnitTests/EnableSDKLocalizationTests.swift @@ -11,8 +11,12 @@ import XCTest class EnableSDKLocalizationTests: XCTestCase { - override func setUp() { - super.setUp() + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) // Put setup code here. This method is called before the invocation of each test method in the class. let crowdinProviderConfig = CrowdinProviderConfig(hashString: "5290b1cfa1eb44bf2581e78106i", sourceLanguage: "en") diff --git a/Tests/UnitTests/InfoPlistInitializationTests.swift b/Tests/UnitTests/InfoPlistInitializationTests.swift index 8b7e9390..89e5fa0b 100644 --- a/Tests/UnitTests/InfoPlistInitializationTests.swift +++ b/Tests/UnitTests/InfoPlistInitializationTests.swift @@ -10,8 +10,12 @@ import XCTest @testable import CrowdinSDK class InfoPlistInitializationTests: XCTestCase { - override func setUp() { - super.setUp() + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) CrowdinSDK.deintegrate() } @@ -39,4 +43,3 @@ class InfoPlistInitializationTests: XCTestCase { CrowdinSDK.removeDownloadHandler(hendlerId) } } - diff --git a/Tests/UnitTests/InitializationCompletionHandlerTests.swift b/Tests/UnitTests/InitializationCompletionHandlerTests.swift index 6882cd00..88dc63a0 100644 --- a/Tests/UnitTests/InitializationCompletionHandlerTests.swift +++ b/Tests/UnitTests/InitializationCompletionHandlerTests.swift @@ -10,6 +10,14 @@ import XCTest @testable import CrowdinSDK class InitializationCompletionHandlerTests: XCTestCase { + override func setUpWithError() throws { + try super.setUpWithError() + try XCTSkipUnless( + ProcessInfo.processInfo.environment["CROWDIN_LIVE_TESTS"] == "1", + "Requires live Crowdin distribution. Set CROWDIN_LIVE_TESTS=1 to run." + ) + } + override func tearDown() { CrowdinSDK.deintegrate() CrowdinSDK.stop()