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 4 ปีที่แล้ว +25

    Thank you for this video

    • @codingwithmitch
      @codingwithmitch  4 ปีที่แล้ว +11

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

    • @deepak5283
      @deepak5283 4 ปีที่แล้ว

      @@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

  • @pejmanazad5852
    @pejmanazad5852 4 ปีที่แล้ว +13

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

  • @rajiac7552
    @rajiac7552 3 ปีที่แล้ว +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

  • @Mandoo145
    @Mandoo145 2 ปีที่แล้ว

    Thanks, you are a lifesaver!

  • @mehdiparsaei1867
    @mehdiparsaei1867 3 ปีที่แล้ว

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

  • @renatoarg
    @renatoarg 3 ปีที่แล้ว +1

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

  • @grooss4002
    @grooss4002 4 ปีที่แล้ว +1

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

  • @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

  • @oscarperry641
    @oscarperry641 4 ปีที่แล้ว +2

    sharp guy

  • @dreewr
    @dreewr 4 ปีที่แล้ว

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

  • @Vemu
    @Vemu 4 ปีที่แล้ว +1

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

  • @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.

  • @David-xy4nw
    @David-xy4nw 4 ปีที่แล้ว +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  4 ปีที่แล้ว +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 4 ปีที่แล้ว

      @@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 4 ปีที่แล้ว

      What a lovely comment :P :)

    • @LunarCosmic
      @LunarCosmic 3 ปีที่แล้ว

      I gave up with React Native environment 😅 still love native

    • @abelmengesha3773
      @abelmengesha3773 2 ปีที่แล้ว

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

  • @abhijithkp7381
    @abhijithkp7381 4 ปีที่แล้ว +2

    Tks for #Hilt 👍

  • @AhsanAli-vz6mg
    @AhsanAli-vz6mg 3 ปีที่แล้ว

    Superb

  • @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.!

  • @toto3451
    @toto3451 4 ปีที่แล้ว +2

    God bless you

  • @ALIRAZA-hz1db
    @ALIRAZA-hz1db 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

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

  • @sfk1991
    @sfk1991 4 ปีที่แล้ว

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

    • @codingwithmitch
      @codingwithmitch  4 ปีที่แล้ว +3

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

    • @codinginflow
      @codinginflow 4 ปีที่แล้ว +7

      Normal Dagger is only for people with 200 IQ

    • @sfk1991
      @sfk1991 4 ปีที่แล้ว +2

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

  • @bangmind7318
    @bangmind7318 4 ปีที่แล้ว

    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) }

  • @deepak5283
    @deepak5283 4 ปีที่แล้ว

    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

    • @perfergonchsiardov695
      @perfergonchsiardov695 4 ปีที่แล้ว

      developer.android.com/reference/android/speech/tts/TextToSpeech

  • @AhmadShahwaiz
    @AhmadShahwaiz 2 ปีที่แล้ว

    can you do a tutorial retrofit + hiltandroidtest

  • @beshoyfakhry936
    @beshoyfakhry936 4 ปีที่แล้ว

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

  • @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.

  • @astrologykhan8125
    @astrologykhan8125 4 ปีที่แล้ว

    What do u want???

  • @bryanneuberger5886
    @bryanneuberger5886 3 ปีที่แล้ว

    engagement

  • @wajdidaghlas3178
    @wajdidaghlas3178 4 ปีที่แล้ว

    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 4 ปีที่แล้ว +1

    That one fkn dislike