A coding challenge from @Nimble. Show best practices on unit testing, architecture, modularization
- clone project
- cd
SurveyiOSApplication/SurveyiOSApplication/
- run
pod install
- open
SurveyiOSApplication.xcworkspace
- login with the development account:
account: [email protected]
password: 12345678
SurveyFramework
framework on an iOS target you'll see two tests test_load_returnsSavedToken
and test_load_returnsLastSavedToken
fails due to testing Keychain requires a host application. You can make it pass by either:
- Create a host iOS application and run the tests on it.
- Run the tests on macOS target.
- Contains business logic.
- platform-agnostic. Can run on any platforms (iOS, macOS, iPadOS, tvOS, WatchOS).
- Total
32
test cases. - Coverage:
93,7%
. - Total run time:
0.456
seconds.
- Contains UI+Representation Layer.
- Contains compositions.
- Platform-specific (iOS).
- Total
69
test cases. - Coverage:
81,3%
. - Total run time:
0.8
seconds.
✅ Log in.
✅ Log out.
✅ Load surveys.
✅ Pull to refresh (swipe to left) surveys.
✅ Refresh token automatically.
- URL
- grant_type
- username
- password
- client_id
- clent_secret
- Execute "login" command with above data.
- System creates request with above data.
- System sends created request to the backend.
- System validates response data.
- System creatse token.
- System delivers token.
- System delivers connectivity error.
- System delivers invalid data error.
- Execute "load token from cache" command with above data.
- System fetches data from the cache.
- System validates fetched data.
- System delivers cached token.
- System delivers error.
- System delivers error.
- Execute "cache token" command with above data.
- System deletes old cache.
- System encodes token.
- System save new cache data.
- System delivers success message.
- System delivers error.
- System delivers error.
- URL
- page number
- page size
- Execute "load surveys from remote" command with above data.
- System creates request with above data.
- System sends created request to the backend.
- System validates response data.
- System creates servey items from validated data.
- System delivers a list of servey items.
- System delivers connectivity error.
- System delivers invalid data error.
- URL
- grant_type
- refresh_token
- client_id
- clent_secret
- Execute "load token from remote" command with above data.
- System creates request with above data.
- System sends created request to the backend.
- System validates response data.
- System creatse token.
- System delivers token.
- System delivers connectivity error.
- System delivers invalid data error.
- Execute "logout" command with above data.
- System clears the cache.
- System delivers success message.