Forum Discussion

jawed's avatar
jawed
Occasional Contributor
8 years ago

How to concatenate URL and use the variable/parameter for common part of url

Hi,

I have recorded different Keyword tests for different functionality. like for login funcationality i have created login keyword test and recorded script and for logout created logout keyword test and so on. I want to parameterized the URL which had a common part. ex: http://abc.com:8080/login,  http://abc.com:8080/logout. I want to do this because whereever server changes i dont need to change everytime in the script just i will change the value of parameter/variable.

4 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

    You can store the base URL in the variable, say -

     

    baseURL = "http://abc.com:8080/"

     

    Then use it in your test as a Code Expdession parameter like: 

     

    Project.Variables.baseURL + "login"

     

     

  • you read the URL from property file using groovy and than replace the part that is changing on basis of some condition before setting the final URL.