Phillipp, you decided to destroy me. I don't do almost anything but watch your videos. I absolutely fell in love💘💘 . You are the best teacher in the world! Thank you very much!
It's so great that you cover such important topic, in our company a skill in Unit testing is even mandatory for Junior/Intern position, because it's so crucial to write tests (nobody will write them for you if you create a pull request), and so many candidates are rejected because of the lack of this skill Also it is amazing that you do so with one of your current poroject, many courses cover it as "I HaVe A hAmBuRgEr ClAsS, lEtS WrItE UnItTest", and the skill of testing on a living project is really crucial Huge +1 form me
I think you should do a followup video about Mocking (Mockito or Mockk) and verifying mocks, because I think that actually nobody uses "fake components"
I'm getting Dagger duplicate binding error even after using UninstallModule on my AppModule in the test class. Do we need to do something more to fix this? How can it have duplicated binding when AppModule is already uninstalled fromt the test class
1. So I already understand how to put the UI in the layout .. 2. Making the UI to be clickable 3. Making the UI to scroll And yes you're right that I need my build time to be faster.. And I am interested how to integrate unit test with a mocking object of the android components.. Hopefully I can finish this
Basically iam a single web application tester in my company. As part of the new project they assigned me as Android tester so just guide me What's the exact thing to do in this . They just telling to test Android devices. As part of KT They just delivered some kind of stuff but unfortunately idint get it . CTS VTS GTS. Iam fully confused that what they actually talking about .... Finally make a video from Scratch who is starting their carrier as Android testing Thank you 😊
Was nice to see how you do testing, thanks for sharing! Let me comment on what I noticed while watching: 1) When testing the GetNodes UseCase, you're faking the repository instead of the dao. This has the setback that the behavior of the fake might not mimic the actual repositories implementation, especially over time when your code and structure changes. When you refactor you repository code, you might change e.g. the semantics of getNodesById -- say for exception handling. When you have tests for your repository separately, you'll adjust them since they broke. But you'll certainly forget to adjust this UseCase test. This will result in this UseCase test becoming useless. Things will improve when you fake the dao, since changes to the semantics of the dao will happen less often -- and of course you'll find issues due to changed repository semantics. If you have concepts on your mind how to avoid that your UseCase test becomes useless following your presented test pattern because it's not updated on changes of dependencies, I'd be glad to hear about that. 2) Keep your tests as tidy as you keep your production code, the same principles apply -- especially DRY, so don't just copy&paste, it will give you headaches later. 3) Why are you using the @Throws annotation in your AddNote UseCase? Are you planning for Java interop?
I am also not liking how the composable are copied into the test class.We're basically maintaining the same code for the main code and the test code. How can you make It tidy and not copy the code?
Hope you make a TDD video covering outside-in and classicist approach using uncommon convention where test classes are suffixed with the word "should".
It's 2023 and I can't run this project with latest versions of... all the stuff that it's using. I spend half a day and still no success. This is crazy.
How do you test the delete notes usecase? It seems I would need to add an extra method inside the DeleteNotes usecase to return the repository and check whether the note is there or not
hi Philipp. you used `TestInstallIn` annotation and `replaces` in your recent test cources and, you didn't use `UninstallModule` there. What is the difference between these methods?
I also realized that redefining Compose and its navigation stuffs in the setUp function is no longer necessary. createAndroidComposeRule starts the activity already, and Compose components are ready to test there.
You are the best. I have learned a lot by your tutorials. Can you please upload a video for all Functional Tests, Unit Test, instrumentation test and UI test in Java. ? Even if it's a paid version, it is ok.
Hey Philipp, sorry if you mentioned this before but are you gonna make either Flutter, React Native, or KMP tutorials? I love you're well-paced and properly architectured teaching style. I've had enough of other tutorials that teach you how to make a todo list app in 5 minutes all in one class. I want a professional, longer, well-pace, and architectured multiplatform tutorial.
hey, in Spotify play list in video 13 there are more than 10 person have the same problem in comment of "@Quang Đạt" please if anyone can help tell us if u can't set Like to make philipp see it please..
Hi, Phillip, I have a question, I have a production-level project but it does not contain any tests so if I were to implement unit tests in that same project can I add the tests to the production level directly or I should create a separate project for tests that will be separate from production also what is the industry standard? and thank you for reading it.
Hi man, not Philip but the tests should be on the same project, on the com.test directory for unit tests and com.androidTest for the Instrumentation tests and UI tests, hope this helps.
Thanks for your video Philipp! This was very educational and I learnt a lot from it. For some reason, during my Integration section following the tutorial, I kept on getting the error "java.lang.AssertionError: Failed to perform isDisplayed check. Reason: Expected exactly '1' node but found '4' nodes that satisfy: (TestTag = 'ORDER_SECTION')" for the function clickToggleOrderSection_isVisible. Not sure what I am doing wrong
It seems that you've assigned the tag to the OrderSection's Modifier and forgot to use that passed modifier inside OrderSection. As a result, the node not be present in the tree and causing the test to fail.
The instrumented test fails, it can't find a view with given tag. useUnmergedTree = true does not help. Adding a delay does not help. Using tags the same way on other views works fine. assertExists also fails. Any ideas? e/ Also the EndToEnd test fails because it's missing focus on the first action. [e: No input session started. Missing a focus?] Think update to composable introduced focusModifier?
how would you just test the view model here? I tried mocking the SavedStateHandle but I get an error about duplicate bindings (I just bind the SavedStateHandle in the TestAppModule object class)
Reason: Expected exactly '1' node but could not find any node that satisfies: I am following the same steps as you for my composable but still getting this error. In my composable, however, I call other composables and the node with the tag is located in one of them
It seems that you've assigned the tag to the OrderSection's Modifier and forgot to use that passed modifier inside OrderSection. As a result, the node not be present in the tree and causing the test to fail.
I got the required knowledge for different types of android application tests, the video is just amazing and you really doing a very great job doing your huge efforts in making this free up to dated content for the android developers, I am really happy following or subscribe your channel, keep it up boy, Salute 🫡
mock objects make sense when you have something with tons of functions. Implementing a fake for that would require you to write an implementation for all these functions. With a mock you only implement the ones needed. Most of the times, mocks actually make more sense
getting this error. please help. -> android.content.ActivityNotFoundException: Unable to find explicit activity class {com.samm.brewerysearch.test/androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared ?
Your explanation is wrong. Unit tests don't test a component class or function but a feature. This is the big misunderstanding which is also mentioned by Uncle Bob. Implementation details like inner classes should never been tested separately but tested as a black box. Tests should trigger your ViewModel and expect an effect on your ViewState, Database or Http-Request. You never should test something in between!
it would be super cool if you could a video like this one ruclips.net/video/IvFSJVTGDb4/видео.html, basically refactoring the app to use modules instead.
Well - the guy has to make his money from this somehow - you know how much time it takes to make such good quality content? Cmon - your comment is disrespectful!
Anyone gave this a try? I get an error when I run the Integration test, the trace says: Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'
Thank god for your existence man.
Phillipp, you decided to destroy me. I don't do almost anything but watch your videos. I absolutely fell in love💘💘 . You are the best teacher in the world! Thank you very much!
❤️❤️❤️
This is exactly the content RUclips is lacking ! Thank you for making this !
It's so great that you cover such important topic, in our company a skill in Unit testing is even mandatory for Junior/Intern position, because it's so crucial to write tests (nobody will write them for you if you create a pull request), and so many candidates are rejected because of the lack of this skill
Also it is amazing that you do so with one of your current poroject, many courses cover it as "I HaVe A hAmBuRgEr ClAsS, lEtS WrItE UnItTest", and the skill of testing on a living project is really crucial
Huge +1 form me
Thanks a lot for the amazing feedback!
I think you should do a followup video about Mocking (Mockito or Mockk) and verifying mocks, because I think that actually nobody uses "fake components"
I've just finished it . The more time passes , the more people realize the value of this video
Amazing! Tanks a lot!
Change : Unit Tests, UI Tests, End-to-End Tests => Unit Tests, Instrumented Tests, End-to-End Tests
If you would prefer as well.
But every instrumented test I show here is a UI test
@@PhilippLackner if I'm not mistaken, you already did the integration test by testing add notes (integrated with the in-memory room db)
28:44 that was the perfect description of the feeling! :D:D Thanks for your work Phillip!
I'm getting Dagger duplicate binding error even after using UninstallModule on my AppModule in the test class. Do we need to do something more to fix this? How can it have duplicated binding when AppModule is already uninstalled fromt the test class
if you want really gain knowledge about android it is right channel , I have learnt lot of from it thank you philipp
Keep doing this. For sure you are helping many people out here.
That's the plan!
1.
So I already understand how to put the UI in the layout ..
2. Making the UI to be clickable
3. Making the UI to scroll
And yes you're right that I need my build time to be faster..
And I am interested how to integrate unit test with a mocking object of the android components..
Hopefully I can finish this
Basically iam a single web application tester in my company.
As part of the new project they assigned me as Android tester so just guide me
What's the exact thing to do in this .
They just telling to test Android devices.
As part of KT
They just delivered some kind of stuff but unfortunately idint get it
. CTS VTS GTS.
Iam fully confused that what they actually talking about ....
Finally make a video from
Scratch who is starting their carrier as Android testing
Thank you 😊
You are doing a great job philipp... I am watching your videos again and again. Just in love with your way of explaining things...😘😘
Was nice to see how you do testing, thanks for sharing! Let me comment on what I noticed while watching:
1) When testing the GetNodes UseCase, you're faking the repository instead of the dao. This has the setback that the behavior of the fake might not mimic the actual repositories implementation, especially over time when your code and structure changes. When you refactor you repository code, you might change e.g. the semantics of getNodesById -- say for exception handling. When you have tests for your repository separately, you'll adjust them since they broke. But you'll certainly forget to adjust this UseCase test. This will result in this UseCase test becoming useless.
Things will improve when you fake the dao, since changes to the semantics of the dao will happen less often -- and of course you'll find issues due to changed repository semantics.
If you have concepts on your mind how to avoid that your UseCase test becomes useless following your presented test pattern because it's not updated on changes of dependencies, I'd be glad to hear about that.
2) Keep your tests as tidy as you keep your production code, the same principles apply -- especially DRY, so don't just copy&paste, it will give you headaches later.
3) Why are you using the @Throws annotation in your AddNote UseCase? Are you planning for Java interop?
I am also not liking how the composable are copied into the test class.We're basically maintaining the same code for the main code and the test code.
How can you make It tidy and not copy the code?
Please can you make this same video but for projects making network calls? Projects that use coroutines and flow as well like this one
Am late but not out. This is amazing. This was long overdue.
Please make a video on unit testing with mockk. I am facing a lot of difficulty in learning it.
Holy ****! Thank you!!!! Philipp breaking the android community!!!
Thanks man!!
Thank you. Love to see more video on Compose UI testing
Your tutorial are clean as your architecture ! Insane content, it save me a lot of times !
That's a priceless content there, clear & to the point. Well done.
Hope you make a TDD video covering outside-in and classicist approach using uncommon convention where test classes are suffixed with the word "should".
Man, thank you for uploading this video. This is really helpful to me
It's 2023 and I can't run this project with latest versions of... all the stuff that it's using. I spend half a day and still no success. This is crazy.
Incredible testing content, thank you so much! I can't even. This is awesome!
Thanks again Philip! Amazing video again !
hey man , thank you very much , you really conquered our hearts, god bless you
How do you test the delete notes usecase? It seems I would need to add an extra method inside the DeleteNotes usecase to return the repository and check whether the note is there or not
hi Philipp. you used `TestInstallIn` annotation and `replaces` in your recent test cources and, you didn't use `UninstallModule` there. What is the difference between these methods?
I also realized that redefining Compose and its navigation stuffs in the setUp function is no longer necessary. createAndroidComposeRule starts the activity already, and Compose components are ready to test there.
Was looking something like that you seem to know your audience very well !!
Hope you like it!
this was a very helpful video, learnt a lot about test structure,very useful for a developer new to testing
Glad it was helpful!
Please please make a detailed video on Bound Services.
Great work! ,Could you please include webview UI test case in jetpack compose
great video, can you make testing for viewmodel using stateflow
finally thank you for your good explanation. easy to understand
Glad to hear that!
Thanks, Philipp for this Awesome video
Amazing job, as always. Thanks
You are the best. I have learned a lot by your tutorials. Can you please upload a video for all Functional Tests, Unit Test, instrumentation test and UI test in Java. ? Even if it's a paid version, it is ok.
Hey philip I have enjoyed this video and please make one video with adding AI in application
Very important and usefull video!
The setup boilerlate is huge for the instrumented tests.
Hey Philipp, sorry if you mentioned this before but are you gonna make either Flutter, React Native, or KMP tutorials? I love you're well-paced and properly architectured teaching style. I've had enough of other tutorials that teach you how to make a todo list app in 5 minutes all in one class. I want a professional, longer, well-pace, and architectured multiplatform tutorial.
hey, in Spotify play list in video 13 there are more than 10 person have the same problem in comment of
"@Quang Đạt"
please if anyone can help
tell us
if u can't set Like to make philipp see it please..
Hi, Phillip, I have a question,
I have a production-level project but it does not contain any tests so if I were to implement unit tests in that same project can I add the tests to the production level directly or I should create a separate project for tests that will be separate from production also what is the industry standard? and thank you for reading it.
Hi man, not Philip but the tests should be on the same project, on the com.test directory for unit tests and com.androidTest for the Instrumentation tests and UI tests, hope this helps.
and afaik, the directory hierarchy (inside the test directory) should be same as the production one.
In Android Studio are there any limitations in using AndroidX&Junit5 for instrumented tests?
Thanks for your video Philipp! This was very educational and I learnt a lot from it. For some reason, during my Integration section following the tutorial, I kept on getting the error "java.lang.AssertionError: Failed to perform isDisplayed check.
Reason: Expected exactly '1' node but found '4' nodes that satisfy: (TestTag = 'ORDER_SECTION')" for the function clickToggleOrderSection_isVisible. Not sure what I am doing wrong
It seems that you've assigned the tag to the OrderSection's Modifier and forgot to use that passed modifier inside OrderSection. As a result, the node not be present in the tree and causing the test to fail.
I love you phillipp, you are the best of the world, tks
I am late to this video, Code is very hard to build now. Can you update code base.
The instrumented test fails, it can't find a view with given tag. useUnmergedTree = true does not help. Adding a delay does not help. Using tags the same way on other views works fine. assertExists also fails.
Any ideas?
e/ Also the EndToEnd test fails because it's missing focus on the first action. [e: No input session started. Missing a focus?] Think update to composable introduced focusModifier?
Plzz make video on binding adapter Philipp 🙌🏻
Hi Man, do you have premuim testing course?
I feel like i won lottery ,thanks phillip 💚💚
Thanks!! Glad it helps
how would you just test the view model here? I tried mocking the SavedStateHandle but I get an error about duplicate bindings (I just bind the SavedStateHandle in the TestAppModule object class)
You don't need to bind the SavedStateHandle. Hilt will automatically provide it.
Reason: Expected exactly '1' node but could not find any node that satisfies:
I am following the same steps as you for my composable but still getting this error. In my composable, however, I call other composables and the node with the tag is located in one of them
It seems that you've assigned the tag to the OrderSection's Modifier and forgot to use that passed modifier inside OrderSection. As a result, the node not be present in the tree and causing the test to fail.
How to properly run your source code? I like all your tutorials, but I actually never successfully run any of them...
Man you're an Android beast)))
I got the required knowledge for different types of android application tests, the video is just amazing and you really doing a very great job doing your huge efforts in making this free up to dated content for the android developers, I am really happy following or subscribe your channel, keep it up boy, Salute 🫡
Sir please make a video on how to Use FIREBASE with Jetpack Compose
The same way you used it before. Only the ui layer changed with compose which firebase has nothing to do with
thanks, learned a lot !!
Awesome tutorial thank you rly.
28:43 made me laugh out loud! It is true though.
if you refactor this great app to multi module it will be our document to architect our apps ... thx
you are the best 🥰🥰thank you so much
Thank you very much!
Wow thank you so much♥️♥️
thanks for sharing!
Thanks Philip very mush
Thank you very much 🥰
one question. when to use fake objects and when to use mockk to mock objects?
mock objects make sense when you have something with tons of functions. Implementing a fake for that would require you to write an implementation for all these functions. With a mock you only implement the ones needed. Most of the times, mocks actually make more sense
Great job!!
Thank you!
The unexpected uss of the word "orgasm" got me 😂
Thank you very much
Aw yeeessss an update! 😎
thanks for the video
You're welcome
Awesome love you
Wow Perfect
Thanks 😘
getting this error. please help. ->
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.samm.brewerysearch.test/androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared ?
Love you Sir....
I love you too, Donald
@@PhilippLackner sir can you please tell me the the shortcut to see the suggestions popping in methods
It's the orga*m part for me. Hahahahaha love your tutorials
I love that in your testing videos, when your tests fail, you think there is something wrong with the test function. 😂😂😂 Pretty ironic.
😂😂
🔥
Please don't teach to add randomisation in unit tests.
Other than that, there is a lot of useful info here. Thanks for the video!
How to test with real rest api? Let say my screen needs to perform api request? How to make unit test wait for api to finish?
Y O U A R E T H E B E S T
Your explanation is wrong. Unit tests don't test a component class or function but a feature. This is the big misunderstanding which is also mentioned by Uncle Bob. Implementation details like inner classes should never been tested separately but tested as a black box. Tests should trigger your ViewModel and expect an effect on your ViewState, Database or Http-Request. You never should test something in between!
it would be super cool if you could a video like this one ruclips.net/video/IvFSJVTGDb4/видео.html, basically refactoring the app to use modules instead.
Thanks Phillip for this amazing content.
As always... what a crack
28:41 🤣🤣🤣🤣
down voting way too many ads
Well - the guy has to make his money from this somehow - you know how much time it takes to make such good quality content? Cmon - your comment is disrespectful!
@@mikec4220 there are plenty of people who make money on RUclips without excessive ads 🤷🏽♂️
@@duckieDidIt instead of putting such comments just install an add blocker and that will solve your issue.
@@mikec4220 it’s called the freedom of speech you should learn a thing or two about it
@@duckieDidIt and you should learn a thing or two about respecting other peoples work ;)
Anyone gave this a try? I get an error when I run the Integration test, the trace says: Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'
instead. of composerule.setcontent do composerule.activity.setcontent
composeRule.activity.getString(resId = R.string.my_string)