diff options
author | Julian Rex <julian.rex@mapbox.com> | 2018-05-01 07:52:42 -0400 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2018-05-17 17:01:13 -0400 |
commit | e216ca90326b7d39d8fc909c72f8b1043f5da169 (patch) | |
tree | bf8d64391e23aa66dde701d2e4f75a1c408dae4e | |
parent | 1aa5c67837a19d5f8ba8f7336f183da83e68441c (diff) | |
download | qtlocation-mapboxgl-e216ca90326b7d39d8fc909c72f8b1043f5da169.tar.gz |
Added some basic macros to handle pending tests.
6 files changed, 38 insertions, 13 deletions
diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h index ab5d2cc46f..1fd4ff5705 100644 --- a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h +++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h @@ -1,5 +1,6 @@ #import <XCTest/XCTest.h> #import <Mapbox/Mapbox.h> +#import "MGLTestUtility.h" #define TestFailWithSelf(myself, ...) \ _XCTPrimitiveFail(myself, __VA_ARGS__) diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 78cfff965c..68ba1ca6ae 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -998,6 +998,7 @@ AC518DFE201BB55A00EBC820 /* MGLTelemetryConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLTelemetryConfig.m; sourceTree = "<group>"; }; CA0C27932076CA19001CE5B7 /* MGLMapViewIntegrationTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLMapViewIntegrationTest.m; sourceTree = "<group>"; }; CA0C27952076CA50001CE5B7 /* MGLMapViewIntegrationTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLMapViewIntegrationTest.h; sourceTree = "<group>"; }; + CA3B1629209801A5005C087B /* MGLTestUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLTestUtility.h; sourceTree = "<group>"; }; CA4EB8C620863487006AB465 /* MGLStyleLayerIntegrationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLStyleLayerIntegrationTests.m; sourceTree = "<group>"; }; CA55CD3E202C16AA00CE7095 /* MGLCameraChangeReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCameraChangeReason.h; sourceTree = "<group>"; }; DA00FC8C1D5EEB0D009AABC8 /* MGLAttributionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAttributionInfo.h; sourceTree = "<group>"; }; @@ -1530,6 +1531,7 @@ isa = PBXGroup; children = ( 4031ACFE1E9FD29F00A3EA26 /* MGLSDKTestHelpers.swift */, + CA3B1629209801A5005C087B /* MGLTestUtility.h */, ); name = "Test Helpers"; sourceTree = "<group>"; diff --git a/platform/ios/ios.xcodeproj/xcshareddata/xcschemes/CI.xcscheme b/platform/ios/ios.xcodeproj/xcshareddata/xcschemes/CI.xcscheme index 01b565d5d9..6b018e1337 100644 --- a/platform/ios/ios.xcodeproj/xcshareddata/xcschemes/CI.xcscheme +++ b/platform/ios/ios.xcodeproj/xcshareddata/xcschemes/CI.xcscheme @@ -54,7 +54,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "NO"> <Testables> <TestableReference skipped = "NO"> @@ -65,14 +65,6 @@ BlueprintName = "test" ReferencedContainer = "container:ios.xcodeproj"> </BuildableReference> - <SkippedTests> - <Test - Identifier = "MGLAnnotationViewTests/testAnnotationViewInitWithFrame"> - </Test> - <Test - Identifier = "MGLAnnotationViewTests/testSelectingADisabledAnnotationView"> - </Test> - </SkippedTests> </TestableReference> </Testables> <MacroExpansion> @@ -84,6 +76,13 @@ ReferencedContainer = "container:ios.xcodeproj"> </BuildableReference> </MacroExpansion> + <EnvironmentVariables> + <EnvironmentVariable + key = "MAPBOX_RUN_PENDING_TESTS" + value = "YES" + isEnabled = "NO"> + </EnvironmentVariable> + </EnvironmentVariables> <AdditionalOptions> </AdditionalOptions> </TestAction> diff --git a/platform/ios/ios.xcodeproj/xcshareddata/xcschemes/Integration Test Harness.xcscheme b/platform/ios/ios.xcodeproj/xcshareddata/xcschemes/Integration Test Harness.xcscheme index 1638592557..ce264aa19a 100644 --- a/platform/ios/ios.xcodeproj/xcshareddata/xcschemes/Integration Test Harness.xcscheme +++ b/platform/ios/ios.xcodeproj/xcshareddata/xcschemes/Integration Test Harness.xcscheme @@ -26,7 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "NO"> <Testables> <TestableReference skipped = "NO"> diff --git a/platform/ios/test/MGLAnnotationViewTests.m b/platform/ios/test/MGLAnnotationViewTests.m index a2cc4227ed..1ae7538b90 100644 --- a/platform/ios/test/MGLAnnotationViewTests.m +++ b/platform/ios/test/MGLAnnotationViewTests.m @@ -1,5 +1,6 @@ #import <Mapbox/Mapbox.h> #import <XCTest/XCTest.h> +#import "MGLTestUtility.h" static NSString * const MGLTestAnnotationReuseIdentifer = @"MGLTestAnnotationReuseIdentifer"; @@ -209,7 +210,7 @@ static NSString * const MGLTestAnnotationReuseIdentifer = @"MGLTestAnnotationReu XCTAssertEqual(view.dragState, MGLAnnotationViewDragStateNone); } -- (void)testAnnotationViewInitWithFrame { +MGL_PENDING_TEST(testAnnotationViewInitWithFrame) CGRect frame = CGRectMake(10.0, 10.0, 100.0, 100.0); MGLAnnotationView *view = [[MGLAnnotationView alloc] initWithFrame:frame]; [self checkDefaultPropertiesForAnnotationView:view]; @@ -220,11 +221,11 @@ static NSString * const MGLTestAnnotationReuseIdentifer = @"MGLTestAnnotationReu [self checkDefaultPropertiesForAnnotationView:view]; } -- (void)testSelectingADisabledAnnotationView { +MGL_PENDING_TEST(testSelectingADisabledAnnotationView) self.prepareAnnotationView = ^(MGLAnnotationView *view) { view.enabled = NO; }; - + // Create annotation MGLPointFeature *point = [[MGLPointFeature alloc] init]; point.title = NSStringFromSelector(_cmd); diff --git a/platform/ios/test/MGLTestUtility.h b/platform/ios/test/MGLTestUtility.h new file mode 100644 index 0000000000..9cd5227ac5 --- /dev/null +++ b/platform/ios/test/MGLTestUtility.h @@ -0,0 +1,22 @@ +#define MGL_CHECK_PENDING_TEST() \ + /* By default, skip pending tests. Otherwise check environment for MAPBOX_RUN_PENDING_TESTS */ \ + { \ + NSString *runPendingTests = [[NSProcessInfo processInfo] environment][@"MAPBOX_RUN_PENDING_TESTS"]; \ + if (![runPendingTests boolValue]) { \ + /* The following warning will be picked up by xcpretty */ \ + printf("warning: '%s' is a pending test - skipping\n", __PRETTY_FUNCTION__); \ + return; \ + } \ + } + +#define MGL_PENDING_TEST(name) \ + /* Appending `PENDING` to the method name allows xcpretty to mark the test as pending */ \ + - (void)name ## PENDING { MGL_CHECK_PENDING_TEST() + +#define MGL_ENABLED_TEST(name) \ + - (void)name { + +#define MGL_DISABLED_TEST(name) \ + - (void)DISABLED ## name { + + |