Forum Discussion

jreinhart's avatar
jreinhart
Occasional Contributor
11 years ago

Setting Network Suite Variables on Slave

I can't figure out how to accomplish this simple need:

We have some urls that are explicitly defined in a few keyword tests. I've tried using Project variables and Network Suite variables (both temporary and persistent) as the values in these keyword tests. I pass a url via command line during our automated run since it uses a different url than default. Then I assign that to the variables in script. It seems to update the variable in the instance of the master project but the slave doesn't get updated. I've read through all documentation I can find on this and have followed the concepts/examples to no avail. Can anyone tell me what am I doing wrong? I can supply more info on my failed strategies if needed. Using version 9.3. Thanks in advance.

  • Hi Josh,


     


    I see that you contacted the TestComplete Support Team, and they have prepared a patch that should solve this issue. Did you apply it? Does it help?


     

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Josh,


     


    Actually, you can accomplish your task via the Network Suite variables. For this, you need to specify the Default value of the variable on the master computer. On each slave, you can get the value of the variable from script like this:




    //JScript


    var a = NetworkSuite.Variables.MyVar;




     


    I recommend that you read the "Network Suite Variables" article and those related.


     

  • jreinhart's avatar
    jreinhart
    Occasional Contributor
    I've thoroughly read the documentation and here is my use case in more detail that I can still not get to work:



    I have a master project and slave project. The master and slave have some network suite variables defined. The master has a keyword test that runs a script. The script for now is simply this:

    function Main()

    {

      NetworkSuite.Hosts.ItemByName("qa1auto").CopyProjectToSlave();

      CommandLineArgs();

      for (var i = 0; i < NetworkSuite.Jobs.Count; i++)

      {

        NetworkSuite.Jobs(i).Run(true);

      }

    The CommandLineArgs function simply sets those network suite vairables to whatever I need. Example:

    NetworkSuite.Variables.urlMainTest = "submydomain.mydomain.com";



    There's currently 1 Job with 1 Task and the task simply runs my slave project. The slave project is just a set of test items (keyword tests for our software). 1 of those keyword tests for instance has an operation param of: NetworkSuite.Variables.urlMainTest



    There is where my problem lies, that variable is not being updated on the slave computer (in the slave project). I've tried copying my scripts to slave both before and after setting the networksuite variables and still no luck. What am I missing?
  • jreinhart's avatar
    jreinhart
    Occasional Contributor
    I've set my keyword test paramater with a networksuite variable that has a default value of 'default.com'.  I did a simple test to prove this issue like this:



    The slave sets the networksuite variable to 'somethingelse.com'. The slave executes my keywordtest that opens browser and navigates to a url. The url uses the networksuite variable as I stated above. The browser navigates to 'default.com'. During this keyword test I also post the networksuite variable to the log and the log shows 'somethingelse.com'. What gives? Is this a bug in the software? I've conducted the test and gotten the same results using 'Temporary' and 'Persistent' networksuite variable.



    I've tried setting the networksuite variable from the master also, and got the same results.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Josh,


     


    I see that you contacted the TestComplete Support Team, and they have prepared a patch that should solve this issue. Did you apply it? Does it help?


     

    • nwuser_testcomp's avatar
      nwuser_testcomp
      Occasional Contributor

      Hello Experts,

       

      From where I can get that patch.I am using testcomplete 12 and creating a networksuite variable.Value of networksuite variable is not getting saved between test runs.I can see the variable created in next run but value is blank.

      I am launching testcomplete from command line and using exit and silentmode parametrs,also when saving manually value of variables get lost between runs.

       

      TIA!!

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        As indicated in the solution, the patch was obtained by contacting the support team directly.  If you do the same, a patch may be available to you as well.

  • jreinhart's avatar
    jreinhart
    Occasional Contributor
    Yes the patch succesfully resolved this issue, thanks.
    • yurik's avatar
      yurik
      Contributor

      I'm having similar issue in TC10

      I'm running a network suite : two slave processes and a master that simply starts the slaves, nothing else.

      I have a NetworksSuite Variable named Tmp and what I want to do is to set the Tmp variable in one slave process and use its value in the second slave. However what I see is that the second slave uses the previous value of the Tmp variable, even though after the run I can see the new value is there.

      For example  before the run Tmp == 1 and during the run I set Tmp = 2 in the first slave. Then the second slave reads Tmp as 1, but after the run I open Network Suite Variables and see that Tmp ==2. Also NetworkSuite displays *, that indicates there were changes. Do I need to somehow save NetworkSuite in order to see the new value in the second slave?

       

      Please help

          Yuri