summaryrefslogtreecommitdiff
path: root/render-test/ios/tests/Tests.m
blob: 5dd52a7fa30e54998a69224706a445ef1fb3a1a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import <XCTest/XCTest.h>
#import "iosTestRunner.h"
@interface Tests : XCTestCase

@end

@implementation Tests

- (void)setUp {
    [super setUp];
}

- (void)tearDown {
    [super tearDown];
}

- (void)testStartRenderTestRunner {
    IosTestRunner* runner = [[IosTestRunner alloc] init]; 
    XCTAssert(runner, @"IOSTestRunner is not initialized correctly");
    
    NSString* result = [runner getResultPath];
    XCTAssert(result, @"IOSTestRunner does not produce a result file");

    NSFileManager *fileManager = [NSFileManager defaultManager];
    BOOL fileFound = [fileManager fileExistsAtPath: result];
    XCTAssert(fileFound, @"Test result html '%@' doese not exit", result);

    NSURL *url = [NSURL fileURLWithPath:result]; 
    XCTAttachment *attachmentURL = [XCTAttachment attachmentWithContentsOfFileAtURL: url];
    XCTAssert(attachmentURL, @"Failed to attach test result '%@'", result);
    attachmentURL.lifetime = XCTAttachmentLifetimeKeepAlways;
    [self addAttachment:attachmentURL];

    BOOL success = [runner getTestStatus];
    XCTAssert(success, @"IOSTestRunner reports error because some of the tests are not passed, please check the test report");
}

@end