我正在使用 Protractor 通过非角度应用程序进行端到端测试。
所以一旦我在 protractor.conf.js 文件中编写为-
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is called.
specs: ['example_spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
那么它对我来说效果很好。
之后我做了一些改变,比如-
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is called.
specs: ['example_spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
然后它从带有端口的 selenium 服务器启动,测试用例成功运行。
所以我的问题是-这两种方式有什么区别?我知道当我们使用directConnect:true
,它不启动selenium服务器,然后直接使用chrome驱动程序,并且测试用例运行得比其他方式更快?
当 Protractor 可以在没有 Selenium 服务器的情况下进行测试时,为什么我们需要它?
selenium 服务器在量角器测试中做什么?