我目前只使用Chrome(驅動程序)進行測試。我想用Firefox和Safari來測試它。一個接一個,它不能平行。在多個瀏覽器上運行測試(按順序)
這裏是我的一口任務開始測試:
gulp.task('test', function() {
return gulp.src('*test/features/*').pipe(cucumber({
'steps': '*test/features/steps/*.js'
}));
});
簡單功能文件:
Feature: UI
Testing UI
Scenario: Check the title of the page
When I open the homepage
Then I should see "Test - IntApp" in the title
而且步文件:
const chrome = require('selenium-webdriver/chrome');
const webdriver = require('selenium-webdriver');
const assert = require('assert');
module.exports = function() {
let options = new chrome.Options();
options.addArguments('start-maximized');
var driver = new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.build();
this.When('I open the homepage', function (done) {
driver.get('http://intapp.dev/').then(done);
});
this.Then('I should see "Test - IntApp" in the title', function (done) {
driver.getTitle().then(function(title) {
assert.equal(title, "Test - IntApp");
}).then(done);
});
this.registerHandler('AfterFeatures', function (features) {
return driver.quit();
});
};
我想着也許我可以通過作爲參數的瀏覽器的名字從某種程度上來源於吞噬任務,但它似乎不可能。
*一前一後,它不能並行*是相當不尋常的要求。出於好奇,爲什麼? –
@AlexBlex服務器控制一些定製硬件,以便外部硬件的狀態與每次測試所期望的相同,測試需要按順序運行。 – Cornwell