问题
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.
I tried params as mentioned in this post https://moduscreate.com/blog/protractor_parameters_adding_flexibility_automation_tests/
in Config.js
params: {
buildNumber:'xyz'
}
for running protractor :
protractor config/config.js --parameters.buildNumber= 1.1 --disableChecks"
using :
browser.params.buildNumber
This gives buildnumber =xyz and not 1.1
Could you please help me here
Update:
Sorry forgot to mention that I am using browser.params.buildNumber
in after hook of cucumberjs
.
回答1:
you should use pattern: --params.xxx
in cmd line, rather than --parameters.xxx
.
In your case, should be: protractor config/config.js --params.buildNumber=1.1 --disableChecks
Note: Don't insert blank space around the =
, like --params.name = value
, or --params.name= value
.
If the parameter value has blank space, you should use double quote to wrapper it, like --params.name="I like to xxx"
来源:https://stackoverflow.com/questions/50241305/pass-jenkins-build-number-to-protractor-for-saucelabs