Forum Discussion

balinta01's avatar
balinta01
Occasional Contributor
13 years ago

Synchronization point is ignored

Hi all!



I prepared a VERY simple example regarding Distributed Testing, but it didnt work for some reason (TestComplete 8.6). I have two slaves computer and the tests are concerned about testing Calculator.



The test case on Slave 1 (simply press numbers 1 and 2):

function Calc12()

{

  //Runs the "calc" tested application.

  TestedApps.calc.Run(1, true);

  //Executes the specified code snippet.

  NetworkSuite.Synchronize("SPC");

  while(false == false)

  {

    //Clicks the 'btn1' button.

    Aliases.calc.wndCalculator.btn1.ClickButton();

    //Clicks the 'btn2' button.

    Aliases.calc.wndCalculator.btn2.ClickButton();

    //Delays the test execution for the specified time period.

    Delay(2000);

  }

}



The test case on Slave 2 (simply press numbers 8 and 9):

function Calc89()

{

  //Runs the "calc" tested application.

  TestedApps.calc.Run(1, true);

  //Executes the specified code snippet. 

  NetworkSuite.Synchronize("SPC");

 

  while(false == false)

  {

    //Clicks the 'btn8' button.

    Aliases.calc.wndCalculator.btn8.ClickButton();

    //Clicks the 'btn9' button.

    Aliases.calc.wndCalculator.btn9.ClickButton();

    //Delays the test execution for the specified time period.

    Delay(2000);

  }

}



These are two tasks in the same job. I created a synchronization point on both slave computers. I run the job, but after the Calculators start on both slaves, they should wait for each other, but it is like an infinite loop. According to the help, the running from synchronization point shall be continueud after all the tasks reach the synchronization point. In my example both tasks reach these point, however the test doesnt continue, just waiting. What might I do wrong. Actually my purpose is to give a simple example of two slave computers waiting for each other, then continue running. E.g. I want to wait till both Calculators start.



Slave1                 Slave2

runCalc                runCalc

wait                     wait (refers to SPC)

doThis                 doThat


  • Hi,


    It looks like the problem is that the While loop you created is infinite. Try to modify your scripts without using a loop or correct the loop condition and run the test again.


    For example, you can modify your scripts in the following way:


    function Calc12()

    {

      //Runs the "calc" tested application.

      TestedApps.calc.Run(1, true);

      //Executes the specified code snippet.

      NetworkSuite.Synchronize("SPC");

      //Clicks the 'btn1' button.

      Aliases.calc.wndCalculator.btn1.ClickButton();

      //Clicks the 'btn2' button.

      Aliases.calc.wndCalculator.btn2.ClickButton();

      //Delays the test execution for the specified time period.

      Delay(2000);

    }



    function Calc89()

    {

      //Runs the "calc" tested application.

      TestedApps.calc.Run(1, true);

      //Executes the specified code snippet. 

      NetworkSuite.Synchronize("SPC");

      //Clicks the 'btn8' button.

      Aliases.calc.wndCalculator.btn8.ClickButton();

      //Clicks the 'btn9' button.

      Aliases.calc.wndCalculator.btn9.ClickButton();

      //Delays the test execution for the specified time period.

      Delay(2000);

    }

  • balinta01's avatar
    balinta01
    Occasional Contributor
    Hi,



    Even after elimininating the infinite loop, I still could not get it to work. The script is very simple, however the synch point does not seem to be working properly. I have the two functions on different slave computers in the same job defining the sync point in both computer (copying it through the master computer). If you look at the very first post, the NetworkSuite.Synchronize("SPC");  line was before the while loop, but it didnt move on after this line, just wait for tasks being synchronized. The help says after all the tasks (in this example my two functions) gives out the Synchronize instruction then the whole process is supposed to go on. I still dont get why thi simple example is not working.



    function Calc12onSlaveA()

    {

      TestedApps.calc.Run(1, true);

      NetworkSuite.Synchronize("SPC"); 

     

      Aliases.calc.wndCalculator.btn1.ClickButton();

      Aliases.calc.wndCalculator.btn2.ClickButton();

      Delay(2000);

    }


    function Calc89onSlaveB()

    {

      TestedApps.calc.Run(1, true);

      NetworkSuite.Synchronize("SPC");

     

      Aliases.calc.wndCalculator.btn8.ClickButton();

      Aliases.calc.wndCalculator.btn9.ClickButton();

      Delay(2000);

    }

  • Hi,


    The problem can occur if the SPC synchpoint is added to the master project. If so, you need to either use this synchpoint in the master project as well or delete the synchpoint from the SynchPoint collection of the master project.

  • Hi,



    I have tried to remove the SynchPoint (ref SPC here) from my master project. Unfortunately this does not work.



    I managed to reach for both tests the same Sync point. But it hangs and wait afterwards(Glasshour icon displaying "synchronizing")

    How to pass the synchronization point for both tests in order to continue the execution? What blocks the execution?



    Thank you