casperjs test cow-test.js undefined不是评估casper.test.begin的函数

And*_*lec 4 testing undefined casperjs

我正在使用Windows.我正在尝试使用CasperJS测试框架.

我正在使用phantomjs版本1.9.0.我正在使用casperjs版本1.0.2.

我跑的时候

casperjs test cow-test.js
Run Code Online (Sandbox Code Playgroud)

返回以下内容.

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();
})')
Run Code Online (Sandbox Code Playgroud)

如果我只做

console.log(casper.test);
Run Code Online (Sandbox Code Playgroud)

返回以下内容

[object Object]
Run Code Online (Sandbox Code Playgroud)

如果我只做

console.log(casper.test.begin);
Run Code Online (Sandbox Code Playgroud)

返回以下内容.

undefined
Run Code Online (Sandbox Code Playgroud)

我该怎么办?我是否应该从特定目录运行"casperjs test cow-test.js"?

或者是其他东西?

谢谢Andre Andre_Mikulec@Hotmail.com

Ili*_*lin 7

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