Mocking multiple endpoints on the app launch with various JSONs
bartzet opened this issue · comments
Hi.
On the app launch, our application is making multiple calls to various endpoints. We would like to have a set of default mock responses that load the
I successfully managed to achieve it mocking one response with one JSON
app.launchTunnel(withOptions: [SBTUITunneledApplicationLaunchOptionResetFilesystem]) { [weak self] in
let base_url = "http://0.0.0.0:9292"
let path = "/versions"
let complete_url = base_url + path
let method = "GET"
let status_code = 200
let requestMatch = SBTRequestMatch(url: complete_url, method: method)
let response = SBTStubResponse(fileNamed: "valid_versions.json", returnCode: status_code
}
But I need to do it for more than one. Is this achievable with SBTUITestTunnel? I'd appreciate the support on that.
SBTRequestMatch supports regular expressions which should allow to match more than one request. See docs https://github.com/Subito-it/SBTUITestTunnel/blob/master/Documentation/Usage.md#sbtrequestmatch