cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a variables in network suite

Highlighted
Frequent Contributor

How to add a variables in network suite

Hi,



I have 7 script units in the project that I am currently running as a network suite .Currently ,I create a variable manually in my scripts ,for example var servername = 'vm2k3' . Everytime I run these scripts on different VMs,I need to change the servername manually in all the scripts to change servername from 'vm2k3' to 'vm2k8' .How can I do this using varaibles .I read the help article on creating variables but was not able to really get the process.Has someone been into same situation where they need to run the same project on different VMs and need to change vmname in the script .I need to know the process and also how to create variables. Also what is the local value and defualt value in variables column.Also I created a variable as 'Var1' with default value as "vm2k3".Then I substituted "servername" with value as "Var1" but run fails saying Var1 is undefined.



Thanks.
1 REPLY 1
Highlighted
Community Hero

RE: How to add a variables in network suite

Hi Sumedha,



I think that the cause of the problem is that you are not specifying the namespace for your variable.

The case is that in TestComplete the variable with the same name can exist in the script (and in this case you reference it in the code without any namespace, e.g. Var1 = 'value'), in the project, project suite or network suite. In the latter case you must use proper namespace prefix to define what variable must be used. I.e. Project.Var1, ProjectSuite.Var1 or NetworkSuite.Var1 respectively.

See relevant help topic for more details.

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
================================
New Here?
Join us and watch the welcome video:
Read the Latest News
JuneSCNJ
Top Kudoed Authors