简体   繁体   中英

Flutter run multiple unit tests in Android Studio

I have been following this Flutter doc: https://flutter.dev/docs/cookbook/testing/unit/introduction

And I can run the test in Android Studio if I open the file and run it by tapping the run button.

Thing is I want to run all tests with the push of one button, like in Xcode.

How to do that in Android Studio?

What I did:

Created two dumb tests, just for the sake of having them.

在此处输入图像描述

Created test configuration with All in Directory option and pointed to test directory:

在此处输入图像描述

And after hitting Play button I get:

Failed to load "/Users/martinberger/Dev/flutter_apps/iCash/icash/test/second_test.dart":
Test never connected to test harness.
Test: /Users/martinberger/Dev/flutter_apps/iCash/icash/test/second_test.dart
Shell: /Users/martinberger/Dev/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester

So the first test complete, but next one, do not even start.

Of the dozen or so tutorials/blogs/docs I have read about this, they all focus on writing one test and running it by right-clicking or by having it open and clicking Play button.

I am coming from iOS/Xcode background so is there something I should know about running a simple test suite in Android Studio?

You can type flutter test and then the directory you want in the terminal.

So in your case: flutter test test/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM