Forum Discussion

sarya's avatar
sarya
Frequent Contributor
15 years ago

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

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    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.