Hilt makes testing easier on Android

Поділитися
Вставка
  • Опубліковано 19 лип 2020
  • The best android courses in the world: codingwithmitch.com/
    Watch the HILT course here (FREE): codingwithmitch.com/courses/h...
    Everything you need to know about writing android instrumentation tests if you using Hilt for dependency injection.
    Code: github.com/mitchtabian/Dagger...
    Instagram: / codingwithmitch
    Twitter: / mitch_tabian
    .
    .
    #AndroidDev
  • Наука та технологія

КОМЕНТАРІ • 48

  • @codinginflow
    @codinginflow 3 роки тому +25

    Thank you for this video

    • @codingwithmitch
      @codingwithmitch  3 роки тому +11

      You're welcome. Always nice to be appreciated by my fans

    • @deepak5283
      @deepak5283 3 роки тому

      @@codingwithmitch how to add voice message feature for chat app in andriod by using java .any api or packages available for the process pls tell me

  • @rajiac7552
    @rajiac7552 2 роки тому +3

    Mitch, you are the best teacher I ever had, I was scratching my head over this launchFragmentInHiltContainer ,and finally landed in your video now it is pretty clear. big thanks

  • @pejmanazad5852
    @pejmanazad5852 3 роки тому +13

    before each person watches the video says in mind, Ohh sexy shirt.

  • @renatoarg
    @renatoarg 3 роки тому +1

    hi @CodingWithMitch congrats for the great video. Please do you have any example testing UIs?

  • @grooss4002
    @grooss4002 3 роки тому +1

    Thanks, very helpful video! Is there a way to mock a ViewModel in a fragment test or how should i test it?

  • @mehdiparsaei1867
    @mehdiparsaei1867 3 роки тому

    Thanks a lot, my teacher!
    I could get the MainFragment without a factory.

  • @Mandoo145
    @Mandoo145 2 роки тому

    Thanks, you are a lifesaver!

  • @genesiscatano
    @genesiscatano 2 роки тому +1

    24:18 "android:exported" is required to be included in everywhere you use "intent-filter" after the SDK version 31. If you want your app to share intents from one specific class you should make it true, if not then false.

  • @Vemu
    @Vemu 3 роки тому +1

    Can you make a video about package installer? No one has done video about that yet

  • @David-xy4nw
    @David-xy4nw 3 роки тому +2

    even though I do not know anything about the android development, I still watch your videos, because I really enjoy the way you explain things. Would be really cool if you could make a react-native course

    • @codingwithmitch
      @codingwithmitch  3 роки тому +2

      Maybe in the future who knows. I think react native is a better choice than flutter personally because JavaScript jobs are so easy to come by. It gives you more employment options

    • @deepak5283
      @deepak5283 3 роки тому

      @@codingwithmitch how to add voice message feature for chat app in andriod studio .what is procedure or process and is there any api or packages to available to add voice message features

    • @ganeshrajpadhayay3714
      @ganeshrajpadhayay3714 3 роки тому

      What a lovely comment :P :)

    • @LunarCosmic
      @LunarCosmic 3 роки тому

      I gave up with React Native environment 😅 still love native

    • @abelmengesha3773
      @abelmengesha3773 Рік тому

      @@codingwithmitch Fact! I still wonder why Javascript jobs are so easy to come by?

  • @dreewr
    @dreewr 3 роки тому

    Is it production ready or should I wait a little bit more?

  • @AhmadShahwaiz
    @AhmadShahwaiz 2 роки тому

    can you do a tutorial retrofit + hiltandroidtest

  • @abhijithkp7381
    @abhijithkp7381 3 роки тому +2

    Tks for #Hilt 👍

  • @ALIRAZA-hz1db
    @ALIRAZA-hz1db 3 роки тому

    Hii hope you are doing well. I saw your old video on caching with retrofit. I have a question that how we can load data from cache first then from network if the Internet is available.

    • @codingwithmitch
      @codingwithmitch  3 роки тому

      Watch my db caching course or powerful Android apps codingwithmitch.com/courses/powerful-android-apps-with-jetpack-architecture/

  • @oscarperry641
    @oscarperry641 3 роки тому +2

    sharp guy

  • @toto3451
    @toto3451 3 роки тому +2

    God bless you

  • @mattgraves3709
    @mattgraves3709 3 роки тому +1

    Well, I wasted a bunch of time trying to get this to work for my unit tests yesterday guess I should have seen this video!
    hahaha oh well.
    Thank man

  • @sfk1991
    @sfk1991 3 роки тому

    Hey Mitch , for someone who just have started about dependency injection do you recommend I pick up hilt over plain dagger?

    • @codingwithmitch
      @codingwithmitch  3 роки тому +3

      Yeah its way easier. Dagger is good to know but learning curve is rough

    • @codinginflow
      @codinginflow 3 роки тому +7

      Normal Dagger is only for people with 200 IQ

    • @sfk1991
      @sfk1991 3 роки тому +2

      @@codinginflow Having followed your great tutorial on dagger a couple months ago I laughed harder than I should on this comment.

  • @jagadeeshtummalacharla7163
    @jagadeeshtummalacharla7163 2 роки тому

    Hi Mitch, how can we launch the app using hiltAndroidTest approach? My app will starts from splachActivity and i would need to launch the app from splash activity.!

  • @AhsanAli-vz6mg
    @AhsanAli-vz6mg 3 роки тому

    Superb

  • @deepak5283
    @deepak5283 3 роки тому

    how to add voice message feature for chat app in andriod by using java .any api or packages available for the process pls tell me sir

  • @bangmind7318
    @bangmind7318 3 роки тому

    help me pls
    i get error
    java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.codingwithmitch.daggerhiltplayground/.HiltTestActivity (has extras) }

  • @beshoyfakhry936
    @beshoyfakhry936 3 роки тому

    Please check certificate of web site as it shows it's expired and chrome makes it unsafe to use your website.

  • @astrologykhan8125
    @astrologykhan8125 3 роки тому

    What do u want???

  • @wasimreza9910
    @wasimreza9910 3 роки тому

    Thanks for the video. I am getting the following exception while running the main fragment test of your code. I have tried with commitAllowingStateLoss() but failed. Can you help me anyway?
    java.lang.RuntimeException: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at androidx.test.runner.MonitoringInstrumentation.runOnMainSync(MonitoringInstrumentation.java:441)
    at androidx.test.core.app.ActivityScenario.onActivity(ActivityScenario.java:564)
    at com.codingwithmitch.daggerhiltplayground.MainTest.mainFragmentTest(MainTest.kt:120)
    at java.lang.reflect.Method.invoke(Native Method)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
    at dagger.hilt.android.internal.testing.MarkThatRulesRanRule$1.evaluate(MarkThatRulesRanRule.java:92)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:392)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2106)
    Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1766)
    at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1806)
    at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:324)
    at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:289)
    at com.codingwithmitch.daggerhiltplayground.MainTest$mainFragmentTest$$inlined$launchFragmentInHiltContainer$1.perform(HiltExt.kt:72)
    at com.codingwithmitch.daggerhiltplayground.MainTest$mainFragmentTest$$inlined$launchFragmentInHiltContainer$1.perform(Unknown Source:2)
    at androidx.test.core.app.ActivityScenario.lambda$onActivity$2$ActivityScenario(ActivityScenario.java:551)
    at androidx.test.core.app.ActivityScenario$$Lambda$4.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2124)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6944)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

    • @wasimreza9910
      @wasimreza9910 3 роки тому

      PC restart solves the problem. Thanks.

  • @bryanneuberger5886
    @bryanneuberger5886 3 роки тому

    engagement

  • @wajdidaghlas3178
    @wajdidaghlas3178 3 роки тому

    How are you 🥰

  • @mehdiparsaei1867
    @mehdiparsaei1867 3 роки тому

    Why don't we do a full UI test instead of Unit and Integration tests?
    I mean by ignoring the UI test time, UI tests can test everything in the real world.
    Who agrees with me?

  • @buzzminkyunghoon3856
    @buzzminkyunghoon3856 3 роки тому +1

    That one fkn dislike