Passing variables on the command line to check the cucumber

I am trying to keep usernames and passwords for the cucumber project out of version control.

Is there a way to manually pass variables on the command line, such as usernames and passwords, to a cucumber script?

My backup plan was to put them in a YML file and add this file to gitignore so that they do not fall into version control.

+4
source share
2 answers

So, I saw your comments with Tin Man, and the answer is: Yes.

cucumber PASSWORD=my_password

PASSWORD is set as an environment variable, and you can use its value by referring to it as ENV['PASSWORD']. For instance,browser.text_field(:id => 'pwd').set ENV['PASSWORD']

. , , , , . , , firefox, firefox cucumber.yml BROWSER_TYPE , firefox. (BROWSER_TYPE) , . firefox, Firefox.

, -

  • . firefox
  • firefox cucumber.yml. , BROWSER_TYPE firefox.
  • , BROWSER_TYPE .

-

  • cucumber -p firefox
  • cucumber.yml : firefox: BROWSER_TYPE=firefox PLATFORM=beta

  • -

    @browser = Watir::Browser.new ENV['BROWSER_TYPE']

, , , .

+10

:

1) , (Mac Unix), ~, , . " blah" Cucumber, @username = testcred get #{credname} username @username = testcred get #{credname} password , , - - , . . https://github.com/usethedata/credstore.git, github ( )

2) Lastpass , . LastPass, . credstore , - lastpass ( ), lastpass . , Lastpass, , .

0

Source: https://habr.com/ru/post/1534893/


All Articles