Forum Discussion

sgarcia's avatar
sgarcia
Contributor
8 years ago

Problem with TestedApps Run command returning the process for the Command Prompt

The code we have has worked for years. With the TC update to 12.30.1651.7, it is no longer returning the object when I execute the Run method for the TestedApp. The function is pretty straight forwar...
  • tristaanogre's avatar
    8 years ago

    With the exception of the variable assignment and Aliases.cmd.RefreshMappingInfo, i plugged your code into a sandbox project in TC 12.30.1651.7 in my Windows 10 machine and it worked just fine.

     

    Here's my code:

    Function LaunchCommandPrompt()
      Dim cmdPrompt, p, counter
    
      Set cmdPrompt = TestedApps.cmd.Run
    
      'Wait until cmd prompt is launched
      counter = 0
      Do While counter < 10
        If cmdPrompt.Exists Then
          Exit Do
        End If
        counter = counter + 1
      Loop
      If cmdPrompt.Exists Then
        'Capture process id of newely launched cmd prompt and assign it to project var
        'Project.Variables.ProcessID = cmdPrompt.Id
        
        'Aliases.cmd.RefreshMappingInfo
        Log.Message("Command prompt exists")
      Else
        Log.Error("Unable to launch command prompt")
      End If
    End Function

    Now, I did a bit of an experiment.  Under Tools -> Current Project Properties -> Playback, I set the Auto-wait timeout to 50 ms and it definitely did fail right away.  This is a bug in TC 12.30 that sometimes sets that timeout to 50.  Check your project properties and, if it's set to 50, set it to 10000 and see if the problem goes away.  If it is set to 50, you might be experiencing the bug for which there is a patch.  Request the patch from support and give that a try as well.