Qtp 简明教程

QTP - Debugging

在自动化测试环境中,调试是对自动化脚本中的编码问题进行识别和修复的一个系统性过程,以便脚本更加稳健,并可以在应用程序中识别缺陷。

Debugging, in automation testing context, is a systematic process of spotting and fixing the coding issues in the automation script so that the script will be more robust and can spot the defects in the application.

使用 QTP 中的断点有各种执行调试的方法。只需按“F9”或使用菜单选项“运行”→“插入/删除断点”即可插入断点。

There are various ways to perform debugging using break points in QTP. Break points can be inserted just by pressing "F9" or by using the Menu option "Run" → "Inserting/Removing Break Point".

插入断点后,“红色”点和行将突出显示为红色,如下所示 −

After Inserting the Break point, the "Red Colored" Dot and the line will be highlighted in RED as shown below −

qtp debugging

Method

ShortCut

Description

Step Into

F11

Used to execute each and every Step. Steps into the Function/Action and executes line by line. It pauses on each line after execution.

Step Over

F10

Used to Step over the Function. Step Over runs only the current step in the active document.

Step Out

Shift+F11

After Step Into the function, you can use the Step Out command. Step Out continues the run to the end of the function and then pauses the run session at the next line.

Options in Break Point

可以通过导航“运行”菜单访问断点中的各种选项。

Various Options in Break Point can be accessed by Navigating through the 'Run' Menu.

Sr.No.

ShortCut & Description

1

F9 Insert/Remove BreakPoint

2

Ctrl+F9 Enable/Disable BreakPoint

3

Ctrl+Shift+F9 Clear All BreakPoint

4

Use Only Menu Enable/Disable All BreakPoints

Debugging Pane

调试窗口中的窗格如下 −

The following are the panes in the debugging window −

qtp debugging 3
  1. Output − This Tab displays all the Output of the Print Statements.

  2. Watch − This Tab displays the Boolean output of the Given Expression.

  3. LocalVariables − This Tab displays the Output of the Local Variables.

Example

监视窗格显示输出表达式,如下所示 −

The Watch Pane shows the output expression as shown below −

qtp debugging 2

本地变量窗格显示本地变量保存的值,如下所示 −

The Local Variables Pane shows the values held by the local variables as shown below −

qtp debugging 4