[英]How to run unittest with IDEA dart plugin?
IDEA dart-plugin provide an option as "run as DartUnit": IDEA dart插件提供了“作为DartUnit运行”选项:
I wrote a simple test in unit.dart : 我在unit.dart中编写了一个简单的测试:
import "package:unittest/unittest.dart";
main() {
test("aaa", () {
expect(1, 1);
});
}
Then I choose this DartUnit
option. 然后,我选择此
DartUnit
选项。 But it reports I misses something: 但是它报告我错过了一些东西:
Error running Test: unit.dart: Missing library statement in unit.dart
How to fix it? 如何解决?
I found the reason: I need to declare a library in the code, any name is OK. 我找到了原因:我需要在代码中声明一个库,任何名称都可以。
library aLirary;
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.