将Jenkins内部版本号传递给SauceLabs的量角器 [英] Pass Jenkins build number to Protractor for SauceLabs
问题描述
我正在通过Jenkins运行量角器测试用例,并使用SauceLabs作为执行环境.我正在使用Protractor-Cucumber-Framework.我想从Jenkins传递内部版本号,以便可以将其传递给SauceLabs来组织我的测试执行结果.
I am running protractor test cases through Jenkins, and using SauceLabs as execution environment. I am using Protractor-Cucumber-Framework. I want to pass build number from Jenkins so that I can pass same to SauceLabs to organize my test execution results.
我尝试了这篇文章中提到的params https://moduscreate.com/blog/protractor_parameters_adding_flexibility_automation_tests/
I tried params as mentioned in this post https://moduscreate.com/blog/protractor_parameters_adding_flexibility_automation_tests/
在Config.js中
in Config.js
params: {
buildNumber:'xyz'
}
用于量角器:
protractor config/config.js --parameters.buildNumber= 1.1 --disableChecks"
使用:
browser.params.buildNumber
这给出了buildnumber = xyz而不是1.1
This gives buildnumber =xyz and not 1.1
您能在这里帮我吗
更新:
抱歉忘了提到我在cucumberjs
的钩子之后使用了browser.params.buildNumber
.
Update:
Sorry forgot to mention that I am using browser.params.buildNumber
in after hook of cucumberjs
.
推荐答案
您应该在cmd行中使用模式:--params.xxx
,而不是--parameters.xxx
.
you should use pattern: --params.xxx
in cmd line, rather than --parameters.xxx
.
在您的情况下,应为:protractor config/config.js --params.buildNumber=1.1 --disableChecks
In your case, should be: protractor config/config.js --params.buildNumber=1.1 --disableChecks
注意:请勿在=
周围插入空格,例如--params.name = value
或--params.name= value
.
Note: Don't insert blank space around the =
, like --params.name = value
, or --params.name= value
.
如果参数值具有空格,则应使用双引号将其包装,例如--params.name="I like to xxx"
If the parameter value has blank space, you should use double quote to wrapper it, like --params.name="I like to xxx"
这篇关于将Jenkins内部版本号传递给SauceLabs的量角器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!