LoadRunner test report is generated loadrunner notes (C): Set to run scenes and generate test reports

 

// code on a bit of a problem, the problem lies in web_reg_find () function, this function simply whether there is a corresponding text string search request object next operation (html) page. So use the login operation, it searches for a home .html, used in the search is registered in its registration page, where students have to thank luming under 51test forum to help me solve this problem. (Although it can be played back successfully, but in fact just lucky, on one of the sample code is not to modify, and remove web_reg_find function on the line).

(A) Code

Copy the code
The Action. 1 () 
 2 { 
 . 3 / * set point * / 
 . 4 lr_rendezvous ( "simultaneously logged"); 
 . 5      
 6 / * Start transaction * / 
 . 7 lr_start_transaction ( "Login"); 
 . 8      
 . 9 // load the corresponding URL 
10 the web_url ( " WebTours ", 
. 11" the URL = HTTP: //127.0.0.1: 1080 / WebTours / ", 
12 is" the Resource = 0 ", 
13 is" RecContentType = text / HTML ", 
14" the Referer = ", 
15" the Snapshot = t44.inf ", 
16" Mode = the HTML ", 
. 17 LAST); 
18 is      
whether or not there is a corresponding text string in the next step 19 checks the request object // (HTML pages) 
20 is web_reg_find (" the text = available for purchase, "," = Body Search " , LAST);
21      
22 // login 
23 web_submit_form ( "login.pl", 
24 "Snapshot = t45.inf",
25         ITEMDATA, 
26         "Name=username", "Value={username}", ENDITEM, 
27         "Name=password", "Value={password}", ENDITEM, 
28         "Name=login.x", "Value=58", ENDITEM, 
29         "Name=login.y", "Value=11", ENDITEM, 
30         LAST);
31  /*事务结束*/
32     lr_end_transaction("login", LR_AUTO);
33     return 0;
34 }
Copy the code

(B) setting, operating scenario

  1. Run Controller.

 

 

or

 

1, may be selected for the target scene, the scene manually

Object-oriented scenario: specify a destination, loadrunner generated automatically according to the program specified target.

Manual Scene: (number of virtual users) to manually create a program by specifying the Vuser to run.

 

2, when the selected object-oriented scene, the target scene can be provided. (This is more like a direct test software meets the needs of users, regardless of the system can withstand the maximum load, the system will fail under what circumstances and other issues)

 

After the target scene is set up, start running the scenario.

 

During operation, a better start, followed by the number of concurrent users and more after, CPU usage is too high

 

 3, after the end of the run (here because I did not reach the target ahead of the end)

 

View the error message.

The first error message temporarily do not understand.

The second error message: web_reg_find not find welcome,

Speculated may be due to:

1、 登录成功后,资源响应太慢(比如在响应的html页面只加载完成一部分内容的情况下,web_reg_find可能就执行检查了),没检测到该文本字符串

2、 没登录成功

第三个错误信息就很明显了,CPU占用过高。

(三)  分析结果、生成测试报告

1、打开Analysis。(点击Controller的结果-分析结果可以直接打开,也可以点击Analysis的快捷方式打开)

 

2、点击SLA配置向导,添加服务水平协议,这里设置90%的事务响应时间不超过0.5秒。(这个在Controller运行场景前也可以设置)

 

3、看这边应该是没达到预计的目标,目标是90%事务响应0.5秒,这里实际显示的是0.883。

 

4、生成html报告。(报告-html报告)

 

5、生成其他格式的测试报告(报告-新建报告)

 

直接点击【生成】,然后save保存一个格式就行了。没看到word格式的选项,不过可以导出PDF再转为word。

 

(三)  待解决问题

1、      场景设计应该加强,根据需求设计需要的场景

2、      SLA服务协议配置应该加强,熟悉不同指标、不同选项的作用

3、      生成报告部分,设置不同的报告模板,适应不同的用户。

4、      结果分析(不同图表、指标的分析及相关概念等)应该加强

//上一篇的代码有点问题,问题出在 web_reg_find()函数中,这个函数简单的说是搜索下一步操作的请求对象(html)页面中是否存在相应的文本字符串。所以用在登录操作中,它搜索的是主页.html,用在注册中它搜索的就是注册页面,这里必须得感谢下51test论坛的luming同学帮我解决了这个问题。(所以虽然可以回放成功,但其实只是运气好,上一篇的示例代码就不去修改了,去掉web_reg_find函数就行了)。

(一) 代码

Copy the code
 1 Action()
 2 {
 3     /*集合点*/
 4     lr_rendezvous("同时登录");
 5     
 6 /*事务开始*/
 7     lr_start_transaction("login");
 8     
 9     //加载相应的url
10     web_url("WebTours", 
11         "URL=http://127.0.0.1:1080/WebTours/", 
12         "Resource=0", 
13         "RecContentType=text/html", 
14         "Referer=", 
15         "Snapshot=t44.inf", 
16         "Mode=HTML", 
17         LAST);
18     
19    //检查下一步操作请求对象(HTML页面)中是否存在相应的文本字符串
20     web_reg_find("Text=Welcome,","Search=Body",LAST);
21     
22     //登录
23     web_submit_form("login.pl", 
24         "Snapshot=t45.inf", 
25         ITEMDATA, 
26         "Name=username", "Value={username}", ENDITEM, 
27         "Name=password", "Value={password}", ENDITEM, 
28         "Name=login.x", "Value=58", ENDITEM, 
29         "Name=login.y", "Value=11", ENDITEM, 
30         LAST);
31  /*事务结束*/
32     lr_end_transaction("login", LR_AUTO);
33     return 0;
34 }
Copy the code

(二)设置、运行场景

  1. 运行Controller。

 

 

或者

 

1、可以选择面向目标场景、手动场景

面向目标场景:指定一个目标,loadrunner根据指定的目标自动生成方案。

手动场景:通过指定要运行的Vuser(虚拟用户数)手动创建方案。

 

2、选择面向目标场景时,可以设置场景目标。(这个比较像是直接测试软件是否符合用户需求,而不考虑系统能承受的最大负载、什么情况下系统会失效等问题)

 

场景目标设置好后,开始运行场景。

 

运行过程中,一开始还好,后面并发用户数多了后,CPU占用太高了

 

 3、运行结束后(这里我因为没达到目标提前结束了)

 

查看错误信息。

The first error message temporarily do not understand.

The second error message: web_reg_find not find welcome,

Speculated may be due to:

1, after a successful login, resource response is too slow (as in the case of html page response is only part of the load is complete, web_reg_find possible to perform the inspection), did not detect the text string

2, no successful login

The third error message is quite clear, CPU usage is too high.

(C) the   analytical results, generate test reports

1, open Analysis. (Click Controller result - the results can directly open, you can also click on the shortcut to open the Analysis)

 

2. Click SLA configuration wizard, add the service level agreements, set up here 90% of the transaction response time of less than 0.5 seconds. (This can also be set before running the scenario Controller)

 

3, look here should not be expected to achieve the goal, the goal is 90% of the transaction response 0.5 seconds, where the actual display is 0.883.

 

4, generate html reports. (Report -html report)

 

5, generate test reports in other formats (Report - New Report)

 

Click on [generation], and then Save to save a format on the line. You did not see the option word formats, but can export PDF and then converted word.

 

(C) the   problem to be solved

1, scene design should be strengthened, according to the needs of the scene design needs

2, SLA protocol configuration services should be strengthened, familiar with the different indicators, the role of the different options

3, generate reports section, set different report templates for different users.

4, the results of the analysis (different charts, analysis and indicators related concepts, etc.) should be strengthened

Guess you like

Origin www.cnblogs.com/lijunji/p/11520404.html
Recommended