Saltar al contenido principal
ProductosHerramientas de escritorioTASTECADRevisión de planosTASTEFILESGestión de archivosTASTEFTPTransferencia de archivosTASTESSHEspacio de trabajo remotoTASTEZIPCompresión y extracciónTASTEWINMGestión de archivosHerramientas para desarrolladoresTASTECODEEntorno de desarrollo integrado para RustTASTESTUDIOEntorno integrado de desarrollo y pruebasTASTEETLIntegración de datos (ETL)ServidoresTASTEREMOTEServidor de escritorio remotoTASTEGEOServidor geoespacialTASTEMAILEspacio de trabajo de correoInversiónTASTESTOCKAplicación de escritorio de trading automático de accionesEmpezarDescargasDocumentaciónComprarTodos los productos
Marketplace
Noticias
TecnologíaNoticiasNoticias de desarrollo de hoyDocumentaciónLenguajes de programaciónRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFrameworks web frontendNext.jsReactVue.js · NuxtSvelteKitAngularFrameworks de servidorSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFrameworks de apps y escritorioTauriFlutterReact NativeElectronAlgoritmosFundamentos de algoritmosAlgoritmos esencialesAlgoritmos avanzadosAlgoritmos prácticos
ComunidadProyectosRegistros de desarrolloPromptsProblemas con herramientas de IAEscaparateGuía de la comunidad
ColaboraTransferencia técnicaDesarrollo de sitio webDesarrollo de app de escritorioCanal de lanzamiento y pagosSocio de ventasContacto
ServiciosEscritorio remotoPaquetes de instalación a medida
TASTEDEV
Productos

Herramientas de escritorio

TASTECADAbre planos complejos con ligerezaTASTEFILESSolo los archivos que necesitas, lo más rápido posibleTASTEFTPEl camino más limpio para tus archivosTASTESSHEntre tu servidor y tú, una conexión más sólidaTASTEZIPComprime más rápido, descomprime más seguroTASTEWINMUn gestor de archivos de dos paneles pensado para el teclado

Herramientas para desarrolladores

TASTECODEEdita, compila, depura y prueba apps de Rust en una sola ventanaTASTESTUDIODe la edición a las pruebas remotas y las correcciones con IA aprobadasTASTEETLMueve datos viendo sus valores

Servidores

TASTEREMOTEUn escritorio remoto que funciona en tu propio servidorTASTEGEOUn servidor geoespacial compatible con GeoServer, reconstruido en RustTASTEMAILRecupera el control de tu correo

Inversión

TASTESTOCKTrading automático de acciones según las reglas que tú defines: cuándo y qué

Empezar

DescargasÚltimas versiones de cada productoDocsCómo usar cada productoComprarSuscripciones y licencias perpetuasTodos los productosTodos los productos de un vistazo
Todos los productos
MarketplaceNoticias
Tecnología

Noticias

Noticias de desarrollo de hoyAnuncios oficiales de lenguajes, frameworks, GitHub e IADocumentaciónGuías de lenguajes, frameworks y algoritmos

Lenguajes de programación

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Frameworks web frontendNext.jsReactVue.js · NuxtSvelteKitAngular
Frameworks de servidorSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Frameworks de apps y escritorioTauriFlutterReact NativeElectron

Algoritmos

Fundamentos de algoritmosAnálisis de complejidad · Ordenamiento · Búsqueda · Estructuras de datos básicas · Árboles y montículosAlgoritmos esencialesRecorrido de grafos · Camino mínimo y árbol generador mínimo · Programación dinámica · Algoritmos voraces · Divide y vencerás · Backtracking (vuelta atrás)Algoritmos avanzadosAlgoritmos de cadenas · Matemáticas y teoría de números · Manipulación de bits · Árboles de segmentos · Union-FindAlgoritmos prácticosEstrategia para entrevistas de código · Caché LRU · Limitación de tasa · Hashing consistente
Toda la documentación de desarrollo
Comunidad
ProyectosDescubre creadores y su trabajoRegistros de desarrolloDecisiones y aprendizajesPromptsInstrucciones reutilizablesProblemas con herramientas de IAProblemas y alternativas de Claude, Codex, GeminiEscaparateResultados terminadosGuía de la comunidadCómo construimos en abierto
Colabora
Transferencia técnicaApps nativas con Rust y eguiDesarrollo de sitio web10 idiomas, cuentas, documentación y descargasDesarrollo de app de escritorioRust y egui, sin WebViewCanal de lanzamiento y pagosFirma, MSI, deb, rpm, AppImage, hashesSocio de ventasRecomiéndanos y gana el 30 %ContactoDesarrollo, alianzas e inversión
Servicios
Escritorio remotoAccede a tu ordenador desde el navegadorPaquetes de instalación a medidaSolo lo necesario, ajustes precargados
Comprar
ES
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Iniciar sesión
Iniciar sesión
TASTEDEV

De pequeñas herramientas a un mejor desarrollo.

support@tastedev.netApoyar a TASTEDEV
ProductosLínea de productosComprarDocsDescargasMarketplaceSoporte
ComunidadProyectosRegistros de desarrolloPromptsProblemas con herramientas de IAEscaparate
PolíticasQuiénes somosPolítica de privacidadTérminos de servicioCondiciones de suscripciónReembolsosNormas de la comunidad
CuentaIniciar sesiónRegistrarse
Visitantes
Hoy
Ayer
Vistas totales
Empresa
GXSOFT
Representante
CHOI YOUNG GU
Número de registro mercantil
853-44-00368
Dirección
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Teléfono
+82-10-4404-1523
Correo electrónico
whitecalvin@tastedev.net
Responsable de privacidad
CHOI YOUNG GU

© 2026 TASTEDEVLa información de los productos se basa en fuentes de desarrollo verificadas.Publicado · en mejora

Documentación de Flutter
Flutter
Getting Started with FlutterProject StructureCore ConceptsData and StateTestingBuilding and Deployment
Debates

Guía de Flutter · 5/6

Testing

Por ahora, este capítulo solo está disponible en inglés.

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);
  });
}
¿Tienes preguntas sobre este capítulo?
Capítulo anteriorData and StateCapítulo siguienteBuilding 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 comentarios

Comentarios destacadosMás recientes primero

Iniciar sesión · Inicia sesión para dejar un comentario.