[animations] Improve unit/widget tests in the app.
Description
Currently, in the widget test, we are only checking whether the Text is rendered correctly or not. Adding more widget/unit tests in the application can help Flutter enthusiastic to get more detailed examples of the writing unit/widget test.
The app uses many different widgets which can demonstrate proper techniques to write widget test. For example, we can demonstrate the proper technique to write widget test for ListView.
I would like to work on this issue.
@AyushBherwani1998 Thanks for filing the issue. Make sure you add tests for the different animation demos(animations themselves).
@jddeep Yes, having something similar in mind.
@RedBrogdon in most of the samples. we are generating values randomly. I think checking the values before and after animations will not be the best choice. It might be the case, that the same value is generated again. Well, it will happen in rare case. WDYT?
@AyushBherwani1998, writing tests for our sample apps can sometimes be tricky, since they're often designed to show off the basic widgets present in the SDK. While you could certainly add a test for the ListView widget itself, that test really belongs in the SDK, rather than here.
What you could do here is add tests for the demos that are complicated enough that it would make sense. The carousel demo, for example, is complex enough, as would be the expand card. If you're interested, I'd start with a small pull request for just one of them, as it'll be easier to review, revise, and merge.
@AyushBherwani1998, writing tests for our sample apps can sometimes be tricky, since they're often designed to show off the basic widgets present in the SDK. While you could certainly add a test for the ListView widget itself, that test really belongs in the SDK, rather than here
Makes Senses.
What you could do here is add tests for the demos that are complicated enough that it would make sense. The carousel demo, for example, is complex enough, as would be the expand card. If you're interested, I'd start with a small pull request for just one of them, as it'll be easier to review, revise, and merge.
Yes, I'm interested in working on complex examples.
Hey @RedBrogdon, I was writing some test for CarouselDemo, and I only came up with a test which checks if the scroll is working correctly or not, without considering any internal working of the widget. Do you have any suggestion for checking more ways to write a test for CarouselDemo?
Hey @AyushBherwani1998,
Are you still working on tests for CarouselDemo? If not, please let me know. I'll soon send a PR with tests for CardSwipeDemo and would love to work on CarouselDemo next. If you are still working or want to work on it, I can find something else.
Hey @abd99, that's awesome. I have already written the test for the CarouselDemo as per my understanding in my local machine. I'll send a PR soon.
Alright, I'll find something else.
Hey @AyushBherwani1998 @abd99 , It's very nice reading up your chats I have been making apps with flutter for about 3 months , now I just want to step into Open Source contribution but I am unable to find the way to my very first contribution .
I have read ad lot of documentations but still not able to do this , Can you please help me out with this 👍
Hey @cv692001 👋 That's great that you want to take the first step and contribute to the repo. Assuming you want to work on this issue, and you are new to writing the tests here are a few guides/tutorials which can be helpful to you.
- The "Testing" section in Flutter Cookbook. You can directly jump to widget testing since this issue mostly focuses on adding new widget tests.
- You can check out the recently added testing_app sample by @abd99.
- You can check out the existing tests added for the sample, and understand how tests are written for the particular demo.
If you feel stuck while writing tests for a particular demo, feel free to comment on the issue, and someone from the team or contributors will help you out. Also, the issue really focuses on adding the test for misc examples, so you can choose an example from misc section and write a test.
Since you are a first-time contributor, you should check CONTRIBUTING.md . Here's a TL;DR, make sure you are on the stable channel of flutter since the samples are targeted for the stable branch. For every new file you create, just include this file header.
Happy Fluttering!
Hi @RedBrogdon & @AyushBherwani1998 I have added a widget test for AnimatedPositioned in the #576 It would be great if you can review the same.
Hi @RedBrogdon @AyushBherwani1998 @tusharojha I have added a widget test for HeroAnimation in #620. It would love to hear your feedback on that :)