Forum Discussion

petra's avatar
petra
Contributor
9 years ago

TC doesnt find the correct cmd

Hi!

 

Since Friday i have a new programm on my pc which i need. Today i realised that this program generate a hidden cmd, which exists even i close the programm. (started TC as admin and looked in Object Browser)

So Test Complete is confused, It doen't find any cmd, because of the hidden one. 

I cant find a solution at the moment, so can anyone help me to solve the problem.

 

I tried with NameMapping, map a new object (doesn't work) it already exists. 

 

Petra

  • petra's avatar
    petra
    9 years ago

    My Solution: starting servermanager and creating the datas. Saving in Database, Stopping servermanager and killing the hidden elasticsearch-cmd. 

    Then I took this new database as my reference database. 

    I kicked this teststep out, so there are no more Problems, As Easy.

    Other solution making this test in the first step, (It is important to open a seperate cmd before the test) So, *Elasticsearch* is cmd3. and doesn't collide with cmd or cmd.

     

    Petra

    • petra's avatar
      petra
      Contributor

      Hi Marsha!

       

      yes i can close the window by taskkill. 

      I have to feed a database with datas. 

      For a few of them i have to start a programm, which opens #elasticsearch# in the background - as an cmd-window.

       

      Is it possible to give the elastic-cmd a fixed name (cmd3) for example, or is it possible (better) to start with the data which need my program, closing all cmds and getting no problem with the existing test.

       

      I hope you understand what i mean. 

       

      Petra

       

      • Marsha_R's avatar
        Marsha_R
        Moderator

        For our keyword tests, we close everything first.  We have run into something similar to your issue where some packages for our application install multiple pieces that all look alike to TestComplete, so if we don't close the extra ones first, then we get ambiguous recognition errors.  


  • petra wrote:

    Today i realised that this program generate a hidden cmd, which exists even i close the programm. (started TC as admin and looked in Object Browser)

    Have you considered using the FindChild method of the Sys object to locate the required process?
    Function FindConsoleSession()
      
      FindConsoleSession = False
      
      Dim procPath : procPath = "C:\Windows\System32\cmd.exe"
      Dim procName : procName = "Cmd"
      Dim wndCaption : wndCaption = "*"
      Dim wndClass : wndClass = "ConsoleWindowClass"
      Dim propNames : propNames = Array("Path", "ProcessName")
      Dim propValues : propValues = Array(procPath, procName)
      Dim proc, msg 
      
      Set proc = Sys.FindChild(propNames, propValues, 1, True)
    	  
      ' verify console window is open/exists
      If proc.WaitProperty("Exists", True, 999) Then
        If proc.Window(wndClass, wndCaption, 1).Exists Then
          FindConsoleSession = True
        Else
          msg = aqString.Format("Cannot find the '%s' window", wndClass)
          Log.Error msg,, pmHighest,, Sys.Desktop.ActiveWindow
          StartConsoleSession = False
        End If
      Else
        msg = aqString.Format("Cannot find the '%s' window", procName)
        Log.Error msg,, pmHighest,, Sys.Desktop
      End If
    
    End Function

     

    • petra's avatar
      petra
      Contributor

      Hi Michael!

       

      At the moment i try to make keywordtests. But many thanks for your input, i will think about it.