'Unable to run integration test on Flutter

When I run the integration tests, the 'Instantiating tests...' loops forever. The app loads in the device correctly but nothing happen.

Android Studio Screenshot

I created the following failing test:

app_name/integration_test/app_test.dart

import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  group('end-to-end test', () {
    testWidgets('Failing test', (WidgetTester tester) async {
      expect(1, 2);
    });
  });
}

pubspec.yaml

...
dev_dependencies:
  integration_test:
    sdk: flutter
  flutter_test:
    sdk: flutter
...

flutter doctor --verbose

[✓] Flutter (Channel stable, 2.5.2, on macOS 11.5.2 20G95 darwin-x64, locale en-ES)
    • Flutter version 2.5.2 at /Users/m_16679797/Flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3595343e20 (5 months ago), 2021-09-30 12:58:18 -0700
    • Engine revision 6ac856380f
    • Dart version 2.14.3

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/XXXX/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • XXX, XXX’s iPhone (mobile) • 04...XXX...cc • ios            
• iOS 15.2 19C56
    • Chrome (web)                                     • chrome                                   • web-javascript • Google Chrome
      

• No issues found!


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source