How to Debug a UFT script in VBScript Debugger?

0
211
Spread the love
  • 20
  • 28
  • 12
  • 23
  •  
  •  
  •  
  •  
  •  
  •  
    83
    Shares

We need to use “?” question mark to query the WSH. The “?” operator fetches yje required information if available in the scope of WSH.The breakpoint and ? operator combo provides a powerful technique to view the insight of the script.

Command window can access the intrinsic objects like Err Object. The WSH also has a set of other intrinsic objects available.

Inserting temporary code

Debug mode in Microsoft Script debugger supports to insert temporary custom test code during execution in debug mode. This helps us to test the logic,variable value,flags etc. This is a very popular technique while debugging and testing a large code base.

 

How to Use Debug Message?

The debugger provides clear insight of a code.While watch/view are temporary and only available during test run/debug session,the debugger provides other ways to save the debug message.

    • Put the debug message to a log file for future reference. Redirecting debug message to a log file is an efficient way for framework development.
    • This is running commentary of the script execution about how and what the script performing from running an Excel macro to  a sendkey function.
    • Debug messages enables us to track changes of a variable which we can configure and see on how the values are getting changed.
    • The simplest form of debug message is Msgbox() function.It is great tool to see values.It also pauses the script execution in modal way until and unless we click on “Ok” button. The script execution remains halted until then.
      
      Msgbox "The value is "+myVar
      
    • The WSH Script uses Echo() method to display detailed information.It is more preferable over the Msgbox() function.In WScript.exe,Echo method will display the message in a dialog box.If we use several Echo() messages,in our script,we need to click ok again and again.

WScript.Echo "The value is "+myVar
  • The Stdout property of WSH is another feature to transfer TextStream to console. This is only applicable to CScript.exe. In case of Wscript.exe, Stdout property is not applicable and throws an error.
  • LogEvent() is another method of WSHShell object to log WindowsEvent log.This method is supported by both WScript.exe and CScript.exe.

What is not supported by Microsoft Script Debugger?

The Microsoft Script Debugger does not support the followings:

  1. A local window to showcase active variables at breakpoint.
  2. It does not have a watch window
  3. It does not support dynamic breakpoint

Note:

UFT/QTP does have these features,so if we are using UFT/QTP instead of Microsoft Script Debugger, these components will be automatically available

Omission of Assertion in UFT and VbScript Debugger

VBScript Debugger or UFT surprisingly does not support assertion. Also there is no support for AssertThat() function.We need to depend if else and custom message to implement assertion.

Conclusion:

While UFT provides a great debugging options, Microsoft Script debugger is a light weight debugger that can debug any VBScript used in UFT . It can also work in a UFT neutral system. This feature is a major boost for Script review process. Surely and certainly Microsoft Script Debugger will increase the speed of review,execution and debug process.

 

 

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 20
  • 28
  • 12
  • 23
  •  
  •  
  •  
  •  
  •  
  •  
    83
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here