UITestServer

public struct UITestServer

This is the base for the UITest Local Server and it works in conjunction with UITestResponse It’s able to provide a bridge between UITest and the main application.

UITestServer is able to mock Stateful and Stateless behaviors. By default it will be Stateless. Each response with a different endPoint pattern defines a new state chain if needed.

  • The key used by the UITestServer inside the ProcessInfo().environment.

    Declaration

    Swift

    public static let environmentKey: String
  • The compressed string for ProcessInfo().environment.

    Declaration

    Swift

    public static var environmentInfo: String { get }
  • Starts this server. As the UITestServer work as a one-way bridge between UITest target and the main application target, any changes to the responses from the UITest target will not take effect until the next application relaunch.

    Declaration

    Swift

    public static func start(defaultResponse: StubResponse = StubResponse().withStatusCode(200))

    Parameters

    defaultResponse

    Defines the default response in cases an endPoint is hit and no response is provided. By default it’s an empty response with 200 HTTP status.

  • Stops the server temporarily and keeps all its current responses and states.

    Declaration

    Swift

    public static func stop()
  • Resets all the current responses and state chain inside this server.

    Declaration

    Swift

    public static func resetAll()