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 forward and is shown below.

 

This seems like a bug, but I thought I might throw it out here to see if anybody else has come across this problem.

 

Code:

 

'This function is used to launch command prompt and initialize NameMapping Object
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
  Else
    Log.Error("Unable to launch command prompt")
  End If
End Function

 

  • 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.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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.

    • sgarcia's avatar
      sgarcia
      Contributor

      That fixed the problem. Default Project Properties was correct, but the Current Project Properties set the timeout to 50 ms.

      I believe this may be the cause of a few other false fails we've recently had as well. They've been intermittent and a timeout issue could cause this.

       

      Thanks for the help. It's greatly appreciated.