简体   繁体   中英

Trouble Passing A User Name and Password Into Robot Framework Command Line Variable

I want to run tests against a qa environment as well as production. At the moment these are hard coded URLS. But I want to set which environment to run in the command line. Our QA environment has a user name and password pop up when going to the URL. To get through this quickly I have hardcoded the values in the url like so.

https://username:password@qa.mywebsite.com

This works perfectly as is. Now I want to be able to run the tests against the QA or Production environment set from the command line. I have a variable called ${ENV} which I am passing the values into. So the URL now looks like this

https://${ENV}.mywebsite.com

I run the following command in the command line and it works well.

python -m robot --outputdir results -v ENV:prod Tests/mytests/

or

python -m robot --outputdir results -v ENV:qa Tests/mytests/ 

And this works and enters the correct URL when the browser opens. The problem I have is that it wont let me enter the username and password into the url the way I have been doing. So I have tried the following in the command line

python -m robot --outputdir results -v ENV:user:password@qa Tests/mytests/

It goes to the qa site, but the user name and password are not in the url and therefore do not fill in.

Any ideas why its not passing my user and password into the URL and how I can fix it?

All help greatly appreciated.

It was a simple error on my part. My URL in the test had http and not https. Once I add the s all worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM