Forum Discussion

CBleunven's avatar
CBleunven
Contributor
9 years ago

Parallel Execution of different projects on different computer.

Hi,

We re trying to use several computer for tests in order to cover different situations.

I've a Master computer and 2 Slave.

From the Master I can run tests on first on the master, after on the first slave and then on the second slave.

However I didn't find how to run all tests in the same time. Note that the tests are fully independent.

I've a first project on Master, 2 projects that are copied on the slave but I don't find how to start them in the same time from the Project suite or the master project.

This page shows the principle but no explanation on how to do it.

 

Thanks for your help,

regards,

Christophe

    • maximojo's avatar
      maximojo
      Frequent Contributor

      To clarify (as I use distributed testing and love it) "WaitForCompletion" will have the runtime "wait" on that line until the respective job is finished executing. Then continue on with the logic flow. So in th below example TestComplete or TestExecute will wait on the ".Run(true)" line until the remote VM finishes executing the Job.

       

      If it was false, the runtime would quickly start the Job and move on to the next step in the logic flow. It would NOT wait for the Job to be finished.

       

      function Test()
      {
        for (var i = 0; i < NetworkSuite.Jobs.Count - 1; i++)
          NetworkSuite.Jobs(i).Run(true);
      }

       

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    So if I have one master and 3 slaves I need 4 TestExecute licences ?

     

    Thank you,

     

    Mehdi

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Yes, because you need to be able to run the application on multiple machines.

      • maximojo's avatar
        maximojo
        Frequent Contributor

        You can also have 

         

        1 - TestComplete

        3 - TestExecute

         

        TestComplete can be used as a runtime.

         

        It also depends how you setup the run configuration. Your master can do work instead of just sitting there running the slaves.

  • Hi altemann and maximojo,

    Sorry for the late reply I needed to work on other priorities. Thank you for your help, it help me to better understand how it works.

    So if I've well understood, I need to run the Jobs with a script and not as an item in the master project. And the script is called by an item in the project. In itself it's not a problem. However if it allows to run 2 jobs on 2 slave computers,  this doesn't allow to run some tests on the master computer in the same time than on a slave computer as it will wait for the end of a test item before starting the next one ? 

    Thanks for your help,

    regards,

    Christophe

    • maximojo's avatar
      maximojo
      Frequent Contributor

      Hi CBleunven

       

      I will explain how I have the master and slaves run the same jobs at the same time so the master's time is not wasted (so to speak).

       

      This is how I do it. I'm sure there are other ways to set this up.

       

      Basically the Master function below called by TC/TE starts the entire distributed testing process. Of course this is probably best run on a remote VM through TestExecute as, with the master doing work, you couldn't do much on your local PC (unless perhaps it was not using the UI).

       

      If this is too simplistic let me know what you would like to see and I'll try to whip something up.

       

      // TestComplete/TestExecutetest item calls Master function
      // below which starts distributed testing
      function Master()
      { 
        // run slaves which do some setup and call "AllWorkerLoop()" also. 
        //Pass "false" so master does NOT wait for slaves to complete
        // but continues on once they are started
        NetworkSuite.Jobs.ItemByName("SlaveJobs").Run(false); 
        
        // master goes into this loop which slaves are also running from
        // the line above
        AllWorkerLoop(); 
      }
      
      // When the slaves startup they simply call the AllWorkerLoop() function
      function Slave()
      {
         AllWorkerLoop();
      }
      
      // master and slaves call same function
      function AllWorkerLoop()
      {
        // do work here
      }

       

  • Hi maximojo,

    thank you for your answer.

    I finally found a way to do what I want by reading what you wrote.

    I've a simple method

    function startJobsForSlave1()
    { 
      NetworkSuite.Jobs.ItemByName("SlaveJobs").Run(false);  
    }

    and I add a ProjectItem that call this method when it's suitable in my tests.

    Then TE on master starts the tests on the slave computer and in the same time continue on the master one.

    Many thanks for your help,

    Christophe