Ask a Question

Setting QA/STG environment in Keyword tests

QAStarter
Occasional Contributor

Setting QA/STG environment in Keyword tests

Hello,

How do I set the environment setting URL so I don't have to edit the keyword test or change the variable url every time.

 

I want to set the Environment to QA or STG and automatically pick up the right URLs and run the test against it.

 

I have tried Project variable but the problem is I have to change the default Environment URL every time.

I think if there is a way to save the QA/STG URLs somewhere and associate it to Environment variable so if I say QA it picks up QA URL

QAStarter_0-1679673750840.png

in script testing I can easily associate the environments using if statement but with Keyword test I am having a problem

 

Best,

12 REPLIES 12
rraghvani
Trusted Contributor

Do you mean, how to set project variables using keyword test?

tristaanogre
Esteemed Contributor

If statements are available in Keyword tests as well.  You should be able to use the same logic you're using in code to select the appropriate environment.

Can you share a screenshot of the script code and the keyword code you're attempting?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
QAStarter
Occasional Contributor

this is how its added for script testing. in the rest of the project we can use URL and not worry about changing anything manually in the script. 

QAStarter_0-1679676129913.png

I did try the If...Then statement, I could not get it to work

 

QAStarter
Occasional Contributor

this is how its added for script testing. in the rest of the project we can use URL and not worry about changing anything manually in the script. 

QAStarter_1-1679676432222.png

 

I did try the If...Then statement, I could not get it to work

rraghvani
Trusted Contributor

It will be something like this,

rraghvani_0-1679677753312.png

You can use /PrjVar to update the variable at the command line, without having to modify the project variable.

QAStarter
Occasional Contributor

Thank you, that seems to work as long as the URL defined in NamesMapping matches the If statement that is true. is it possible to have Names Mapping also pickup from the If..Then result?

rraghvani
Trusted Contributor

I don't quite understand "is it possible to have Names Mapping also pickup from the If..Then result?" ?

QAStarter
Occasional Contributor

The URL which is in NameMapping, this is added automatically when recording 

QAStarter_0-1679683438382.png

 

You generally don't change the NameMapping during the test, you change the test to match the name mapping.

 

You said the If Then statement wasn't working for you. What happened when you tried it?


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
cancel
Showing results for 
Search instead for 
Did you mean: