How can I concatenate the URL with the endpoints? into variable

Hello! Can anyone tell me how can I concatenate the URL (which I already converted into a variable) with the endpoints? Like in postman, where you have the base URL and the endpoints. Is there any way that it can work the same?
Thank you in advance for your time!

Hi,

not sure what you want to use that for? API Testing or Web Testing?

For Web Testing you can use it something like that:

WebUI.openBrowser(GlobalVariable.URL+GlobalVariable.Endpoint)

i didnt test that exact setup but im using something similar where i attach a Variable to a String.

Regards

1 Like

Yes, for Web Testing.
Thank you! I will try.

When I run the test it only shows me the URL without the EndPoint…any ideas why?

do you have an EndPoint global variable defined?
the above answer was just an example how to concatenate variables, if any of them does not exist … what would you expect? mici la gratar fara carbuni?

provided both globals are existing you can try also:

WebUI.openBrowser("${GlobalVariable.URL}${GlobalVariable.Endpoint})

OR

WebUI.openBrowser("${GlobalVariable.URL}/${GlobalVariable.Endpoint})

depending how you defined.

LE: also, you may want to avoid using ‘URL’ (with caps) for a variable name, this is an internal java class. use url or base_url or mama_tata instead

I got it defined. I found out what was the issue. I had the URL with / at the end and also I had / at endpoint, so it did not work.

1 Like