q231950 / the-stubborn-network

A Swifty and clean stubbing machine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve Stub Setup

q231950 opened this issue · comments

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.