flutter - 一个接一个地运行相同的颤振测试。1成功1失败
问题描述
我从创建 Flutter 测试开始,遇到了 2 个完全相同的测试的问题,但只有 1 个成功。
要点: https ://gist.github.com/Mooibroek/bd6c02e5b56e4b03409ee1839a2e0b23
第二个失败并出现此错误:
The following TestFailure object was thrown running a test:
Expected: exactly one matching node in the widget tree
Actual: ?:<zero widgets with widget matching predicate (Closure: (dynamic) => bool) (ignoring
offstage widgets)>
Which: means none were found but one was expected
When the exception was thrown, this was the stack:
#4 main.<anonymous closure> (file:///Users/nicepants/Projects/flutter/generic_flutter/test/register_test.dart:38:5)
<asynchronous suspension>
#5 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:108:25)
第 38 行是我们断言是否找到按钮的行。我在 GIST 中添加了大部分相关代码,如果您需要更多,请告诉我。
是否有可能从之前的测试中留下一些隐藏状态?或者这不应该工作。
解决方案
推荐阅读
- java - 将 byte[] 转换为 MultipartFile
- python - 使用 pivot_table 拆分列
- excel - 从 Private Sub workbook_open() 上的输入声明公共变量
- javascript - 我可以在 nodejs 中模仿全局窗口对象吗?
- php - Laravel,Yajra Datatable,如果 y 那么如何返回 Yes else No
- python - 在多列上使用 GroupBy 创建新的滚动平均列
- asp.net - .NET HttpClient sendAsync() 特别是第二个请求超时
- java - 在 DoFn(apache crunch) 中传递一个映射(或并发哈希映射)
- axapta - 按日期比较更改行颜色
- php - 为什么我的自定义帖子类型仅针对我的自定义用户角色显示?