I have tests that interact with the keychain in iOS, which fails on Bitrise and succeeds locally.
I’m using the simulator when testing locally.
It’s only these tests that fail, that was recently added (note, it’s the unit-tests for library so I’ve added a simple hosting application for it to run locally, that thats a part of the projects, so…)
Please make sure that you have the Deploy to Bitrise.io step after the Xcode Test step in the workflow, that should attach the full/raw, unfiltered Xcode log to the build (top of the build page, Apps & Artifacts).
Another thing: did you try to Reset the iOS Simulator on your Mac and then running the tests again? It’s quite a common source of these “works locally but not on bitrise.io” issues that the app behaves a bit differently at the first run, e.g. it presents a popup which only have to be accepted once (at the first run, then it’s stored in user defaults).
I don’t deploy to bitrise.io since it’s a library
The tests success locally even after resetting the simulator
More exact error:
/Users/vagrant/git/../..Tests.swift:11: error: -[..Tests.KeychainTests testErase] : XCTAssertTrue failed -
Nothing was retrieved from the keychain. Status: The operation couldn’t be completed. (swift.keychain.error error -25300.): -25300
The Deploy to Bitrise.io step can be used for attaching any artifact to the build, most of our steps share additional / debug logs which can help with debugging issues, and are stored in the $BITRISE_DEPLOY_DIR which is the default dir deployed by Deploy to Bitrise.io.
Hmm… That’s strange. Did you run the tests in the same iOS Simulator / iOS version?
It seems the error code 25300 is simply that the item does not exist in the keychain. A possible debug idea:
-25300 is errSecItemNotFound, which is a pretty standard keychain error. To debug this, my recommendation is that, when it occurs, you dump out the contents of your keychain to verify that things are in the state that you expect them to be in.