Ask a Question

Save full path to pjs folder so its machine independent

KCarper
Occasional Contributor

Save full path to pjs folder so its machine independent

I test several products that are launched from different places such as a script called by bamboo, a test started from QAComplete or running the TestComplete app on my PC. 

The drives, paths and filenames are different for each project on our PCs as well as those on our servers.  Examples follow.

  1. PC1 proj1 = C:\BASE\1_H\1H\x1.pjs
  2. PC1 proj2 = C:\BASE\1_H\1H\y1.pjs
  3. PC1 proj3 = C:\BASE\2_H\2H\z1.pjs
  4. PC1 proj4 = C:\BASE\2_H\3H\z1.pjs
  5. Server1 =C:\PROMOTE\1_H\1H\x1.pjs
  6. Server1 =C:\TESTING\1_H\1H\x1.pjs
  7. Server2 =D:\TESTING\1_H\1H\x1.pjs

 Question: How do I set Project.Variable.mypath to the <drive and folders> containing x1.pjs so it doesn't matter what machine I'm on.  Assume that I did not launch the pjs from within that folder "D:\TESTING\1_H\1H" and testcomplete is in System %Path%.  Assume at startup default for Project.Variable.mypath= c:\temp since all systems have it.   Example:

  • Run from commandline C:\>testcomplete.exe D:\TESTING\1_H\1H\x1.pjs. 
  • At startup: Project.Variable.mypath=c:\temp
  • How do I assign persistent Project.Variable.mypath= D:\TESTING\1_H\1H\
  • In persistent project variables, can I define A as %Project.Variable.mypath%\A.txt Or do I need to build them once the directory has been defined using the function setVariableValue(Project.Variables.A, %Project.Variable.mypath%\A.txt)
2 REPLIES 2
Marsha_R
Community Hero

Re: Save full path to pjs folder so its machine independent

This should work for you

https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/...


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
AlexKaras
Community Hero

Re: Save full path to pjs folder so its machine independent

Hi,

 

 How do I set Project.Variable.mypath to the <drive and folders> containing x1.pjs

Use ProjectSuite.Path for project suite and Project.Path for project.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: