Forum Discussion

Riztac's avatar
Riztac
New Contributor
6 years ago

How to define dynamic variable in testComplete like we do in Soapui with $ sign "${#Var2}"

Hi,

 

Ive got two project level variables in TestComplete:

 

Var1 = ${#Var2} <--- ???

and

Var2 = 123456789

 

using Log.Message(Project.Variables.Var1) should evaluate to "123456789" but it just prints ${#Var2} as string.

is there any way we can make it dynamic?

 

in particular I want to update the value of a variable defined in "ReadyAPI-Test Edit-Properties" page with the value from project's local or persistent property value. The reason is that this variable is not accessible using script, the only option available is to execute i.e. ReadyAPI.TestCase.Execute()

Thanks

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Keep in mind, IIRC, ReadAPI/SOAPUI uses Groovy Script...  TestComplete does not.  So, if the $ syntax of dynamic variables is a Groovy Script specific thing... it's not going to work.

     

    However, something you CAN try is the native evaluate method for whatever code language you're using in TestComplete.  For example, JavaScript has "eval".  So, you can TRY (but I don't know if it will work)

     

    Log.Message(eval(Project.VariablesVar1))
    • Riztac's avatar
      Riztac
      New Contributor

      Thanks for your suggestion, it dident work either. raised ticket with Smartbear.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        As mentioned, I doubted it would work.  There is no Groovy Script in TestComplete so attempting to use syntax that is Groovy Script specific will not work with TestComplete.  I am unaware of that particular syntax being valid in any of the supported code languages in TestComplete.

         

        Keep in mind, also, that TestComplete is simply acting as the launcher for your SoapUI tests.  It doesn't, itself, run the tests... it does a call out to SoapUI for the execution.  So, anything you want done that is specific to SoapUI you need to configure and implement in SoapUI.