Ask a Question

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

SOLVED
sgarcia
Occasional Contributor

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

 

Scott
2 REPLIES 2
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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sgarcia
Occasional 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.

Scott
cancel
Showing results for 
Search instead for 
Did you mean: