Javascript 无法运行示例实习生自动化测试
我尝试运行简单的实习生自动化测试示例,如下所示:Javascript 无法运行示例实习生自动化测试,javascript,automation,intern,Javascript,Automation,Intern,我尝试运行简单的实习生自动化测试示例,如下所示: define([ 'intern!object', 'intern/chai!assert', 'require' ], function (registerSuite, assert, require) { registerSuite({ name: 'index', 'Greeting': function () { return this.remote
define([
'intern!object',
'intern/chai!assert',
'require'
], function (registerSuite, assert, require) {
registerSuite({
name: 'index',
'Greeting': function () {
return this.remote
.get(require.toUrl('index.html'))
.setFindTimeout(5000)
.findByCssSelector('body.loaded')
.findById('nameField')
.click()
.type('Elaine')
.end()
.findByCssSelector('#loginForm input[type=submit]')
.click()
.end()
.findById('greeting')
.getVisibleText()
.then(function (text) {
assert.strictEqual(text, 'Hello, ElaineqW!', 'Greeting should be displayed when the form is submitted');
});
}
});
});
这应该只是一件简单的事情。然而,当我试图通过命令行运行配置时,我遇到了一个问题
下面是我的配置代码片段:
// Non-functional test suite(s) to run in each browser
suites: [ 'C:/internKE/tests/functional/index' ],
// Functional test suite(s) to run in each browser once non-functional tests are completed
functionalSuites: [ 'C:/internKE/tests/functional/index' ],
我不知道我做错了什么,这样测试就不会被编译了
谢谢您不能将功能测试加载到单元测试系统中。请注意您粘贴的代码中的注释,该注释表示“非功能性”。在非功能测试中,没有
this.remote
另外,请注意模块ID不是文件系统路径
您的配置应为:
// Non-functional test suite(s) to run in each browser
suites: [],
// Functional test suite(s) to run in each browser once non-functional tests are completed
functionalSuites: [ 'tests/functional/index' ],
谢谢,我现在设法让它运行,但是,它似乎只在0/0测试失败时返回测试。我故意在测试中做出错误的场景,但它仍然会产生相同的结果。谢谢