我正在使用Windows。 我正在尝试使用CasperJS测试框架。
我正在使用phantomjs版本1.9.0。 我使用的是casperjs版本1.0.2。
当我跑步时
casperjs test cow-test.js
返回以下内容。
Test file: cow-test.js
FAIL TypeError: 'undefined' is not a function (evaluating 'casper.test.begin')
# type: uncaughtError
# error: "TypeError: 'undefined' is not a function (evaluating 'casper.test.begin')"
TypeError: 'undefined' is not a function (evaluating 'casper.test.begin')
C:/cow-test.js:16
FAIL 1 tests executed in 0.116s, 0 passed, 1 failed.
Details for the 1 failed test:
In cow-test.js:0
uncaughtError: TypeError: 'undefined' is not a function
(evaluating 'casper.test.begin')
var cow = {};
test.assert(cow);
test.done();
})')
如果我只做
console.log(casper.test);
返回以下内容
[object Object]
如果我只做
console.log(casper.test.begin);
返回以下内容。
undefined
我该怎么办? 我是否应该从特定目录运行“casperjs test cow-test.js”?
或者,别的?
谢谢, 安德烈 Andre_Mikulec@Hotmail.com
答案 0 :(得分:7)
您使用稳定版本的casperjs而网站上的文档和代码适用于开发version 1.1
答案 1 :(得分:4)
“test”API仅在casperJs 1.0.2引入后才会升级 使用这种语法。
要获得支持,CasperJs有一个邮件列表:https://groups.google.com/forum/#!forum/casperjs
希望它有所帮助,