testing xcode

Page Object Model

Table of contents

  1. Run test on different devices

Run test on different devices

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// File: TestCaseExtensions >  BaseTestCase.swift

import XCTest

class BaseTestCase: XCTestCase {
    override func setUp() {
        super.setUp()
        
        continueAfterFailure = false
    }

    override func tearDown() {
        super.tearDown()
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// File: Classes > BaseConfiguration > BaseConfiguration.swift

import Foundation
import XCTest

class BaseConfiguration {
    let app: XCUIApplication
    let testCase: BaseTestCase

    init(testCase: BaseTestCase) {
        app           = testCase.app
        self.testCase = testCase
    }
}

1
2
3
4
5
6
7
8
9
10
11
// File: Classes > AppConfiguration > AppConfiguration.swift

import Foundation
import XCTest

class AppConfiguration: BaseConfiguration {
    override init(testCase: SKKTestCase) {
        super.init(testCase: testCase)
    }
}

1
2
3
4
5
6
7
8
9
10
11
// File: TestCaseExtensions >  BaseTestCase.swift

import XCTest

class BaseTestCase: XCTestCase {
...
    lazy var appConfiguration: AppConfiguration = { [unowned self] in
        return AppConfiguration(testCase: self)
        }()
}