Junior — Middle
Have you had practical experience creating and executing widget tests?
sobes.tech AI
Answer from AI
Yes, I have experience creating and executing widget tests in Flutter. Widget tests allow you to verify the behavior of individual widgets in isolation, simulating user interactions and checking UI rendering. For example, you can test that pressing a button changes the text on the screen:
testWidgets('Check text change on button press', (WidgetTester tester) async {
await tester.pumpWidget(MyWidget());
expect(find.text('Hello'), findsOneWidget);
await tester.tap(find.byType(ElevatedButton));
await tester.pump();
expect(find.text('Button pressed'), findsOneWidget);
});