簡體   English   中英

如何在機器人框架中執行特定的測試用例 n 次

[英]how to execute a particular test case n number of times in robot framework

我有 5 個關於創建成員和驗證工作的測試用例。 我想運行這些測試用例 5 或 20 次。 我的框架是機器人,ide 是 pycharm,語言 - python。

APS Transformations Triggering
[Documentation] Triggering The APS Transformations for a Member
[Tags]  APSXform  APSXformTrigger  
Login to Platform Analytics
${GENERATED_MEMBER} =  Generate a Random Member  
APS_Transformations
Search for the Member
Search the Results and Go To  
Relogin If Needed
Verify Basic Member Homepage Details
Trigger APS Transformations
Save Member Details To Job Log File


APS Transformations Verification
[Documentation] Verifying The APS Transformations for a Member
[Tags]  APSXform  APSXformVerification  All
Login to Platform Analytics
Log To Console  Previous Run: ${verify_prev_run}
Fetch Previous Memeber Run Details    
Fetch URL And Go To  APP_LOGGER_URL
Log  APS Transformations are Successful.

我知道我可以為關鍵字做一個 for 循環,但不想在一個關鍵字中編寫所有這些測試用例。 - 是否有一個 git 命令我可以在 state 中運行這些標簽 20 次?

最簡單的解決方案是創建一個運行機器人 N 次的 shell 腳本。 您可以為每個文件指定不同的 output 文件,然后將所有結果合並到一個文件中。

以下示例將運行機器人 10 次,然后生成所有組合結果的日志和報告文件。

#!/bin/bash
outputs=()
for i in {0..10}; do
    output="output-$i.xml"
    outputs+=($output)
    robot --output $output $@
done
rebot ${outputs[@]}

像這樣運行它:

$ bash run_robot.sh example.robot 

有一個選項重復您的目標路徑。 假設你想在當前路徑執行 6 次,那么你可以這樣做:

pybot --test "Yout test" . . . . . .

您還可以將測試放入循環中:

Example
    :FOR   ${count}  IN RANGE  6
    \    APS Transformations Triggering
    \    APS Transformations Verification

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM