Forum Discussion

andryt29's avatar
andryt29
Occasional Contributor
13 years ago

RAM using by TestComplete increase

Hi everybody!

I work with TestComplete 7.52

I have a problem with TestComplete when I lauch my script => TestComplete increases its RAM and after 5 minutes its fix.I can't do anything with this.



I give you a part of my code



I was trying :

   => disable Test Visualiser

   => asign null to my variables after script

   => launch JScript function: CollectGarbage()

   => dotNET.System.GC.Collect();

   => my NameMapping is about 14Mb



so my function is:



function s12()

{

  LogResources(); //A

  ChargerVariables();

  LogResources(); //B

  TestOuvrirReceptionCapsule();

  LogResources();//C

  TestChoixTypeCapsule(2);

  LogResources();//D    

  TestActionNavigaGateurReceptionCapsule("Navigator_Post");

  LogResources();//E

  TestFermerReceptionCapsule();

  fntTabControl.Refresh();

  LogResources();//F

}

function LogResources()

{

CollectGarbage();

dotNET.System.GC.Collect();

Log.Message("RAM TC="+ Sys.Process("TestComplete").MemUsage);

}



Between E and F => TestComplete increase about 100Mb

Between C and D => TestComplete increase about 50Mb



After Working with my application's window , I refresh() the parent of  variable that I use to Map this windows ( the parent of the windows that I use)



   example:   theTabControl.Refresh()



But testComplete doesn't  decrease its Memory Usage and at the end it's RAM increase about 1,3GB



See my attachement for more  information

Thanks a lot

 
  • andryt29's avatar
    andryt29
    Occasional Contributor
    My Script



    var sMode, process ;

    var  fntApplication,fntTabControl ;

    var fntReceptionCapsule;

    var sMode;

    var oReceptionCapsule;

    var mrStockCompta;

    sRadical = "GC";

    function s12()

    {

      LogResources(); //A

      ChargerVariables();

      LogResources(); //B

      TestOuvrirReceptionCapsule();

      LogResources();//C

      TestChoixTypeCapsule(2);

      LogResources();//D    

      TestActionNavigaGateurReceptionCapsule("Navigator_Post");

      LogResources();//E

      TestFermerReceptionCapsule();

      fntTabControl.Refresh();

      LogResources();//F

    }

    function LogResources()

    {

    CollectGarbage();

    dotNET.System.GC.Collect();

    Log.Message("RAM TC="+ Sys.Process("TestComplete").MemUsage);

    }



    function ChargerVariables()

    {

        sMode ="Interop";

        process = Aliases.GC_Application;      

        fntApplication = process.HwndSource_Main;

        fntTabControl = process.LesOnglets.Border.Grid.BorderPrimary.PrimaryContentControl.ContentPresenter.ExtendedTabControl;

        fntReceptionCapsule = fntTabControl.SaisieCapsuleAchatForm;

        oReceptionCapsule = fntTabControl.ogtReceptionCapsule;

        mrStockCompta = process.OngletRuban.FonctionnalitesRuban.xOngletStocksComptaMat;

    }



    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    function TestOuvrirReceptionCapsule()

    {

       Log.AppendFolder("test l'ouverture de la fenetre reception de capsule");

       assertTrue(OuvrirReceptionCapsule(), "la fenetre de reception de capsules est ouverte");

       Log.PopLogFolder();

    }



    function OuvrirReceptionCapsule()

    {

     mrStockCompta.Click();

     Delay(1000);

     Aliases.GC_Application.OngletRuban.FonctionnalitesRuban.RibbonGroupsContainer.xGroupeMouvementsStocksSaisie.RibbonGroupPanel.xSaisieAchatsCapsules.Click();

     Delay(1000);

    }



    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    function TestChoixTypeCapsule(iType)

    {

    Log.AppendFolder("Test la selection du type de capsule dans la fenêtre Recepton Capsule");

    assertTrue(ChoixTypeCapsule(iType),"la selection du type de capsule est ok");

    Log.PopLogFolder();

    }



    function ChoixTypeCapsule(iType)

    {

    var bool = true;

      var oRadioBouton = fntReceptionCapsule.Find("Uid.OleValue","i:ExtendedRadioButton_"+iType,50);

      if(oRadioBouton.Exists)

      {

        if(!oRadioBouton.IsChecked.OleValue)

            oRadioBouton.Click();

      }

      else

      {

        Log.Error("Le Radio Bouton n° :"+iType+" n'existe pas");

        bool = false;

      }

    return bool;

    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    function TestFermerReceptionCapsule(bEnregistrer)

    {

    Log.AppendFolder("test la fermeture de la reception de capsule");

    assertTrue(FermerReceptionCapsule(bEnregistrer),"La fermeture est ok");

    Log.PopLogFolder();

    }



    function FermerReceptionCapsule(bEnregistrer)

    {

      return FermetureFenetre(oReceptionCapsule, fntReceptionCapsule, bEnregistrer);   

    }



    function FermetureFenetre(oOnglet, fntFenetre, bEnregistre)

    {

      var fenetre;

       if(sMode != "Delphi")

       {

          CloseTabControl(oOnglet);

       }

       else

       {

        if (fntFenetre.Exists)

        {

          fntFenetre.Close();

        }

       }

       Delay(500)

       AnnulerWPFDialogue(process);

    }



    function CloseTabControl(extendedTabItem)

    {

      extendedTabItem.HoverMouse(extendedTabItem.Width-20, extendedTabItem.Height/2);

      Delay(100);

      extendedTabItem.Click(extendedTabItem.Width-20, extendedTabItem.Height/2);

    }





    function AnnulerWPFDialogue(AliasOrigine)

    {

        var oButton=FindControl(FindDialogueBoxMessage(AliasOrigine),"PART_NoButton");

        if(!oButton.Exists || !oButton.Visible)

            oButton=FindControl(FindDialogueBoxMessage(AliasOrigine),"PART_CancelButton");

        if(oButton.Exists && oButton.Visible)

        {

           oButton.Click();

           return true;

        }

        else

           return false;

    }



    function FindControl(startPoint, idOrName)

    {

        var control = startPoint.Find("Uid", idOrName, 50);

        if (!control.Exists)

        {

            control = startPoint.Find("Name", 'WPFObject("' + idOrName + '")', 50);

        }

        return control;

    }



    function FindDialogueBoxMessage(AliasOrigine)

    {

     var oDialogue = FindDialogBox(AliasOrigine,"Information");

     if(!oDialogue.Exists)

         oDialogue = FindDialogBox(AliasOrigine,"Avertissement");

     if(!oDialogue.Exists)

         oDialogue = FindDialogBox(AliasOrigine,"Confirmation");

     return oDialogue;

    }



    function FindDialogBox(oApplication,sDialogType){

       var PropArray, ValuesArray, ConvertedPropArray, ConvertedValuesArray;

     

      // Creates arrays of property names and values

      PropArray = new Array("ClrClassName","WPFControlText");

      ValuesArray = new Array("DialogHost",sDialogType);



      // Converts arrays

      ConvertedPropArray = ConvertJScriptArrayInVariant(PropArray);

      ConvertedValuesArray = ConvertJScriptArrayInVariant(ValuesArray);

     

      return oApplication.Find(ConvertedPropArray,ConvertedValuesArray,100);

    }

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    function TestActionNavigaGateurReceptionCapsule(sAction)

    {

      Log.AppendFolder("Test une action sur le navigateur de la fenêtre reception capsule");

      assertTrue(ClickNavigator(GetNavigatorReceptionCapsule(), sAction),"l'action "+sAction+" ok");

      Log.PopLogFolder();   

    }

    function ClickNavigator(NavigatorControl, FuncName)

    {

        var buttonControl = NavigatorControl.Find("Name", "WPFObject(" + FuncName + ")" , 50);

        if (!buttonControl.Exists)

        {

           Log.Error("La bouton du navigateur n'a pas été trouvé.");

           return null;

        }

        buttonControl.Click();

        return true;

    }

    function GetNavigatorReceptionCapsule()

    {

      var oNavigatorControl = fntReceptionCapsule.Find("Uid.OleValue","GcCommonUI:NavigateurControl_1",30);

      if(oNavigatorControl.Exists)

         return oNavigatorControl;

      else

         return null;

    }



    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    function ChercherObjetApartirDeSaPropriete(AliasOrigine, propriete, valeur, profondeur)

    {

        var PropArray, ValuesArray, ConvertedPropArray, ConvertedValuesArray, obj;

        PropArray = new Array(propriete);

        ValuesArray = new Array(valeur);

        ConvertedPropArray = ConvertJScriptArrayInVariant(PropArray);

        ConvertedValuesArray = ConvertJScriptArrayInVariant(ValuesArray);

        obj = AliasOrigine.Find(ConvertedPropArray, ConvertedValuesArray, profondeur);

        if (obj.Exists)

        {

            return obj;   

        }

        else

            return false;

    }

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    function ChercherObjetApartirDeSesProprietes(AliasOrigine, PropArray, ValuesArray, profondeur)

    {

        var ConvertedPropArray, ConvertedValuesArray, obj;

        ConvertedPropArray = ConvertJScriptArrayInVariant(PropArray);

        ConvertedValuesArray = ConvertJScriptArrayInVariant(ValuesArray);

     

        obj = AliasOrigine.Find(ConvertedPropArray, ConvertedValuesArray, profondeur);

        if (obj.Exists)

        {

            return obj;   

        }

        else

            return false;

    }



    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    function ConvertJScriptArrayInVariant(AArray)

    {

      var objDict = Sys.OleObject("Scripting.Dictionary");

      objDict.RemoveAll();

      for (var j in AArray)

        objDict.Add(j, AArray);

      return objDict.Items();

    }



    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    function assertTrue(bool, msg) {



        if( bool ) {

            logok(msg)

        }

        else {

            logko(msg)

        }

    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    var log_attr_ok = null;

    var log_attr_ko = null;



    function logok(msg) {

        Log.Message(msg,"testcase assertion",500,log_attr_ok);

    }



    function logko(msg) {

        Log.error(msg,"testcase assertion",500,log_attr_ko);

        success = false;

    }

  • andryt29's avatar
    andryt29
    Occasional Contributor
    Hi ,



    Excuse me I wan't toi say



    Between D and E => TestComplete increase about 100Mb



    Between C and D => TestComplete increase about 50Mb



    Between E and F => TestComplete increase about 5Mb  after Refresh() my variables and

    after launching  JScript function: CollectGarbage()  and  dotNET.System.GC.Collect()
  • andryt29's avatar
    andryt29
    Occasional Contributor
    So don't you have any dll or any patch to resolve my problem for TestComplete 7.52?My Firm will be upgrade testComplte with the lastest version 9.10 after few months ,but now I must work with this Release

    Thanks a lot.

  • Hi Andry,


     


    There was a similar fix for TestComplete 7.52. I'm not sure whether our Support team can provide you with it, but you may contact them.