Forum Discussion

edwardsun007's avatar
edwardsun007
Occasional Contributor
7 years ago

QtObject Application Crashes When Running Scripts From TestComplete

Hi ,

 

We have a desktop application written in C++ which is made of QtObject,   and currently I have created some scripts for testing,  however when I run the script from TestComplete, the application will crash ,   I have searched for solution all over the place but I found nothing helpful,   can you help me  ?

4 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    We need some more details please.  To start - 

     

    What is your test trying to do?

    Are there any error messages from the app or from TC when the crash happens?  What are they?

    If you try the test steps manually, does the app still crash?

    • edwardsun007's avatar
      edwardsun007
      Occasional Contributor

      We have application R ,   this script is written simply to launch it and detect initial UI objects:

      function LaunchR() 
      {
        Log.Message("In LaunchR");
        // if DP already is running, do not proceed 
        var p = NameMapping.Sys.WaitProcess("Register360", 0);
        if (p.Exists) {
          Log.Message("looks like Register360 is already running. Exiting...");
          return;
        }  
        
        // make sure Register360.exe exists
       if (!aqFile.Exists(TestedApps.Items("Register360").FullFileName)) {
          Log.Message("Register360.exe is not found at default TestedApps location...calling FindRegister360ExecutablePath...");
            
          TestedApps.Items("Register360").Path = FindRegister360ExecutablePath();
          // check it again
          if (!aqFile.Exists(TestedApps.Items("Register360").FullFileName))
              Runner.Halt("Cannot find Register360.exe!");
          }
          
        TestedApps.Register360.Run();
        aqUtils.Delay(3000);
        // get license dialog
       var licenseDlg = Aliases.Register360.WaitQtObject("QProgressDialog",-1,2000);
        while(licenseDlg.Exists)
        {
          Log.Message("Checking license dailog...");
          aqUtils.Delay(2000);
        }
        
       // unable to located license server page
       var licensedlg=Aliases.Register360.WaitQtObject("LicenseMgrConfigDlg",-1,2000);
       if(licensedlg.Exists)
       {
         Log.Warning("Unable to locate license server, check settings! ");
         Log.Picture(licensedlg.Picture(),'maybe a license problem');
         Runner.Stop();
       }
        
        // look for start page
        var ProjectSelector  = Aliases.Register360.WaitQtObject("ProjectSelectorWidgetRUBase",-1,2000);
        if (!ProjectSelector.Exists) 
        {
          Log.Picture( Sys.Desktop.Picture(), 'error pic' );
          Log.Error('Failed to find Project Selector');
        }
        aqUtils.Delay(5000);
        Log.Message("Out LaunchRegister360");
      }

      Currently it always crashes at line : 

      // look for start page
        var ProjectSelector  = Aliases.Register360.WaitQtObject("ProjectSelectorWidgetRUBase",-1,2000);

      In rare case, when it did not crash out application,  it cannot recognize this UI 'ProjectSelectorWidgetRUBase' , which is the following window:

       

       

      Hope this is helpful

    • edwardsun007's avatar
      edwardsun007
      Occasional Contributor

      And in addition ,  manual test in the same way doesn't crash the application, so its not caused by our logic