Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP: Write initial test cases #29

Closed
1 of 8 tasks
JoaquimLey opened this issue Mar 31, 2018 · 0 comments
Closed
1 of 8 tasks

MVP: Write initial test cases #29

JoaquimLey opened this issue Mar 31, 2018 · 0 comments

Comments

@JoaquimLey
Copy link
Owner

JoaquimLey commented Mar 31, 2018

Currently, there is zero coverage.

Why

For the initial setup and basic functionally (mostly on stream), no tests were written, but the goal is to have a fully tested app. This will also enable the full power of having a CI/CD pipeline (#19).

Tasks ⚙️

  • Initial setup (dependencies and example tests running)

  • Instrumentation FavoritesFragment

  • Unit tests for FavoritesViewModel

  • Unit tests for SmsController

  • Unit tests for SmsBroadcastReceiver

  • Integration tests (UI -> ViewModel + ViewModel -> SMSController)

  • Integrate with some codecov like service for overview

    • Be sure to properly configure (ignore unwanted files to provide accurate %)

Resources and references

@JoaquimLey JoaquimLey added this to the MVP milestone Mar 31, 2018
JoaquimLey added a commit that referenced this issue Apr 7, 2018
While writting the first tests I found some hard dependency the  FavoriteViewModel had on the SmsController
it made sense to abstract this class with interface and abstract classes and move the current code to Impl classes.

This way its easier to mock and get more clearer seperation of concerns, this of course is subject to changes.

The modified classes are:
  - SmsBroadcastReceiver to SmsBroadcastReceiverImpl
  - SmsController to SmsControllerImpl
As mentioned above, the original are an abstract class and interface respectivly.

For #29
JoaquimLey added a commit that referenced this issue Apr 8, 2018
JoaquimLey added a commit that referenced this issue Apr 8, 2018
- AlertDialog shown on Fab pressed
- AlertDialog is dismissed when Discard pressed
- AlertDialog shows error when user doesn't input the required BusStop code
- AlertDialog hides error when user starts typing BusStop code

No styling on the views, just basic UI implementation.

For #29
JoaquimLey added a commit that referenced this issue Apr 8, 2018
JoaquimLey added a commit that referenced this issue Apr 13, 2018
Sms module now has a mock() variant for easier testing, this was cared to not be
possible to ship with mockRelease (check variant filtering in sms module build.gradle)

With this, I hope to get a better better abstraction hence, better enviroment for integration tests.
Notice how the main folder of the sms module keeps the interface which represents the contract to
outer layers (mobile-ui) in this case, slowly but surely this moves us closer to the onion/clean arch.

For #29
See also: #25, #38
JoaquimLey added a commit that referenced this issue Apr 13, 2018
Also created some testing related utils on the debug mobile-ui variant

#29
JoaquimLey added a commit that referenced this issue Apr 15, 2018
There's still some issues in mocking the ViewModel/ViewModelactory

#29
JoaquimLey added a commit that referenced this issue Apr 15, 2018
…gment view states

Added the javax dependency to androidTest variant

Removed the READ_PHONE_STATE since the SmsManager was still accessible
on a Android Oreo device, so this was a temporary bug, now fixed from
Google

Worked on new view states for the FavoritesFragment:
  - Error state
  - Empty state
  - Some improvements on success state

Test DI still not working, causing problems with UI unit tests (not
able to mock the ViewModel).

#29
JoaquimLey added a commit that referenced this issue Apr 15, 2018
JoaquimLey added a commit that referenced this issue Apr 16, 2018
…droid P

Still some small issues related to the newer API, but getting there

#29
JoaquimLey added a commit that referenced this issue Apr 21, 2018
There are still some issues with the Android P tests
The View/ViewObject models are still not mapped or extracted
  (the UI should not use the FavoriteView anywhere)

#29
JoaquimLey added a commit that referenced this issue Apr 22, 2018
Compile SDK was updated to android-p preview, support: 28.0.0-alpha1 and constraint to 1.1.0

#29
JoaquimLey added a commit that referenced this issue Apr 23, 2018
JoaquimLey added a commit that referenced this issue Apr 23, 2018
The user now gets a Requesting... message (might change the string)
with the ability to cancel the request, in reality this request isn't canceled

- If the sms was already sent, then we ignore the response
- The UI renables the REQUEST ETA buttons (were previously disabled)
- If an error occurs the user is notified

This should give more control to the user, if the service is unresposive.
#29
JoaquimLey added a commit that referenced this issue Apr 25, 2018
Moved all the extension functions to a separate packages to make it more
clear where stuff is.

#29
JoaquimLey added a commit that referenced this issue Apr 25, 2018
JoaquimLey added a commit that referenced this issue Apr 27, 2018
From now on, the only solution is to star creating a data source to
the ViewModel in order to properly mock data.

#29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant