性能测试中各种文件的命名规范

来源:互联网 发布:java web实时应用程序 编辑:程序博客网 时间:2024/06/07 03:50
开发项目中非常强调命名规范,比如在JAVA里类和函数都会有不同的规则,那么在运用loadrunner的性能项目中会有什么样的命名规范呢,让我来问以下三个问题:
        <1>如何进行命名规范呢?
        <2>规范的命名会给项目带来什么好处呢?
        <3>如何对脚本测试报告等不同的文档进行有效的管理呢?
        好,我们先来讨论如何进行命名规范呢,同时这些规范会给工作过程中带来什么样的好处。在使用loadrunner的过程中哪些东西需要我们去命名呢?我总结了下,以下几个东西我们需要进行命名。            
Script Name,
Action Name,
Transaction Name,
Result Name in Controller,
HTML Report name.
Scenario Name.

那么如何命名才能有效的进行管理和提高工作效率了。我们举一个简单的例子然后对上述的东西进行一一说明。
例子:
客户需要对一个网上银行系统进行性能测试,需要测试用例包括存钱,取钱,查询。同时给出步骤如下。

Case Name: WithDrawStepsActionExpected Results1Enter URLhttp://www.onlinebank.com/login.doThe login page should be displayed21. Login using the following credentials
Userid: Sands
Password: testing
2. Click “Go”
Onlinebank's main page should be displayed3Click on WithDraw hyperlink in the top navigateWithDraw Page should be displayed4Input the number less than your balance.
Click "Submit"
WithDraw successful Page should be displayed5click on Logoff hyperlink in the top navigateLogoff successful Page should be displayedCase Name: DepositStepsActionExpected Results1Enter URLhttp://www.onlinebank.com/login.doThe login page should be displayed21. Login using the following credentials
Userid: Sands
Password: testing
2. Click “Go”
Onlinebank's main page should be displayed3Click on Deposit hyperlink in the top navigateDeposit Page should be displayed4Input the money number
Click "Submit"
Deposit successful Page should be displayed5click on Logoff hyperlink in the top navigateLogoff successful Page should be displayedCase Name: InqueryStepsActionExpected Results1Enter URLhttp://www.onlinebank.com/login.doThe login page should be displayed21. Login using the following credentials
Userid: Sands
Password: testing
2. Click “Go”
Onlinebank's main page should be displayed3Click on Inquery hyperlink in the top navigateInquery Page should be displayed4Choose a the date in From dropdown
Choose a the date in to dropdown
Click "Submit"
Search Result Page should be displayed5click on Logoff hyperlink in the top navigateLogoff 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
然后将生成的各个文件存储在相应的文件夹中。

不知道该文质量如何,希望对新手有所益,同时老手也能够提出不足的地方,谢谢。

原创粉丝点击