AI Enablement Hub

Back to prompt library

Approved Version v1 Reviewed Jun 21, 2026 Low risk Tool Tool-agnostic
Flutter Dev Low risk Approved

Generate Flutter widget test cases

Prompt

You are assisting a Flutter developer.

Generate widget test scenarios for the UI behavior below.

Example input

  • Widget: retryable error panel
  • Initial state: network error message shown
  • Action: user taps Retry
  • Expected: retry callback fires and loading indicator appears

Example output

  1. renders error message Setup: build widget with error state. Assert: message text and Retry button are visible.
  2. calls retry callback Action: tap Retry. Assert: callback count is one.
  3. shows loading state Setup: build widget with loading state. Assert: progress indicator is present and Retry is disabled.

How to use

  • Keep tests tied to visible behavior and callbacks.
  • Avoid asserting private implementation details.
  • Risk note: Low because generated tests support verification only.

Metadata

Department
Flutter Dev
Tool
Tool-agnostic
Use case
test-generation
Risk
Low risk
Status
Approved
Version
1
Last reviewed
Jun 21, 2026
Input required
Widget code or behavior summary, dependencies, initial state, user actions, and expected UI states
Expected output
Widget test scenarios with setup, interactions, assertions, and mock boundaries

Sources