搜索插件、代码仓与 APP 分类

插件详情v1.33.0

test

一个功能齐全的库,用于在各个平台上编写和运行 Dart 测试。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1410万
喜欢数
629
Pub 分数
150

安装插件

flutter pub add test

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

测试包是一个全面的库,用于在多个平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上编写和运行 Dart 测试。它提供了一套丰富的工具,支持单元测试、集成测试和 widget 测试,涵盖异步测试、模拟和测试报告功能。由 dart.dev 开发,该包与 Flutter 和 Dart 工具链无缝集成,使开发者能够通过自动化测试工作流程保持高水平的代码质量。

适合场景

  • 单元测试 Dart 代码
  • 集成测试 Flutter 应用
  • Flutter 中的 Widget 测试
  • 跨平台测试执行
  • 自动化 CI/CD 测试
  • 在测试中模拟依赖项

主要特点

  • 支持 async 和 await 测试
  • 内置匹配器和期望
  • 测试隔离与设置/清理
  • 模拟框架集成
  • 详细的测试报告
  • 跨平台兼容性

适合对象

  • Flutter 开发者
  • Dart 库作者
  • CI/CD 流水线集成商
  • 团队在实践测试驱动开发
  • QA工程师自动化测试套件

使用建议

  • 需要理解 Dart 测试约定
  • 可能需要额外的包来实现复杂的模拟
  • 在大型项目中,测试设置可能会变得复杂
  • 不适用于最终用户测试场景
  • 有限的GUI用于测试执行

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Dart CI OpenSSF Scorecard

What's here?

Welcome! package:test is the standard testing library for Dart and Flutter. If you have questions about Dart testing, please see the docs for package:test. package:test_api and package:test_core are implementation details and generally not user-facing.

package:checks is a relatively new library for expressing test expectations. It's a more modern version of package:matcher and features a literate API.

Packages

Package Description Issues Version
checks A framework for checking values against expectations and building custom expectations. issues pub package
fake_async Fake asynchronous events such as timers and microtasks for deterministic testing. issues pub package
matcher Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases. issues pub package
test A full featured library for writing and running Dart tests across platforms. issues pub package
test_api The user facing API for structuring Dart tests and checking expectations. pub package
test_core A basic library for writing tests and running them on the VM. pub package
test_descriptor An API for defining and verifying files and directory structures. issues pub package
test_process Test processes: starting; validating stdout and stderr; checking exit code. issues pub package

所属分类

依赖

依赖清单 25 项

源码仓库

使用此插件的项目