简体   繁体   English

如何以“普通” Dart应用程序运行unittest

[英]How to run unittest as 'normal" Dart app

I'm trying to write tests before implementation. 我正在尝试在实现之前编写测试。 Everything is OK till i have exception like "no such method". 一切正常,直到我有类似“没有这种方法”的例外。 Running code in html configuration (useHtmlConfiguration()) i have little informations about exception :/ . 我在html配置(useHtmlConfiguration())中运行代码,我对异常:/的了解很少。

QUESTION: Is it possible to run selected test "solo_test" in configuration that lets me debug exception like in "normal run" 问题:是否可以在配置中运行选定的测试“ solo_test”,使我可以像在“正常运行”中那样调试异常

What type of Exceptions are you throwing? 您要抛出什么类型的异常?

If you are throwing a String or an Exception, you will not see any stack traces until this commit gets into the unittest package. 如果抛出String或Exception,则直到此提交进入unittest程序包,您才会看到任何堆栈跟踪。

https://code.google.com/p/dart/source/detail?r=30322 https://code.google.com/p/dart/source/detail?r=30322

Until then, make sure you throw instances (or subclasses) of Error. 在此之前,请确保您抛出Error的实例(或子类)。

For you: http://api.dartlang.org/docs/channels/stable/latest/dart_core/UnimplementedError.html 为您服务: http : //api.dartlang.org/docs/channels/stable/latest/dart_core/UnimplementedError.html

Then you will see the stack trace data. 然后,您将看到堆栈跟踪数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM