QTP - 呼叫新操作



插入新操作呼叫

測試人員可以透過執行以下步驟在指令碼的任何點插入新動作 -

步驟 1 - 右鍵單擊指令碼區域並選擇“新操作呼叫”。

Inserting Call to New Action Step 1

步驟 2 - 在“插入新操作呼叫”視窗中,提供測試名稱、描述,並指定它是否為可重複使用操作。最重要的是,選擇要插入操作的位置。

Inserting Call to New Action Step 2

步驟 3 - 您可以以圖形方式在測試名稱選項卡中檢視更改,如下所示 -

Inserting Call to New Action Step 3

您還可以在指令碼中的任何點使用 QTP 命令呼叫動作。

RunAction "Calculate", oneIteration  'Executes  Calculate Action for one iteration.

可以透過引數呼叫動作,如下所示 -

'Input to the action 
num1 = 5 
num2 = 10 
Dim value1 

'Run the action with parameters 
OutputValue = RunAction("Calculate", oneIteration, num1, num2, value1)  

'Display the output 
print OutputValue 
qtp_actions.htm
廣告
© . All rights reserved.