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
- Coverage jumped from 38.6% to 71.2% overnight with zero developer time
- Agent self-heals broken integration tests by analyzing failures and fixing UI code
- Runs locally on developer machines to split costs and enable instant kill switch
- Persistent memory file lets agent learn from past mistakes and PR feedback
- Agent boots iOS simulator, runs tests, and shuts down automatically
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.
About This Article
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.
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.
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.