I use flutter create testtest
to create a sample app called testest
to run the sample test case, but it throw errors, when I run flutter test ./test/widget_test.dart
errors:
flutter test
00:00 +0 -1: loading /home/helen/Git/testtest/test/widget_test.dart [E]
Failed to load "Git/testtest/test/widget_test.dart":
Shell subprocess crashed with unexpected exit code 127 before connecting to test harness.
Test: Git/testtest/test/widget_test.dart
Shell: /home/h/flutter/bin/cache/artifacts/engine/linux-x64/flutter_tester
00:00 +0 -1: Some tests failed.
Shell: /home/h/flutter/bin/cache/artifacts/engine/linux- x64/flutter_tester: error while loading shared libraries: libGLU.so.1: cannot open shared object file: No such file or directory
Test code import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:testtest/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
flutter doctor
[✓] Flutter (on Linux, locale en_NZ.UTF-8, channel alpha) • Flutter at /home/helen/flutter • Framework revision 8f65fec5f5 (4 weeks ago), 2017-12-12 09:50:14 -0800 • Engine revision edaecdc8b8 • Tools Dart version 1.25.0-dev.11.0 • Engine Dart version 2.0.0-edge.d8ae797298c3a6cf8dc9f4558707bd2672224d3e
[✓] Android toolchain - develop for Android devices (Android SDK 26.0.3) • Android SDK at /home/helen/Android/Sdk • Android NDK at /home/helen/Android/Sdk/ndk-bundle • Platform android-26, build-tools 26.0.3 • Java binary at: /home/helen/sdks/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[✓] Android Studio (version 3.0) • Android Studio at /home/helen/sdks/android-studio • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[✓] IntelliJ IDEA Community Edition (version 2017.2) • Flutter plugin version 18.4 • Dart plugin version 172.4343.25
[-] Connected devices • None
Solution:
I'm using fedora
and to to solve this problem, run the command:
sudo dnf install mesa-libGLU.x86_64
flutter doctor
report any errors? – Günter Zöchbauerflutter doctor
seems fine to me – grepLines