IntegrationTestIosTest.m 1.45 KB
Newer Older
1 2 3 4 5
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "IntegrationTestIosTest.h"
6

7
#import "IntegrationTestPlugin.h"
8
#import "FLTIntegrationTestRunner.h"
9

10
#pragma mark - Deprecated
11

12 13
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
14

15
@implementation IntegrationTestIosTest
16 17 18

- (BOOL)testIntegrationTest:(NSString **)testResult {
  NSLog(@"==================== Test Results =====================");
19 20 21 22 23 24 25
  NSMutableArray<NSString *> *failedTests = [NSMutableArray array];
  NSMutableArray<NSString *> *testNames = [NSMutableArray array];
  [[FLTIntegrationTestRunner new] testIntegrationTestWithResults:^(SEL testSelector, BOOL success, NSString *message) {
    NSString *testName = NSStringFromSelector(testSelector);
    [testNames addObject:testName];
    if (success) {
      NSLog(@"%@ passed.", testName);
26
    } else {
27 28
      NSLog(@"%@ failed: %@", testName, message);
      [failedTests addObject:testName];
29
    }
30
  }];
31 32
  NSLog(@"================== Test Results End ====================");
  BOOL testPass = failedTests.count == 0;
33
  if (!testPass && testResult != NULL) {
34 35
    *testResult =
        [NSString stringWithFormat:@"Detected failed integration test(s) %@ among %@",
36
                                   failedTests.description, testNames.description];
37 38 39 40 41
  }
  return testPass;
}

@end
42
#pragma clang diagnostic pop