【发布时间】:2013-06-09 19:37:34
【问题描述】:
目前还没有太多关于 Dart 中的 web-ui 测试的文档。有两种方法可用:a) 通过 Chrome 的 DumpRenderTree 运行或 b) 由 loading the app as is and running the test code on top of it 组成的技巧。对于琐碎的情况,第一个选项似乎有点乏味。所以后一种选择——在我的例子中,它在加载组件时不起作用。
文件结构如下:
test/
main_test.html
main_test.dart
web/
main.html
app.html
(all the files are listed in this gist)
下面的测试集挂在第二步。
main() {
useShadowDom = true;
test('Inline element is initially present.', () {
var story = () => expect(query('#hdr'), isNotNull);
Timer.run(expectAsync0(story));
});
test('Component is loaded.', () {
var story = () => expect(query('#globe'), isNotNull);
Timer.run(expectAsync0(story));
});
}
如何加载应用组件?更广泛地说,还有另一种测试 Web 组件的方法吗?
【问题讨论】:
标签: unit-testing dart dart-webui