Giter Club home page Giter Club logo

Comments (6)

shobhitagarwal1612 avatar shobhitagarwal1612 commented on August 20, 2024 1

Sounds good to refactor the code first. I thought you were referring to adding tests for the view model explicitly, which we shouldn't do if possible.

from ground-android.

anandwana001 avatar anandwana001 commented on August 20, 2024

Also, as the current usage of AbstractTaskViewModel is a bit big, I think we should create a separate issue for fixing the AbstractTaskViewModel.

WDYT?

from ground-android.

shobhitagarwal1612 avatar shobhitagarwal1612 commented on August 20, 2024

For the other tasks, we added tests for the task fragment which takes care of hilt dependencies automatically including the view model. This also provides coverage for what the user sees rather than testing the VM separately. Can you please check if we can do the same for CaptureLocationTask as well?

from ground-android.

anandwana001 avatar anandwana001 commented on August 20, 2024

Let me rephrase,
Screenshot 2024-06-26 at 15 08 07

Not sure I get it, but what I meant earlier is that we are passing the Resources object in the ViewModel, which is not a good practice and making our ViewModel dependent on the Android library.

So, we should separate the resource out of ViewModel and then go for writing correct test cases.

from ground-android.

anandwana001 avatar anandwana001 commented on August 20, 2024

Sounds good to refactor the code first. I thought you were referring to adding tests for the view model explicitly, which we shouldn't do if possible.

ok, great, for refactoring, I will create a separate issue.

Regarding testing viewModel, aren't we testing it separately? So, we are doing only UI tests for fragments and based on that we are confirming the viewModel is also tested, right? or did I missed anything?

from ground-android.

shobhitagarwal1612 avatar shobhitagarwal1612 commented on August 20, 2024

Regarding testing viewModel, aren't we testing it separately? So, we are doing only UI tests for fragments and based on that we are confirming the viewModel is also tested, right? or did I missed anything?

That's correct. The rationale is that this ensures that we have enough coverage for the fragment as well instead of having duplicate tests for UI and ViewModel

from ground-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.