我有一个使用dart:html
的网页应用,想要编写单元测试。
我在Windows上使用WebStorm并希望能够测试这样的内容:
@TestOn("dartium")
import 'package:test/test.dart';
import 'package:web_app/foo.dart';
main(){
test("test foo", _test_foo);
}
_test_foo(){
var foo = new Foo();
foo.addElement();
foo.addTextToElement("hello");
expect(foo.getTextFromElement(),"hello");
}
现在,当我运行pub run test -pdartium
时,我收到如下错误消息:
Failed to load "test\foo_test.dart":
Failed to run Dartium: The system cannot find the file specified.
Command: dartium.exe --user-data-dir=C:\Users\user\AppData\Local\Temp\dart_test_66df76b7-2dd7-11e8-83c1-cc3d825d91e7 http://localhost:65266/PmlVxFvYDEl8oBlmBmzs7uOKQlQWc51Y/packages/test/src/runner/browser/static/index.html?managerUrl=ws%3A%2F%2Flocalhost%
3A65266%2FPmlVxFvYDEl8oBlmBmzs7uOKQlQWc51Y%2F0&debug=false --disable-extensions --disable-popup-blocking --bwsi --no-first-run --no-default-browser-check --disable-default-apps --disable-translate.
有没有关于如何正确执行此操作的文档?
答案 0 :(得分:1)
如果您chrome.exe
dart-sdk/bin
但dartium.exe
chrome.exe
dartium.exe
,则可以将coords += [int(x),int(y)]
复制或重命名为coords = []
coords += [1,1]
coords += [2,2]
print(coords)
[1, 1, 2, 2]