Skip to main content
ProductsDesktop toolsTASTECADDrawing reviewTASTEFILESFile managementTASTEFTPFile transferTASTESSHRemote workspaceTASTEZIPCompression and extractionDeveloper toolsTASTECODERust integrated development environmentTASTESTUDIOIntegrated development and test environmentTASTEETLData integration (ETL)ServersTASTEREMOTERemote desktop serverTASTEGEOGeospatial serverTASTEMAILMail workspaceGet startedDownloadsDocumentationBuyAll products
Marketplace
News
TechNewsToday's dev newsDeveloper docsProgramming languagesRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp & desktop frameworksTauriFlutterReact NativeElectronAlgorithmsAlgorithm basicsCore algorithmsAdvanced algorithmsPractical algorithms
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcaseCommunity guide
Work with usTech transferWebsite buildDesktop app buildRelease and payment pipelineSales partnerContact
ServicesRemote desktopCustom installer packages
TASTEDEV
Products

Desktop tools

TASTECADComplex drawings, opened with easeTASTEFILESJust the files you need, as fast as possibleTASTEFTPThe tidiest path for your filesTASTESSHA stronger link between you and your serversTASTEZIPPack faster, unpack safer

Developer tools

TASTECODEEdit, build, debug and test Rust apps in one windowTASTESTUDIOFrom editing to remote tests and approved AI fixesTASTEETLMove data while you watch the values

Servers

TASTEREMOTEA remote desktop you run on your own serverTASTEGEORebuilding a GeoServer-compatible geospatial server in RustTASTEMAILTake back control of your email

Get started

DownloadsLatest builds of every productDocsHow to use each productBuySubscriptions and perpetual licencesAll productsEvery product at a glance
All products
MarketplaceNews
Tech

News

Today's dev newsOfficial announcements on languages, frameworks, GitHub and AIDeveloper docsGuides to languages, frameworks and algorithms

Programming languages

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App & desktop frameworksTauriFlutterReact NativeElectron

Algorithms

Algorithm basicsComplexity analysis · Sorting · Searching · Basic data structures · Trees and heapsCore algorithmsGraph traversal · Shortest paths & minimum spanning trees · Dynamic programming · Greedy algorithms · Divide and conquer · BacktrackingAdvanced algorithmsString algorithms · Math and number theory · Bit manipulation · Segment trees · Union-findPractical algorithmsCoding interview strategy · LRU cache · Rate limiting · Consistent hashing
All development docs
Community
ProjectsDiscover builders and their workDevelopment logsDecisions and lessons learnedPromptsReusable instructionsAI tool issuesProblems and workarounds for Claude, Codex, GeminiShowcaseFinished resultsCommunity guideHow we build in the open
Work with us
Tech transferNative apps in Rust and eguiWebsite build10 languages, accounts, docs and downloadsDesktop app buildRust and egui, no WebViewRelease and payment pipelineSigning, MSI, deb, rpm, AppImage, hashesSales partnerRecommend us and earn 30%ContactBuilds, partnerships and investment
Services
Remote desktopReach your computer from a browserCustom installer packagesOnly the features you need, settings preloaded
Buy
EN
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Log in
Log in
TASTEDEV

From small tools to better development.

support@tastedev.netSupport TASTEDEV
ProductsProduct lineupBuyDocsDownloadsMarketplaceSupport
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcase
PoliciesPrivacy policyTerms of serviceSubscription termsRefund policyCommunity guidelines
AccountLog inSign up
Visitors
Today
012345678901234567890123456789012345678901234567890123456789
Yesterday
012345678901234567890123456789012345678901234567890123456789
Total views
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
Company
GXSOFT
Representative
CHOI YOUNG GU
Business registration number
853-44-00368
Address
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Phone
+82-10-4404-1523
Email
whitecalvin@tastedev.net
Privacy officer
CHOI YOUNG GU

© 2026 TASTEDEVProduct information is based on verified development sources.Released · improving

Flutter docs
Flutter
Getting Started with FlutterProject StructureCore ConceptsData and StateTestingBuilding and Deployment
Discussions

Flutter guide · 5/6

Testing

Flutter ships its testing tools with the SDK. Tests fall into three groups by scope: unit tests check a single function or class, widget tests check a widget or a small part of a screen, and integration tests run the whole app on a real device or emulator. The broader the test, the more realistic and the slower it is, so write many unit and widget tests and keep integration tests for critical flows.

KindScopeRuns onSpeed
Unit testFunctions, classes, state logicDart VMVery fast
Widget testWidgets, parts of screensSimulated test environmentFast
Integration testFull app flowsDevice, emulator or desktopSlow

Unit tests

Put test files in the test folder and end their names with _test.dart. In Flutter projects, the flutter_test package also provides test, group and expect.

// lib/cart.dart
class Cart {
  final Map<String, int> _prices = {};

  void add(String name, int price) => _prices[name] = price;
  int get total => _prices.values.fold(0, (sum, price) => sum + price);
}
// test/cart_test.dart
import 'package:flutter_test/flutter_test.dart';
import 'package:hello_app/cart.dart';

void main() {
  group('Cart', () {
    test('starts with a total of 0', () {
      expect(Cart().total, 0);
    });

    test('adding items increases the total', () {
      final cart = Cart()
        ..add('apple', 1000)
        ..add('pear', 2500);
      expect(cart.total, 3500);
    });
  });
}

Run tests from the command line or your editor:

# Run all tests
flutter test

# Run a single file
flutter test test/cart_test.dart

# Run tests whose name matches
flutter test --name "total"

# Collect coverage (writes coverage/lcov.info)
flutter test --coverage

Widget tests

Widget tests use testWidgets. The WidgetTester mounts a widget (pumpWidget), finds things (find), interacts (tap), rebuilds (pump) and then you assert. The generated test/widget_test.dart is exactly this kind of test:

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hello_app/main.dart';

void main() {
  testWidgets('tapping add increments the counter', (WidgetTester tester) async {
    await tester.pumpWidget(const MyApp());

    expect(find.text('0'), findsOneWidget);
    expect(find.text('1'), findsNothing);

    await tester.tap(find.byIcon(Icons.add));
    await tester.pump();

    expect(find.text('0'), findsNothing);
    expect(find.text('1'), findsOneWidget);
  });
}

Commonly used helpers:

  • find.text, find.byType, find.byIcon, find.byKey: locate widgets. Giving widgets a key such as Key('submit') makes them easy to find.
  • findsOneWidget, findsNothing, findsNWidgets(n): check how many were found
  • tester.enterText(finder, 'text'): type into a text field
  • tester.pumpAndSettle(): keep pumping frames until animations finish

Replacing dependencies

When testing code that hits the network, use fake responses instead of a real server. The http package includes a MockClient for tests, so if your function accepts an http.Client, swapping it is easy. For more complex cases, create fakes with mocktail or mockito.

import 'package:http/http.dart' as http;
import 'package:http/testing.dart';
import 'package:flutter_test/flutter_test.dart';

Future<String> fetchTitle(http.Client client) async {
  final response = await client.get(Uri.parse('https://example.com/title'));
  return response.body;
}

void main() {
  test('returns the response body', () async {
    final client = MockClient((request) async => http.Response('Flutter', 200));
    expect(await fetchTitle(client), 'Flutter');
  });
}

Integration tests

Integration tests use the integration_test package that comes with the SDK. They launch the app on a real device, emulator or desktop and drive it with the same API as widget tests. First add the dev dependency:

flutter pub add 'dev:integration_test:{"sdk":"flutter"}'

Place test files in an integration_test folder at the project root:

// integration_test/app_test.dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:hello_app/main.dart' as app;

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  testWidgets('full app flow', (tester) async {
    app.main();
    await tester.pumpAndSettle();

    await tester.tap(find.byIcon(Icons.add));
    await tester.pumpAndSettle();

    expect(find.text('1'), findsOneWidget);
  });
}
# Run on a connected device
flutter test integration_test/app_test.dart

# Pick a device
flutter test integration_test -d windows

Summary

  • Unit tests cover logic, widget tests cover UI behavior, and integration tests cover the whole app on a real device.
  • Run every kind with flutter test, and add --coverage to collect coverage.
  • Widget tests follow the pattern pumpWidget, find, tap, pump, expect.
  • Design code so external dependencies come in through constructors or parameters and can be replaced with fakes.
Questions about this chapter?
Previous chapterData and StateNext chapterBuilding and Deployment

0 comments

Top commentsNewest first

Sign in · Sign in to leave a comment.