dan*_*nte 3 testing debugging integration-testing dart flutter
当我运行集成测试时,测试失败并出现以下错误:
\n[+1358 ms] flutter: \xe2\x95\x90\xe2\x95\x90\xe2\x95\xa1 EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK \xe2\x95\x9e\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\n[ ] flutter: The following assertion was thrown running a test:\n[ ] flutter: The value of a foundation debug variable was changed by the test.\n[ ] flutter: \n[ ] flutter: When the exception was thrown, this was the stack:\n[ ] flutter: #0 debugAssertAllFoundationVarsUnset.<anonymous closure> (package:flutter/src/foundation/debug.dart:30:7)\n[ ] flutter: #1 debugAssertAllFoundationVarsUnset (package:flutter/src/foundation/debug.dart:32:4)\n[ ] flutter: #2 TestWidgetsFlutterBinding._verifyInvariants (package:flutter_test/src/binding.dart:834:12)\n[ ] flutter: #3 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:821:7)\n[ ] flutter: <asynchronous suspension>\n[ ] flutter: \n[ ] flutter: The test description was:\nRun Code Online (Sandbox Code Playgroud)\n当我调试异常时,我发现这个检查点失败了:
\ndebugDefaultTargetPlatformOverride != null // it is TargetPlatform.macos\nRun Code Online (Sandbox Code Playgroud)\n我不知道如何处理这个错误。该值可以在任何地方更改,这会使我的测试失败。\n有任何解决方案或解决方法吗?
\n有同样的情况,我的解决方案是:
在完成测试之前,您必须将 TargetPlatform 设置为 null
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
// HERE RUN YOUR TESTS AND CHECKS
debugDefaultTargetPlatformOverride = null;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1319 次 |
| 最近记录: |