Forum Discussion

rasmus's avatar
rasmus
New Contributor
5 years ago

Environment variable in persistent variables declaration

I want to use a Windows environment variable in the persistent variables section of a keyword test.

E.g. Something line InstallFolder is %TEMP%\MyAppLocation.

Using the variable InstallFolder works fine when defining the tested apps. E.g MyApp is $(InstallFolder)\MyApp.exe. The application starts as expected.

 

But when adding a check in JavaScript to verify if the InstallFolder folder exists, the check fails because the variable %TEMP% is not expanded.

E.g.  aqFileSystem.Exists(Project.Variables.InstallFolder) returns false because Project.Variables.InstallFolder returns the string %TEMP%\MyAppLocation and not <Where ever my temp folder is>\MyAppLocation.

 

How can I fix this?

 

I'm new to TestComplete. So if my question may be a little bit unprecise. Hope it is not too confusing ...

 

TestComplete 14.40

Windows 10

Scripting language JavaScript

  • Let's see the actual code from both calls.  It's probably just a syntax difference but we need to see it in order to help.

    • rasmus's avatar
      rasmus
      New Contributor

      What's the best way to show the code? 

      • Marsha_R's avatar
        Marsha_R
        Moderator

        You can copy paste or insert a screenshot.  Up to you.