Reputation: 385
Am facing below issue while running flutter tests for flutter starup project.
command : flutter drive --driver=test_driver/integration_test_driver.dart --target=integration_test/app_test.dart
Flutter : 1.20.2 (flutter doctor has no issues), integration_test: 1.0.2+2
Error : **flutter/.pub-cache/hosted/pub.dartlang.org/integration_test-1.0.2+2/lib/integration_test.dart:324:11: Error: 'FrameTimingSummarizer' isn't a type. final FrameTimingSummarizer frameTimes = ^^^^^^^^^^^^^^^^^^^^^ /flutter/.pub-cache/hosted/pub.dartlang.org/integration_test-1.0.2+2/lib/integration_test.dart:302:20: Error: The getter 'kDebugWarning' isn't defined for the class 'IntegrationTestWidgetsFlutterBinding'.
integration_test_driver.dart
import 'package:integration_test/integration_test_driver.dart';
void main()=> integrationDriver();
app_test.dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'dart:async';
import '../lib/main.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
await tester.pumpAndSettle();
// 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 incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
);
}
}
Upvotes: 1
Views: 225
Reputation: 321
I know it's old question and maybe rarely people will face this since the problem lies on the flutter old version, but just for reference in case anyone face this problem in the future,
so here is my "investigation" about integration test, "FrameTimingSummarizer", and flutter version release date,
flutter 1.20.2 : released at Aug 14th, 2020
FrameTimingSummarizer : created at Aug 11th, 2020,
but there are failing check and only migrated to flutter_test at Oct 1st, 2021, so I assume, flutter_test base on flutter 1.20.2 which is released prior to Oct 1st, doesn't have FrameTimingSummarizer class in its library. In fact it seems to be prepared for 1.22.0 and up.
integration_test : starting 0.9.2 they use FrameTimingSummarize,
so it obvious that flutter 1.20.2 cannot use integration_test 0.9.2, moreover 1.0.2+2 in your configuration.
Conclusion
flutter 1.20.X should use integration_test 0.8.2 at max.
but, if your want to use integration_test 1.0.2+2, please upgrade flutter version to at least 1.22.0. it should solve this problem.
with that being said, I haven't test it my self, and cannot guarantee that there are no other issue about both of the configurations
I hope it can help you in any way, thank you.
EDIT
I have tested the integration_test 0.8.2 route and it work just fine.
I still haven't test the flutter 1.22.0 + integration_test 1.0.2+2 thought
EDIT 2
I have tested the integration_test 0.9.1 and it work fine too.
so this version should be the max instead of 0.8.2
Upvotes: 1