5

I'm trying to develop a Dart package for my Flutter project. It only consists of Dart (so no Flutter) code.

When trying to run my unit tests with Android Studio or IntelliJ I get the following error: Test framework quit unexpectedly In the output window I get the following messages:

Testing started at 21:38 ...
/Users/<user>/development/flutter/bin/cache/dart-sdk/bin/pub run test -r json /Users/<user>/Projects/personal/<project dir>/<project>
Observatory listening on http://127.0.0.1:57505/

Could not find a file named "pubspec.yaml" in "/Users/<user>/.pub-cache/hosted/pub.dartlang.org/test-1.5.3".

Process finished with exit code 66

The whole .pub-cache directory doesn't even exists...

How do I get the testing to work?

SEG.Veenstra
  • 718
  • 1
  • 7
  • 18

2 Answers2

3

I had the error messages: "Test framework quit unexpectedly" "The flutter SDK is not available"

The problem was that I configure the unit tests as Dart tests.

Solution in InteliJ: Run > Edit Configurations... > + symbol on the top left > Flutter Test (to use the Flutter template instead of the Dart template)

Test scope: All in Directory and choose your_project/lib folder. This will search for all files named as *_test.dart

This thread helped figuring this out: dart:ui:1: Error: Not found: dart:ui. flutter/dart:

Alk
  • 33
  • 4
0

I've downloaded the separate Dart SDK en configured Android Studio and IntelliJ to use it instead of the one that ships with Flutter.

Now the tests are working again.

SEG.Veenstra
  • 718
  • 1
  • 7
  • 18