AliSoftware / OHHTTPStubs

Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
MIT License
5.03k stars 602 forks source link

Crash when running UITests on Real Device #371

Open mrunal-thanki opened 2 months ago

mrunal-thanki commented 2 months ago

New Issue Checklist

Environment

When I'm running UITests on simulator, it's working fine and executing all the tests. But when tried running on device its causing issue for file access for stub files(mock json files).

Complete output when you encounter the issue (if any)
*** Assertion failure in -[HTTPStubsResponse initWithFileURL:statusCode:headers:], HTTPStubsResponse.m:176
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[HTTPStubsResponse initWithFileURL:statusCode:headers:] Couldn't get the file size for URL. The URL was: file:///var/containers/Bundle/Application/A8FBF3B7-0F52-4E8B-AE8E-D93A907B34B7/InstallUITests-Runner.app/PlugIns/InstallUITests.xctest/get_jwk_success.json. The operation to retrieve the file size was unsuccessful. The error associated with that operation was: Error Domain=NSCocoaErrorDomain Code=257 "The file “get_jwk_success.json” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///var/containers/Bundle/Application/A8FBF3B7-0F52-4E8B-AE8E-D93A907B34B7/InstallUITests-Runner.app/PlugIns/InstallUITests.xctest/get_jwk_success.json, NSFilePath=/var/containers/Bundle/Application/A8FBF3B7-0F52-4E8B-AE8E-D93A907B34B7/InstallUITests-Runner.app/PlugIns/InstallUITests.xctest/get_jwk_success.json, NSUnderlyingError=0x3010233c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}'
*** First throw call stack:
(0x19b7d6b28 0x193632f78 0x19ac3b920 0x103111a08 0x1031115f0 0x100fdf428 0x100fdcc9c 0x100fdcc24 0x103112b30 0x10310e2f4 0x19c833878 0x1a35e6dd4 0x1a35ea86c 0x19ca7bab0 0x19b70eb34 0x19ca7b9a0 0x19ca7e084 0x19b72162c 0x19b7208a8 0x19b71f058 0x19b71dd88 0x19b71d968 0x19ca7cc48 0x19a61da9c 0x1f76cda90 0x1f76ccfcc)
libc++abi: terminating due to uncaught exception of type NSException