如何解决如何运行多个 chrome 实例以在量角器中按单个特征文件的顺序运行所有场景
我希望所有场景都在浏览器的多个实例中运行,我尝试在功能中提供最大实例,但它总是打开 1 个 chrome 实例并一一运行测试。我希望测试在多个 chrome 实例中运行。我在这里做错了什么?
当前配置文件:
exports.config = {
allScriptsTimeout: 800000,getPageTimeout: 400000,specs: [
'./src/cucumber/features/**/memberSearch.feature',],params: {
pageObjects: require['./src/cucumber/pages/**/*.po.ts'],customTimeout: 5000,url:{
dev: "https://dev.com/login",test: "https://test.com/login",stage: "https://stage.com/login",local: "http://localhost:4200",}
},capabilities: {
browserName: 'chrome',//acceptInsecureCerts: true,shardTestFiles: true,maxInstances: 4,chromeOptions: {
args: ['--no-sandBox','--disable-setuid-sandBox','--disable-gpu','--window-size=800x600'],},directConnect: true,baseUrl: 'https://dev.com/',useAllAngular2AppRoots: true,framework: 'custom',frameworkPath: require.resolve('protractor-cucumber-framework'),cucumberOpts: {
compiler: 'ts:ts-node/register',require: ['./src/cucumber/steps/**/*.steps.ts','./src/cucumber/utils/**/*.util.ts'],format: 'json:./reports/cucumber_report.json',monochrome: true,strict: true,tags: '@MemberSearch',}
特征文件:
@MemberSearch
Feature: Search a member
@CompletedTodo
Scenario: See all the assessments associated with the member
Given Enter the URL
When click on the MemberID radio Button
And Type the memberID "ABCD" first time
And Click the Search Button first time
@FilterTitle
Scenario: Validate the Filters With Title field
Given Enter the URL
When click on the MemberID radio Button
And Type the memberID "ABCD"
Then Click the Search Button
@FilterTimeFrame30
Scenario: Validate the Filters with time FilterTimeFrame 30
Given Enter the URL
When click on the MemberID radio Button
And Type the memberID "ABCD"
Then Click the Search Button
Then Show the message "No records to display"
@FilterTimeFrame60
Scenario: Validate the Filters with time FilterTimeFrame 60
Given Enter the URL
When click on the MemberID radio Button
And Type the memberID "ABCD"
Then Click the Search Button
@FilterTimeFrame90
Scenario: Validate the Filters with time FilterTimeFrame 90
Given Enter the URL
When click on the MemberID radio Button
And Type the memberID "ABCD"
Then Click the Search Button
Then Show the message "No records to display"
And Click the Clear Button
@FilterTimeFrame365
Scenario: Validate the Filters with time FilterTimeFrame 365
Given Enter the URL
When click on the MemberID radio Button
And Type the memberID "ABCD"
Then Click the Search Button
Then Show the message "No records to display"
And Click the Clear Button
When Type the memberID "40988"
我希望所有场景都在多个浏览器实例中运行,我曾尝试在功能中提供最大实例,但它始终打开 1 个实例并逐一运行测试。我想测试在多个实例中运行。我在这里做错了什么?
解决方法
您可以尝试在 npm/量角器脚本中使用“--parallel=**”(例如:cucumber-js ./features --parallel=5)。将 ** 替换为您需要的并行实例数。配置文件中的“maxInstances”是指浏览器应该启动的最大实例数,这并不意味着默认会打开4个实例,请根据--parallel count进行更改。
--parallel incucumber-js 运行相同特征文件的每个场景,并且一个场景大纲的每个示例并行触发。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。