Flutter Testing Guide for Beginners - Part 2: Widget & Integration Tests
Вставка
- Опубліковано 10 лют 2025
- 📗 Get the code snippets & project repo👇👇
resocoder.com/...
📧 Get Flutter news 📰 and resources:
👉 flutter.education
👨💻 Do you write good code? Find out now!
resocoder.com/...
In the first part of this short tutorial series, you’ve learned everything regarding the basics and principles of testing in Flutter and also how to write unit tests together with test-driven development. In this second part, you’re going to learn a lot about widget tests and integration tests in Flutter.
Go to my website for more information, code examples, and articles:
● resocoder.com
Follow me on social media:
● / resocoder
● / resocoder
● / resocoder
This information is worth millions, very clean and easy to undestand
Thank you so much, Reso Coder. Your tutorials have significantly improved my understanding of testing and made learning new aspects of Flutter enjoyable.
Great work! Just to note: Integration tests are almost a MUST nowadays, because doing it you can automatize the shaders compilations to avoid jank issues (specially in iOS). With integration tests you don't need to generate the shaders manually everytime you build a version of the app.
Can you explain some more?
@@wallywebber788 Sure.
Nowadays flutter has a problem with rendering animations without jank in some cases. It's only in the first run of the app (in Android it's only in the first time that the users open your app, in iOS its more serious, if you close the app an open again, the jank will be there in the first run of the animation.)
To mitigate that problem, the Flutter team gave us a way to pre-warm the animations, this is helping reducing the jank in the first run. To do that you need to open and navigate your app through the animations, basically using your app as the users would do. But you need to do everytime you will build your app or if you change something.
As integration tests already navigate through the app, you can use them to cache the shaders for you automatically.
You can check more in the flutter docs: docs.flutter.dev/perf/rendering/shader
And this article shows how to use integration tests to mitigate the shader caching: alex-min.fr/improving-flutter-latency-through-sksl-automation/
@@GabrielCosta-xr5vr thank you for detail explanation!
wow, just finished part1, part two has been uploaded, thank you
AWESOME and thanks for sharing so much knowledge!!
I love you brother. Lots of love from Bangladesh. You are an angel for us whos are not have money for taking paid course. Please Please Please Please Please Please Please Please continue upload flutter videos.
Wonderful tutorial. Thank you.💯
awesome tutorial!!
Reso coder prepare for real app development 🔥👍
Awesome tutorial, this really helps me. Thanks man 💙
Great work as always!
Hi, I really appreciate your content that helps me learn from a professional. Can you upload more content of Flutter, I'm kinda addict to your content now.
Excellent tutorial!
Thank you so much ❤
Thanks for sharing. Please do some more videos on testing.
Hi, Could you please share about create preparation and end test such as junit @beforeeach @aftereace?
Great tuto again thank you. I just don't get how you make integration test in real life only using mock. To me you would have, while developing your application, to implements your services with a Stub version (basically how you mocked your NewService the wrong way in the previous video), then run your application where it only uses Stubbed version of your services. I am not sure if I am clear
Very informative; Thanks for making this tutorial
Amazing! Thanks :)
Good stuff!
Yep, the tests are done! I feel I can ask for more salary 🤓.
Thank you so much !!
I respect your creativity. Everything is clear and understandable. I would really like a new playlist about blocks (ddd course)
Please don't ignore your followers.
Thank you!
Hi, great content.
I need to get the context before initializing Material App?
How could I do this?
you couldn't. material app is the first built widget, so you could assigning a navigate key to it and use it whenever you want.
thank you for this testing!!, its could be more interesting if you try to do in a big app, thank you anyway!!!
Thanks!
When I debug widget tests in vs code how can I see the widget in the browser/simulator? It would be helpful for debugging.
Hey can you do a video on "integration testing" with flutter application for web application
can you also create a tutorial about golden tests?
Great work Always love your content
Hello? I have a question "is it possible to incorporate test widget into integration test?" Thank you.
Bro need new DDD course. please !!! Excitted to see with a API and local cache
Is the flutter bootcamp worth it and still up to date? I'm a beginner in Flutter, but I have a few years of work experience as a software engineer and I'm interested in learning mobile app development.
Why don't you talk about your bootcamp? is it up to date? or is it old videos?
Integration_test dart package is discontinued. Is there any other way to run the integration test code
Hi ResoCoder, I think you are a professional programmer. I am doubting why you are not using GetX State Management? Is there any defect with this package and using it? It is the most liked Flutter Package but not Flutter Favorite. I see many people spread hate on this package and de-promote using it. Can you reply with your honest opinion on this? I know many people gonna comment about the defects, but sorry... Any other's comment will not be considered to change my mind.
GetX its really good, but it has one problem and is that you "forget" about the BuildContext, which is a core thing in Flutter. That's why its considered an "anti pattern" solution. I really like using it, but if you want to keep it clean, bloc is really good.
First!
I am on Android Studio and the integration_test is running on the command line instead of Emulator or other devices, how to fix this?
#help
My test throw:
[core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Thanks!