diff options
author | Juha Alanen <juha.alanen@mapbox.com> | 2020-01-31 11:52:12 +0200 |
---|---|---|
committer | Juha Alanen <juha.alanen@mapbox.com> | 2020-02-14 12:01:52 +0200 |
commit | 632c5f9d4c42a6e408c0565e34b2d1bd428ff018 (patch) | |
tree | ed2dc719f1a0e7077508c4f9b228abf77d61d6ce /test/ios/tests | |
parent | a4c4de28285a5abe1343fe5abf718adad2b9d354 (diff) | |
download | qtlocation-mapboxgl-632c5f9d4c42a6e408c0565e34b2d1bd428ff018.tar.gz |
[test] Add iOS unit test runner
Diffstat (limited to 'test/ios/tests')
-rw-r--r-- | test/ios/tests/Info.plist | 22 | ||||
-rw-r--r-- | test/ios/tests/Tests.m | 37 |
2 files changed, 59 insertions, 0 deletions
diff --git a/test/ios/tests/Info.plist b/test/ios/tests/Info.plist new file mode 100644 index 0000000000..ba6b34e5b6 --- /dev/null +++ b/test/ios/tests/Info.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>UnitTestsAppTests</string> + <key>CFBundleIdentifier</key> + <string>com.mapbox.UnitTestsAppTests</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>1.0</string> + <key>CFBundleName</key> + <string>UnitTestsAppTests</string> + <key>CFBundlePackageType</key> + <string>BNDL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/test/ios/tests/Tests.m b/test/ios/tests/Tests.m new file mode 100644 index 0000000000..4c2131d61c --- /dev/null +++ b/test/ios/tests/Tests.m @@ -0,0 +1,37 @@ +#import <XCTest/XCTest.h> +#import "iosTestRunner.h" +@interface Tests : XCTestCase + +@end + +@implementation Tests + +- (void)setUp { + [super setUp]; +} + +- (void)tearDown { + [super tearDown]; +} + +- (void)testStartUnitTestRunner { + IosTestRunner* runner = [[IosTestRunner alloc] init]; + XCTAssert(runner, @"IOSTestRunner is not initialized correctly"); + + NSString* testResult = [runner getResultPath]; + XCTAssert(testResult, @"IOSTestRunner did not produce a test result file"); + + NSFileManager *fileManager = [NSFileManager defaultManager]; + BOOL fileFound = [fileManager fileExistsAtPath: testResult]; + XCTAssert(fileFound, @"Test result file '%@' does not exit", testResult); + NSURL *resultURL = [NSURL fileURLWithPath:testResult]; + XCTAttachment *attachment1URL = [XCTAttachment attachmentWithContentsOfFileAtURL: resultURL]; + XCTAssert(attachment1URL, @"Failed to attach test result '%@'", testResult); + attachment1URL.lifetime = XCTAttachmentLifetimeKeepAlways; + [self addAttachment:attachment1URL]; + + BOOL success = [runner getTestStatus]; + XCTAssert(success, @"IOSTestRunner reports error because some of the tests are not passed, please check the test report"); +} + +@end |