Vai al contenuto principale
ProdottiStrumenti desktopTASTECADVisualizzazione disegniTASTEFILESGestione fileTASTEFTPTrasferimento fileTASTESSHSpazio di lavoro remotoTASTEZIPCompressione ed estrazioneTASTEWINMGestione fileStrumenti per sviluppatoriTASTECODEAmbiente di sviluppo integrato per RustTASTESTUDIOAmbiente integrato di sviluppo e testTASTEETLIntegrazione dati (ETL)ServerTASTEREMOTEServer di desktop remotoTASTEGEOServer geospazialeTASTEMAILSpazio di lavoro emailInvestimentiTASTESTOCKApp desktop di trading automatico azionarioIniziaDownloadDocumentazioneAcquistaTutti i prodotti
Marketplace
Notizie
TecnologiaNotizieNotizie di sviluppo di oggiDocumentazioneLinguaggi di programmazioneRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFramework frontend webNext.jsReactVue.js · NuxtSvelteKitAngularFramework serverSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFramework per app e desktopTauriFlutterReact NativeElectronAlgoritmiBasi degli algoritmiAlgoritmi fondamentaliAlgoritmi avanzatiAlgoritmi pratici
CommunityProgettiLog di sviluppoPromptProblemi degli strumenti di IAVetrinaGuida alla community
CollaboraTrasferimento tecnicoRealizzazione del sito webRealizzazione di app desktopPipeline di rilascio e pagamentoPartner commercialeContatti
ServiziDesktop remotoPacchetti di installazione su misura
TASTEDEV
Prodotti

Strumenti desktop

TASTECADApri con leggerezza anche i disegni più complessiTASTEFILESSolo i file che servono, alla massima velocitàTASTEFTPLa via più ordinata per i tuoi fileTASTESSHUn legame più solido tra te e i tuoi serverTASTEZIPComprimi più veloce, estrai più sicuroTASTEWINMUn file manager a due pannelli pensato per la tastiera

Strumenti per sviluppatori

TASTECODEModifica, compila, esegui il debug e testa app Rust in un'unica finestraTASTESTUDIODalla modifica ai test remoti e alle correzioni IA approvateTASTEETLSposta i dati guardando i valori

Server

TASTEREMOTEUn desktop remoto che gira sul tuo serverTASTEGEOUn server geospaziale compatibile con GeoServer, ricostruito in RustTASTEMAILRiprendi il controllo della tua posta

Investimenti

TASTESTOCKTrading automatico azionario secondo le regole che decidi tu: quando e che cosa

Inizia

DownloadUltime versioni di ogni prodottoDocsCome usare ogni prodottoAcquistaAbbonamenti e licenze perpetueTutti i prodottiTutti i prodotti a colpo d’occhio
Tutti i prodotti
MarketplaceNotizie
Tecnologia

Notizie

Notizie di sviluppo di oggiAnnunci ufficiali su linguaggi, framework, GitHub e IADocumentazioneGuide a linguaggi, framework e algoritmi

Linguaggi di programmazione

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Framework

Framework frontend webNext.jsReactVue.js · NuxtSvelteKitAngular
Framework serverSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Framework per app e desktopTauriFlutterReact NativeElectron

Algoritmi

Basi degli algoritmiAnalisi della complessità · Ordinamento · Ricerca · Strutture dati di base · Alberi e heapAlgoritmi fondamentaliVisita dei grafi · Cammini minimi e alberi ricoprenti · Programmazione dinamica · Algoritmi greedy · Divide et impera · BacktrackingAlgoritmi avanzatiAlgoritmi sulle stringhe · Matematica e teoria dei numeri · Manipolazione dei bit · Alberi di segmenti · Union-FindAlgoritmi praticiStrategia per colloqui di programmazione · Cache LRU · Rate limiting · Hashing consistente
Tutta la documentazione di sviluppo
Community
ProgettiScopri sviluppatori e lavoriLog di sviluppoDecisioni e lezioni appresePromptIstruzioni riutilizzabiliProblemi degli strumenti di IAProblemi e alternative di Claude, Codex, GeminiVetrinaRisultati completatiGuida alla communityCome sviluppiamo in modo aperto
Collabora
Trasferimento tecnicoApp native in Rust ed eguiRealizzazione del sito web10 lingue, account, documentazione e downloadRealizzazione di app desktopRust ed egui, senza WebViewPipeline di rilascio e pagamentoFirma, MSI, deb, rpm, AppImage, hashPartner commercialeConsigliaci e ricevi il 30%ContattiSviluppo, partnership e investimenti
Servizi
Desktop remotoRaggiungi il tuo computer dal browserPacchetti di installazione su misuraSolo il necessario, impostazioni precaricate
Acquista
IT
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Accedi
Accedi
TASTEDEV

Dai piccoli strumenti a uno sviluppo migliore.

support@tastedev.netSostieni TASTEDEV
ProdottiGamma di prodottiAcquistaDocsDownloadMarketplaceAssistenza
CommunityProgettiLog di sviluppoPromptProblemi degli strumenti di IAVetrina
NormeChi siamoInformativa sulla privacyTermini di servizioCondizioni di abbonamentoRimborsiLinee guida della community
AccountAccediRegistrati
Visitatori
Oggi
Ieri
Visualizzazioni totali
Società
GXSOFT
Rappresentante
CHOI YOUNG GU
Numero di registrazione
853-44-00368
Indirizzo
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefono
+82-10-4404-1523
E-mail
whitecalvin@tastedev.net
Responsabile privacy
CHOI YOUNG GU

© 2026 TASTEDEVLe informazioni sui prodotti si basano su fonti di sviluppo verificate.Rilasciato · in miglioramento

Documentazione di Flutter
Flutter
Getting Started with FlutterProject StructureCore ConceptsData and StateTestingBuilding and Deployment
Discussioni

Guida a Flutter · 5/6

Testing

Per ora questo capitolo è disponibile solo in inglese.

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);
  });
}
Domande su questo capitolo?
Capitolo precedenteData and StateCapitolo successivoBuilding and Deployment

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.

0 commenti

Commenti principaliPrima i più recenti

Accedi · Accedi per lasciare un commento.