Kasikornbank Amorn Apichattanakul Jun 25, 2026

Antigravity on the Night Shift: Automating Mobile Integration Tests and Auto-Fixing PRs

Article Summary

Amorn Apichattanakul from KBTG reveals how his team uses Google Antigravity to write Flutter tests autonomously while developers sleep. The agent doesn't just find gaps—it writes the tests, fixes failures, and opens PRs before morning standup.

Most Flutter teams skip integration tests when deadlines loom, leaving critical user flows like registration and password recovery completely untested. Apichattanakul's team built a nightly automation system using Google's Antigravity CLI that runs locally as a cron job, targeting code changed that day and autonomously writing missing unit, widget, and integration tests.

Key Takeaways

Critical Insight

By running an AI agent during off-hours with strict guardrails (never alter app logic, always assert real behavior), the team closes test coverage gaps automatically and starts each day with green tests and ready-to-merge PRs.

The article includes the exact shell scripts, prompt engineering techniques, and cost control strategies that keep nightly token usage cheap enough to run every single night.

About This Article

Problem

At KBTG, Flutter teams had uneven test coverage. validators.dart had 94.1% coverage, but register_screen.dart and register_bloc.dart had none. This left registration and password recovery flows exposed to regressions.

Solution

Amorn Apichattanakul's team created a system where the Antigravity CLI agent writes unit and widget tests automatically using minimal tokens. Developers handle integration tests, and the agent fixes broken tests by analyzing widget tree failures and adding missing UI keys.

Impact

Running nightly automation increased overall coverage from 38.6% to 71.2% in one run. The agent writes tests only for code changed since 6:00 AM each day. Developers now start mornings with passing tests and PRs ready to merge, without writing tests manually.