Inspired by this issue on objc.io I decided to try out BDD on my new project. Here is my problem: I want to test that MYCredentialStorage somehow persists credentials I ask it to store, namely that next time app is launched I would get the very same credential. MYCredentialStorage uses keychain, so I could mock it and verify that SecItemAdd or SecItemUpdate functions are called, but I am not supposed to test (or know of) MYCredentialStorage’s private methods, right?
I’m sure I’m not the only one faced this problem, so I’m asking for your advice since I’m very new to BDD.
Thank you in advance.
Advice on BDD for iOS needed
158 views Asked by dariaa At
1
There are 1 answers
Related Questions in IOS
- URLSession requesting JSON array from server not working
- Incorrect display of LinearGradientBrush in IOS
- Module not found when building flutter app for IOS
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- Expo Deep linking on iOS is not working (because of Google sign-in?)
- On iOS, the keyboard does not offer a 6-character SMS code
- Hi, there is an error happened when I build my flutter app, after I'm installing firebase packages occurs that error
- The copy/paste functionalities don't work only on iOS in the Flutter app
- Hide LiveActivityIntent Button from Shortcuts App
- While Running Github Actions Pipeline: No Signing Certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID
- Actionable notification api call not working in background
- Accessibility : Full keyboard access with scroll view in swiftui
- There is a problem with the request entity - You are not allowed to create 'iOS' profile with App ID 'XXXX'
- I am getting "binding has not yet been initialized" error when trying to connect firebase with flutter
Related Questions in UNIT-TESTING
- Google Truth.assertThat.contains does not behave similar to List.contains
- What's the best way to breakup a large test in pytest
- How to refer to the filepath of test data in test sourcecode?
- How to mock a dynamic endpoint in Apache Camel Spring Boot
- pytest mock failing when mocking function from imported package
- Jest configuration error while running test case in teamcity
- Resolve paths dynamically based on directory where test (or tested files) is located in Jest
- One-time implementation with Jest's mockResolvedValueOnce within test remains from one test to another
- Why can't I mock the decorator of the function?
- Gitlab pipeline stuck with nx cloud issue
- How to create an improperly closed gzip file using python?
- Nest.js service structure for API integration
- uiState not updating in Tests
- Unit Tests not Compiling or Being found without mod tests in main.rs. Is this a requirement or am I missing some configuration?
- Mocking Stream or Reader in Java Junit
Related Questions in BDD
- Specflow defination not showing references
- Issue with pytest-bdd execution after python and pytest-bdd version upgrade
- Cucumber API for listing/run features/scenarios/tags
- Bean Creation Failing in Spring Boot Application
- Autopopulate existing specflow steps
- Cucumber, TypeScript, Error: No tests found when running without examples
- How to run specific scenario from a feature file without changing the path of feature file in cukesfeaturefile?
- Load data from yaml using dedicated class in pytest-bdd in step file(@given, @when, @then)
- How to check Null Values in JSON Rest Assured
- How to implement test timeout for playwright in a BDD Cucumber framework written in Typescript?
- How to get the step name description using pytest-bdd?
- Unexpected step line values in cucumber report generated by Godog for scenario outlines
- Karate - Accessing certain value in an array element using a 'retry until' statement
- How can I to go to step definition file in VS Code using cypress and BDD
- Aloe "Examples" table not working for python 3.12
Related Questions in XCTEST
- Testing for ODR image resources in main bundle
- How to check that test throws exception in app using Xcode UITest
- xctest iOS UI test - tapping link not working
- Xcode compile error "Expected a type" shows only when running tests
- Running Swift Package unit tests in release configuration: @testable module was not compiled for testing
- Using setUp to run object creation once before all tests
- Error: No such module 'XCTest' when building iOS project
- xcresults tool is not able to export screenshots for failure cases ( xcresults-1.17.1 )
- Xcode Performance Test always reports "updated baseline value"
- XCTest/Swift Automation: How can I determine if an app is present before testing?
- Unrecognized selector in XCTest test
- Custom Launch Metric Not Reporting Expected Results
- Where are my app's traces/logging when running XCTest?
- How to run shell commands in terminal during iOS XCTest
- Is there a way to skip Swift XCTestCase for the whole class
Related Questions in OCMOCK
- Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_OCMArg"
- [OCMock]A question about the andDo function
- [OCMock][OCMProtocolMock][OCMStub]When I OCMProtocolMock a protocol(This protocol has a method),How can I invoke the real implementation of the method
- [OCMock][OCMVerify]Why does OCMVerify still pass when I don’t call a method?
- OCMVerify crashes test after a mocked callback
- Did not record an invocation in OCMStub/OCMExpect/OCMReject
- Test if a function is called in Unit Testing for Objective C
- In Objective-C, how can I make a typedef for a composed object?
- 'OCMock/OCMockObject.h' file not found
- Proper usage of OCMock with Singleton
- How to mock a C++ function in Objective C testing
- OCMock test if method does nothing but is called
- How can I get a nested objective-c async method to execute under test using mocks and expectations?
- OCMock/OCMVerify - Expression result unused
- OCMock for dispatch_async without callback
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
From the comments
Michał Ciuba wrote:
Take a look at another article from the same objc.io issue - dependency injection: objc.io/issue-15/dependency-injection.html. Basically you can inject a mock of keychain into MYCredentialStorage (but maybe you'll need to create a wrapper for SecItem* methods).
Ben Flynn wrote:
I agree with @MichałCiuba - there's no generic way to express that an item will persist between executions of your app. If you're going the DI route, I'd do what he says. If you aren't doing DI, I wouldn't be shy about mocking the keychain storage or your private methods. I'd be explicit in the naming of the test to express exactly what the expectations are.