本文介绍了量角器-描述未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用量角器js进行测试.当我尝试使用
I am using protractor js for testing. When i try to run the test case using
我的conf.js
// An example configuration file.
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
baseUrl: 'http://localhost:4000',
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
args: ['--test-type']
}
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['*_spec.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
我收到参考错误
> D:\cronj\gxp\10-09-2014\e2e\main\test.spec.js:3
describe('Login page', function() {
^
ReferenceError: describe is not defined
at Object.<anonymous> (D:\cronj\gxp\10-09-2014\e2e\main\test.spec.js:3:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at ConfigParser.addFileConfig (C:\Users\Cronj4\AppData\Roaming\npm\node_modu
les\protractor\lib\configParser.js:171:20)
at Object.init (C:\Users\Cronj4\AppData\Roaming\npm\node_modules\protractor\
lib\launcher.js:30:18)
at Object.<anonymous> (C:\Users\Cronj4\AppData\Roaming\npm\node_modules\prot
ractor\lib\cli.js:129:23)
有没有人可以帮助使用量角器运行测试用例?
Could any one help to run the test case using protractor?
推荐答案
您应该启动配置文件而不是spec文件.
You should launch your config file instead of your spec file .
protractor protractor.config.js
在配置文件中,"specs"属性是一个全局模式阵列,它将在测试环境中注入您的spec文件,并为objets定义了正确的定义,例如"describe"或"it".
In the config file, the "specs" attribute is a glob pattern array that will inject your spec files within the test environment, with the correct definition for objets like "describe" or "it".
这篇关于量角器-描述未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!