Kasikornbank

Kasikornbank's Flutter Demo by KBTG: Flutter Integration Test for Dummy

Original post Flutter Demo by KBTG: Flutter Integration Test for Dummy

Article Summary

Amorn Apichattanakul from KBTG compares Flutter's UI testing to native iOS and doesn't hold back: 'UI test in Flutter is... horrible.' But there's a method to the madness.

This hands-on guide walks through Flutter integration testing from the perspective of an iOS developer making the switch. Amorn shares practical workarounds for Flutter's limitations, including issues with native components, animation freezes, and the lack of record mode that iOS developers take for granted.

Key Takeaways

Critical Insight

Flutter's UI testing trades native iOS conveniences for true cross-platform test execution, requiring developers to code everything but testing once across all platforms.

Continue reading

What This Article Covers

Problem

Amorn Apichattanakul found that spinning animations during loading would freeze the Flutter app. This prevented the integration_test package from finding widgets because pumpAndSettle() never finished.

Solution

An engineer at KBTG built a custom pumpUntilFound() function that pumps the widget tree continuously and skips animations until it finds the target widget. This let tests move forward through UI states with lots of animation.

Impact

The workaround made UI tests reliable across loading states. Developers could write cross-platform tests once and run them on all platforms at the same time without needing platform-specific record mode tools.

The article includes a working demo with shell scripts and reveals why the testing pyramid might be shifting to a diamond shape.

This page summarizes “Flutter Demo by KBTG: Flutter Integration Test for Dummy” by Kasikornbank, published Jul 21, 2021. All credit for the original work goes to the authors.

Read the original on medium.com (opens in new tab)

AI tools for Flutter

Browse all AI tools →