q231950 / the-stubborn-network

A Swifty and clean stubbing machine.
MIT License
7 stars 3 forks source link

Improve Stub Setup #32

Open q231950 opened 5 years ago

q231950 commented 5 years ago

Currently it is a bit cumbersome to setup each test class to stub its requests:

override func setUp() {
        app = XCUIApplication()

        let processInfo = ProcessInfo()
        app.launchEnvironment["STUB_PATH"] = "\(processInfo.environment["PROJECT_DIR"] ?? "")/stubs"
        app.launchEnvironment["THE_STUBBORN_NETWORK_UI_TESTING"] = "YES"
        app.launchEnvironment["STUB_NAME"] = self.name

        app.launch()
    }

This could be easier with a test observer and the test target's principal class.