Pass Jenkins build number to Protractor for SauceLabs

[亡魂溺海] 提交于 2019-12-24 06:38:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!