Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter test --coverage and flutter test --watch #4719

Open
1 of 11 tasks
Hixie opened this issue Jun 23, 2016 · 11 comments
Open
1 of 11 tasks

flutter test --coverage and flutter test --watch #4719

Hixie opened this issue Jun 23, 2016 · 11 comments
Labels
a: tests "flutter test", flutter_test, or one of our tests c: new feature Nothing broken; request for a new capability P3 Issues that are less important to the Flutter project team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team

Comments

@Hixie
Copy link
Contributor

Hixie commented Jun 23, 2016

  • flutter test --coverage should write:
    • two identical files, a base file and a coverage file,
    • plus a file that lists the last modification times of all the test files.
  • flutter test --watch should watch the file system of the current package.
    • If a file under lib/ changes, it should rerun all the tests and create a new base file and timestamp file.
    • If a file under 'test/' changes, it should rerun all the tests with timestamps that indicate the file changed since the base file was written.
    • after flutter test --watch runs some tests, it should merge the new coverage with the base file and overwrite the coverage file.
  • We should document the caveats here:
    • Tests that have expectations or that depend on non-test files won't be run when those files change.
    • Reducing coverage won't be noticed.
    • Coverage is per-line and hitting any expression on the line counts as covering the line.
@Hixie Hixie added affects: dev experience a: tests "flutter test", flutter_test, or one of our tests c: new feature Nothing broken; request for a new capability labels Jun 23, 2016
@Hixie Hixie modified the milestone: Flutter 1.0 Sep 12, 2016
@Hixie Hixie modified the milestones: 6: Future Future, 5: Make Hixie proud Jan 31, 2017
@Hixie Hixie modified the milestones: 6: Future Future, No milestone necessary Jan 17, 2018
cdotstout pushed a commit to cdotstout/flutter that referenced this issue Apr 3, 2018
…g it in. (flutter#4719)

This allows blobfs to deduplicate it across {dart,flutter}_{jit,aot}_runner.
@Hixie
Copy link
Contributor Author

Hixie commented Sep 12, 2018

cc @aam

@Hixie Hixie modified the milestones: No milestone necessary, Stretch Goals Sep 12, 2018
@aam
Copy link
Member

aam commented Sep 13, 2018

implementing flutter test --watch might be the shortest path to better "single test run" performance since that would provide natural lifecycle boundary for warm compiler.

cc @a-siva

@aam
Copy link
Member

aam commented Sep 20, 2018

cc @keertip @mraleph

@DanTup
Copy link
Contributor

DanTup commented Sep 24, 2018

I posted a comment on #15767 but it's relevant here. If this is our way of providing better test performance, it'd be great if this has some daemon mode where we can run it and use a JSON API to run individual tests. That way the user can use the existing functionality in the editor (eg. the Run/Debug links embedded in the editor next to tests, or the Test Runner tree) and get faster performance without having to have all tests run on every change.

@apaatsio
Copy link
Contributor

apaatsio commented Oct 5, 2018

  • If a file under lib/ changes, it should rerun all the tests and create a new base file and timestamp file.

May I suggest a slight change. I would like to see a test runner that reruns only the tests that are affected by the file change, not all tests. This has a notable impact on the developer experience since it shortens the feedback loop significantly, especially on larger projects.

Jest works this way when you use --watch. It also offers an option to run all tests at every code change with --watchAll.

@zoechi
Copy link
Contributor

zoechi commented Feb 18, 2019

#27192 seems to target the --watch part.

@dnfield
Copy link
Contributor

dnfield commented Aug 15, 2019

#27192 likely has a lot of what is needed, but appears to have been abandoned. Anyone interested in working on this feature should probably start with the work done in that PR though.

@iapicca iapicca added d: devtools DevTools related - suite of performance and debugging tools tool Affects the "flutter" command-line tool. See also t: labels. labels Jan 6, 2020
@Hixie Hixie modified the milestones: Stretch Goals, New Stretch Goals Jan 7, 2020
@jmagman jmagman added this to Awaiting triage in Tools - DevTools review Jan 10, 2020
@jonahwilliams jonahwilliams removed the d: devtools DevTools related - suite of performance and debugging tools label Jan 10, 2020
@jonahwilliams jonahwilliams added this to Awaiting triage in Tools - "flutter test" review via automation Jan 17, 2020
@jonahwilliams jonahwilliams removed this from Awaiting triage in Tools - DevTools review Jan 17, 2020
@jonahwilliams jonahwilliams moved this from Awaiting triage to Engineer reviewed in Tools - "flutter test" review Apr 25, 2020
@kf6gpe kf6gpe added the P3 Issues that are less important to the Flutter project label May 29, 2020
@kf6gpe kf6gpe modified the milestone: Stretch Goals Jun 1, 2020
@Hixie Hixie removed this from the [DEPRECATED] Stretch Goals milestone Jun 16, 2020
@kf6gpe kf6gpe removed this from the [DEPRECATED] Stretch Goals milestone Jul 7, 2020
@kf6gpe kf6gpe modified the milestone: [DEPRECATED] Stretch Goals Jul 22, 2020
@Hixie Hixie removed this from the - milestone Aug 17, 2020
@szotp
Copy link

szotp commented Aug 22, 2020

It looks like it won't be implemented anytime soon so I'm considering a workaround - since flutter already supports hot reload, I could add my tests as a package directly to the app as dev dependency, and re run tests on each hot reload.

EDIT: This actually works pretty well, I've made a package for other people to try it: https://github.com/szotp/hottie/

@HerrNiklasRaab
Copy link

Related: Dart-Code/Dart-Code#2878

@danielgomezrico
Copy link
Contributor

Is there any possibility that flutter test --watch run only the tests related to the file that changed?
I loved the behavior of https://github.com/guard/guard-test.

@YazeedAlKhalaf
Copy link
Contributor

can we possible have something similar to how bazel does caching of tests.

if you're familiar with running a project that has bazel, you will notice that only tests of files changed are run after the first run which runs everything.

if we integrate this into the watch flag it would make development so much faster.

@flutter-triage-bot flutter-triage-bot bot added team-tool Owned by Flutter Tool team triaged-tool Triaged by Flutter Tool team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests c: new feature Nothing broken; request for a new capability P3 Issues that are less important to the Flutter project team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team
Projects
Tools - "flutter test" review
  
Engineer reviewed
Development

No branches or pull requests