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

Start Writing Tests #138

Open
AdamMc331 opened this issue Jan 19, 2019 · 9 comments
Open

Start Writing Tests #138

AdamMc331 opened this issue Jan 19, 2019 · 9 comments

Comments

@AdamMc331
Copy link
Collaborator

Creating a broad ticket to write some tests for our existing functionality. Haven't begun to dug into this so I'm not sure what will happen yet, but this is to track progress.

@CCorrado
Copy link
Collaborator

If you guys aren't opposed, for the user profile/registration stuff I am inclined to write some tests :) I have been into MVP patterns + JUnit + Mockito lately at work, but whatever you guys decide here I'll follow along!

@AdamMc331
Copy link
Collaborator Author

I'm sure Giorgio would appreciate the help! I was going to start by combing through the non UI files first and getting in some basic JUnit tests where I can, and take note of anywhere that can be refactored.

I can defer to you on the login related files for now. :)

AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Jan 26, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Jan 26, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Jan 26, 2019
@imGurpreetSK
Copy link

Hi. Can I help with this issue?

AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Jan 27, 2019
@AdamMc331
Copy link
Collaborator Author

Sure! Any help is appreciated, we don't have a lot of test coverage yet. Feel free to see #140 for what we have now.

The tests are mostly for data classes. I looked inside the views package and saw that a lot of it seemed pretty tightly coupled together. It's hard to write unit tests for fragment classes. So I would move forward with a couple options:

  1. We consider some UI testing and see if we can mock the data layer somehow
  2. We look for opportunities to move things out of the fragments into a ViewModel class, and write unit tests around the view models.

Personally, I like the second option, but that might be tricky. If we want to do that, I think we can divide the work by package. Example: I could take the detail package and refactor/test the AgendaDetailFragment and SpeakerDetailFragment.

Does this seem like a good way to split work?

AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Jan 29, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Jan 30, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Jan 31, 2019
@imGurpreetSK
Copy link

Sorry for the late reply. I would actually like to go with the second approach as it would allow better testability and extensibility in the future. We can use MVVM/MVI to structure the code.
Can you tell me whether the speaker module is a good starting point for the same?

@kenyee
Copy link
Collaborator

kenyee commented Feb 2, 2019

Speaker module would be good as well.
There wasn't time to do this properly the last two years FYI...it was just "get it working"...usually 2-3 weeks before the event so it was maybe two weekends of work :-)

@AdamMc331
Copy link
Collaborator Author

Haha no worries, we've all been there. Happy to help refactor it now. :)

@imGurpreetSK
Copy link

Have refactored the speaker module using architecture components. Yet to write tests (facing some difficulties with testing along firebase dependencies). Help/reviews welcome https://github.com/GurpreetSK95/conference-app-android/tree/gs/speakers-refactor

@AdamMc331
Copy link
Collaborator Author

What part about testing with firebase? I did some firebase mocking in my branch that's up for PR. Maybe once it's merged you'll have some inspiration? I learned how to mock firebase database calls like this: https://stackoverflow.com/a/43227989/3131147

AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
AdamMc331 added a commit to AdamMc331/conference-app-android that referenced this issue Feb 2, 2019
@n8ebel n8ebel added this to the Beta milestone Mar 2, 2019
@n8ebel n8ebel removed this from the Beta milestone Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants