testWidgets within a `group`
See original GitHub issueSteps to Reproduce
- Create a test file
- Create a
group
declaration. e.g.group("MyGroupOfWidgetTests", () { /* Widget Tests here */ });
- Put some widget tests within the group
- Run the tests
- PROBLEMS:
- Tests are nested an extra level, making them a bit more difficult to read
- One cannot run
testWidgets
tests individually within a group, only the group itself.
Workarounds
Remove the group
and move tests to their own file. When tests are out of the group, they are displayed properly and can be run individually.
Screenshots
Version info
[✓] IntelliJ IDEA Community Edition (version 2017.2) • Flutter plugin version 16.0 • Dart plugin version 172.3317.48
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
How to `setUp` a `WidgetTester` for Multiple Tests in Flutter
And then you should only have a single call to testWidgets(..) ... Use it first in the main method, outside of group and...
Read more >testWidgets function - flutter_test library - Flutter - Dart API docs
Runs the callback inside the Flutter test environment. Use this function for testing custom StatelessWidgets and StatefulWidgets. The callback can be ...
Read more >A Deep Dive Into Widget Testing in Flutter : Part I (testWidgets ...
The usual practice is to write several groups of tests that test out various functionalities of the widget such as verifying the visual ......
Read more >focus_traversal_test.dart - Google Git
testWidgets ('Move focus to next/previous node while skipping nodes in policy', ... when no focusable is available in a group', (WidgetTester tester) async...
Read more >How to use Alchemist for Flutter golden tests
Each test case is contained in a testWidgets function which uses tester.pumpWidget to load the widget under test. Any desired interactions ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I did some more digging and found a comment in the PR about it:
https://github.com/flutter/flutter/pull/3622#discussion_r61632399
That issue was closed as a dupe of https://github.com/dart-lang/test/issues/93 which appears to have been implemented; so I’ll open an issue in flutter to see if we can change this. (Edit: https://github.com/flutter/flutter/issues/17932)
(I presume the IntelliJ code is safe if the group disappears, since it’s handling other cases where this doesn’t occur, like bare
test()
s?).Thanks for this report. I have a good idea of what’s happening and will take a look.
Any other feedback on the test integration would be greatly appreciated!