<1>如何進行命名規範呢?
<2>規範的命名會給項目帶來什麼好處呢?
<3>如何對腳本,測試報告等不同的文檔進行有效的管理呢?
好,我們先來討論如何進行命名規範呢,同時這些規範會給工作過程中帶來什麼樣的好處。在使用loadrunner的過程中哪些東西需要我們去命名呢?我總結了下,以下幾個東西我們需要進行命名。
Script Name,
Action Name,
Transaction Name,
Result Name in Controller,
HTML Report name.
Scenario Name.
那麼如何命名纔能有效的進行管理和提高工作效率了。我們舉一個簡單的例子然後對上述的東西進行一一說明。
例子:
客戶需要對一個網上銀行系統進行性能測試,需要測試用例包括存錢,取錢,查詢。同時給出步驟如下。
Case Name: WithDraw | ||
Steps | Action | Expected Results |
1 | Enter URL http://www.onlinebank.com/login.do | The login page should be displayed |
2 | 1. Login using the following credentials Userid: Sands Password: testing 2. Click “Go” |
Onlinebank's main page should be displayed |
3 | Click on WithDraw hyperlink in the top navigate | WithDraw Page should be displayed |
4 | Input the number less than your balance. Click "Submit" |
WithDraw successful Page should be displayed |
5 | click on Logoff hyperlink in the top navigate | Logoff successful Page should be displayed |
Case Name: Deposit | ||
Steps | Action | Expected Results |
1 | Enter URL http://www.onlinebank.com/login.do | The login page should be displayed |
2 | 1. Login using the following credentials Userid: Sands Password: testing 2. Click “Go” |
Onlinebank's main page should be displayed |
3 | Click on Deposit hyperlink in the top navigate | Deposit Page should be displayed |
4 | Input the money number Click "Submit" |
Deposit successful Page should be displayed |
5 | click on Logoff hyperlink in the top navigate | Logoff successful Page should be displayed |
Case Name: Inquery | ||
Steps | Action | Expected Results |
1 | Enter URL http://www.onlinebank.com/login.do | The login page should be displayed |
2 | 1. Login using the following credentials Userid: Sands Password: testing 2. Click “Go” |
Onlinebank's main page should be displayed |
3 | Click on Inquery hyperlink in the top navigate | Inquery Page should be displayed |
4 | Choose a the date in From dropdown Choose a the date in to dropdown Click "Submit" |
Search Result Page should be displayed |
5 | click on Logoff hyperlink in the top navigate | Logoff successful Page should be displayed |
Script Name Convention:
從上述的需求中我們看出該需求有三個用例。所以我們要錄三個腳本,錄好腳本後我把三個腳本命名如下:
Onlinebank_S1_withdraw_V1_080207
Onlinebank_S2_deposit_V1_080207
Onlinebank_S3_inquery_V1_080207
我們對腳本的名字進行這種命名規範有什麼好處呢,
第一,我們在文件夾中尋找腳本可以很容易進行排序。
第二,可以進行版本管理。
Action Name Convention:
我們在做腳本的時候也需要對Action Name進行命名,因爲loadrunner是默認把Action當作一個Transaction.所以在這裏對其命名主要是在查看數據的過程中能將Action和包含在其中的Transaction好排序。我把Action的命名如下:
S1_Z_onlinebank_withdraw_V1_080207
可能到此你還不是非常明白爲什麼要這麼命名,接下來看了Transaction name的時候你就會明白了.
Transaction Name Convention:
S1_A_OpenLoginPage
S1_B_Login
S1_C_ClickWithdrawLink
S1_D_WithdrawMoney
S1_E_Logoff
這樣做的好處就是你可以很容易在各種測試結果中進行sort,比如response time graph等等。
我們回過頭來看爲什麼Action name爲什麼那麼命名:不多說,給大家排下序就知道了
S1_A_OpenLoginPage
S1_B_Login
S1_C_ClickWithdrawLink
S1_D_WithdrawMoney
S1_E_Logoff
S1_Z_onlinebank_withdraw_V1_080207
有的時候朋友會說如果多於26 Transaction怎麼辦?很簡單,用Y1,Y2........來增加。
Result Name in Controller:
Onlinebank_S1S2S3_stress_test_results_080207
這裏是S1S2S3是這次測試你載入的是那些腳本。如果這次只測了S1,那就是
Onlinebank_S1_stress_test_results_080207
這樣做的好處是一看就可以看出是什麼系統,哪個腳本,執行日期是哪天。
HTML Report name:
該項目與Result Name in Controller相同。
Scenario Name:
Onlinebank_S1S2S3_Stress_test_300Users_080207
在Scenario的命名中你需要提高多少個用戶,這樣找這個Scenario 就可以對該Scenario有個大致的瞭解。
同時在進行文檔管理時,可以設立如下的文件結構。
onlinebank
Scripts
Scenaros
Results
Reports
然後將生成的各個文件存儲在相應的文件夾中。
不知道該文質量如何,希望對新手有所益,同時老手也能夠提出不足的地方,謝謝。