Reuse GlobalVariable inside Profile

Hi,
i have create different profile, but it’s possibile inside the same profile reuse some variable?

example?
immagine

this is the script

<?xml version="1.0" encoding="UTF-8"?>
<GlobalVariableEntities>
   <description></description>
   <name>default</name>
   <tag></tag>
   <defaultProfile>true</defaultProfile>
   <GlobalVariableEntity>
      <description></description>
      <initValue>'http://localhost:8080'</initValue>
      <name>host</name>
   </GlobalVariableEntity>
   <GlobalVariableEntity>
      <description></description>
      <initValue>'${GlobalVariable.host}/login'</initValue>
      <name>url_login</name>
   </GlobalVariableEntity>
</GlobalVariableEntities>

i don’t think it is possible.
what do you want to achieve?

you can have a variable for host and one for endpoint/path and build the final url in the testcase by concatenating them

thansk for your answer. yes i can and now i do it, but i have in same web application about 30 endpoint and 90% begin with the same host.

try to image this scenario, we have 30 endpoint and we have 4 machines and each machine have one profile…it’s very hard mantain this profiles scenario

profile_1
host=http://localhost
url_login=http://localhost/login

profile_4
host=http://192.168.1.4
url_login=http://192.168.1.4/login

Why not call ${GlobalVariable.host}/login on your test case/keywords instead of GlobalVariable.url_login ?

sorry Helen, i not understand you. The problem is not use global var in test case, but in profile. see the first image.

GlobalVariable.url_login it’s not resolved in test case if i try use ${GlobalVariable.host}/login in profile composition

@luca_bottoni that’s why you have to plan carefully your project approach before is too late :slight_smile:

now … have fun with find/replace
or … just pass the full string to the url_login variable if profiles to edit are less than testacases.
and next time think twice and do it once

1 Like

I see, but it’s impossible.
Create 30 endpoints times 4 profiles (120 GlobalVariables !!) when the only change is the host is not the best idea. In my opinion, your 30 GlobalVariables for endpoints are useless, because you can directly call ${GlobalVariable.host}/something on your test case

ok, how can you do it in this screen?

Use the Value Type=Binary

1 Like

Or switch in script view and set navigateToUrl(GlobalVariable.host + "/login") or navigateToUrl("${GlobalVariable.host}/login")

1 Like

yeah, this work fine!!

Great Gerard_van_der_Winke…fantastic