繁体   English   中英

casperjs测试cow-test.js未定义不是评估casper.test.begin的函数

[英]casperjs test cow-test.js undefined not a function evaluating casper.test.begin

我正在使用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

您使用的是casperjs的稳定版本,而网站上的文档和代码仅适用于开发版本1.1

仅从casperJs 1.0.2开始才引入“测试” API,您应该升级以使用此语法。

为了获得支持,CasperJs有一个邮件列表: https ://groups.google.com/forum/#!forum/casperjs

希望它会有所帮助,

暂无
暂无

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

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