unit testing - Advice on BDD for iOS needed -
inspired this issue on objc.io decided try out bdd on new project. here problem: want test mycredentialstorage
somehow persists credentials ask store, namely next time app launched same credential. mycredentialstorage
uses keychain, mock , verify secitemadd
or secitemupdate
functions called, not supposed test (or know of) mycredentialstorage
’s private methods, right?
i’m sure i’m not 1 faced problem, i’m asking advice since i’m new bdd. thank in advance.
from comments
michał ciuba wrote:
take @ article same objc.io issue - dependency injection: objc.io/issue-15/dependency-injection.html. can inject mock of keychain mycredentialstorage (but maybe you'll need create wrapper secitem* methods).
ben flynn wrote:
i agree @michałciuba - there's no generic way express item persist between executions of app. if you're going di route, i'd says. if aren't doing di, wouldn't shy mocking keychain storage or private methods. i'd explicit in naming of test express expectations are.
Comments
Post a Comment