Forum Discussion

QAStarter's avatar
QAStarter
Occasional Contributor
11 months ago

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

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

 

Best,

12 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    It will be something like this,

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

    • QAStarter's avatar
      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's avatar
    rraghvani
    Champion Level 3

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

    • QAStarter's avatar
      QAStarter
      Occasional Contributor

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

       

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        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?

  • tristaanogre's avatar
    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?

    • QAStarter's avatar
      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. 

       

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

  • QAStarter's avatar
    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. 

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