LoadRunner 经典面试题

gxw6

贡献于2015-05-03

字数:92518 关键词: 面试题目 试题

 在LoadRunner中为什么要设置思考时间和pacing 答: 录制时记录的是客户端和服务端的交互,如果要精确模拟 用户的行为,那么客户操作客户端时花费了很多时间要怎么模拟呢? 录入 填写提交的内容,从列表中下拉搜索选择特定的值等,这时LOADRUNNER 不会记录用户 的客户端操作,而是记录了用户这段 时间,成为思考时间(Think-time),因为用户的这些客户端操作不会影响服务端,只是让服务器端在这段时间内没有请求而已。,所 以加入思考时间就能模拟出熟练的或者生疏的用户操作,接近实际对于服务端的压力。    Vuser 思考时间模拟实际用户在不同操作之间等待的时间。例如,当用户收到来自服务器的数据时,可能要等待几秒钟查看数 据,然后再做出响应。这种延迟就称为“思考时间”。VuGen 使用 lr_think_time 函数将思考时间值录制到 Vuser 脚本中。以下录 制的函 数指明用户等待了 8 秒钟才执行下一个操作:    lr_think_time(8);    当您运行了 Vuser 脚本并且 Vuser 遇到了上述 lr_think_time 语句时,默认情况下,Vuser 将等待 8 秒钟后再执行下一个操作。可 以使用思考时间运行时设置来影响运行脚本时 Vuser 使用录制思考时间的方式。 如何理解TPS? 答:TPS主要还是体现服务器对当前录制的事务的处理速度快慢。TPS高并不代表性能好。 TPS 是Transactions Per Second 的 缩 写,也就是事务数/ 秒。它是软件测试结果的测量单位。一个事务是指一个客户机向服 务器发送请求然后服务器做出反应的过程。客户机在发送请求时开始计时,收到服务器响应后结束计时,以此来计算使用的时 间和完成的事务个数,最终利用这些信息来估计得分。客户机使用加权协函数平均方法来计算客户机的得分,试软件就是利用 客户机的这些信息使用加权协函 数平均方法来计算服务器端的整体TPS得分。 如何使用loadrunner批量添加树型结构数据 /*此段代码为:添加”树状”节点数据,代码源于*****项目,此码仅添加数据到第三层。*/ /*前置条件:用户已登录并具有操作权限*/ /*思路:新增一级节点–>获取一级ID–>添加二级节点–>展开一级节点–>获取二级ID–>添加三级数据*/ /*说明:添加一级节点–>逐个读取一级节点ID–>读到一个一级节点就给它添加二级节点–> 二级节点添加完一次就读一次ID–>读一次二级节点直接添加三级节点*/ /*修改”树状”节点数据的代码类似,Submit修改时,要多建一个参数TreeCode*/ int i,j,k,p; //循环变量 int No1,No2,No3; //分别保存一、二、三级节点的个数 int M1,M2,M3; //分别定义一、二级节点的数量,三级节点不保存数据,故未限制大小 char *MyID1[90],*MyID2[90],m[40]; //MyID1用于储存所有一级节点数据,m为临时数组变量 /* MyID的长度也大于M的长度;m的长度要大于ID的长度+1 */ M1=30;M2=20;M3=10; /*RootID名称需要按模块修改,Control里需要重新参数化*/ lr_save_string (“FindRootIDinWebResource”,”RootID”);//根节点的ID,修改此处即可使用 lr_output_message (“当前根节点的ID号为:%s”,lr_eval_string (“{RootID}”)); for (i=1;i<=M1 ;i++ ) //添加M1个一级节点 { lr_save_int(i,"L"); //#########添加一级节点 web_submit_data("{RootID}{L}"); } lr_output_message ("已添加%d个一级节点",M1); web_reg_save_param("IDS", //获取一级节点ID "LB=value=\"", "RB=\"", "ORD=All", LAST); //#######展开根节点 web_url("{RootID}"); No1=atoi(lr_eval_string ("{IDS_count}")); //获取ID的数量,保存在变更No1中 lr_output_message ("获取一级节点的数量为: %d",No1); if (No1>M1) { No1=M1;}//让No1<=M1 for (i=1;i<=No1;i++) //将一级节点的ID写入MyID1中 { sprintf(m,"{IDS_%d}",i); //生成动态字符串{IDS_i},存在变量m中************核心步骤 MyID1[i-1]=lr_eval_string (m); //读取{IDS_i}参数对应的值,保存到MyID1中****核心步骤 lr_output_message ("一级节点第%d共%d,m=%s即MyID1[%d]=,%s",i,No1,m,i-1,MyID1[i-1]); lr_save_string (MyID1[i-1],"SubID");//将MyID1转换为参数{SubID}以便使用 for (j=1;j<=M2;j++ )//添加M2个二级节点 { lr_save_int(j,"M"); //#######添加下级节点 web_submit_data("{RootID}{SubID}{M}"); } lr_output_message ("已添加%d个二级节点",M2); web_reg_save_param("IDS2", //获取二级节点ID "LB=value=\"", "RB=\"", "ORD=All", LAST); //########展开选中节点 web_url("{RootID}{SubID}"); No2=atoi(lr_eval_string ("{IDS2_count}")); //获取ID的数量,保存在变更No2中 lr_output_message ("获取二级节点的数量为: %d",No2); if (No2>M2) { No2=M2;}//让No2<=M2 for (k=1;k<=No2;k++) //将二级节点的ID写入MyID2中 { sprintf(m,”{IDS2_%d}”,k); //生成动态字符串{IDS2_i},存在变量m中************核心步骤 MyID2[k-1]=lr_eval_string (m); //读取{IDS2_i}参数对应的值,保存到MyID2中****核心步骤 lr_output_message (“开始处理@二级节点:第%d共%d,m=%s即MyID1[%d]=,%s”,k,No2,m,k-1,MyID2[k-1]); lr_save_string (MyID2[k-1],”SubID2″);//将MyID1转换为参数{SubID}以便使用 lr_save_int(k,”N”); for (p=1;p<=M3;p++) //添加子节点 { lr_save_int(p,”P”); //########添加三级节点 web_submit_data(“{RootID}{SubID}{P}”); }lr_output_message (“当前状态@一级节点%d,二级节点%d:已添加%d个三级节点”,i,k,M3); } } loadrunner对应用程序性能分析的总结 一个应用程序是由很多个组件组成的,整个应用程序的性能好不好需要从整体入手去分析。   打开analysis页面,将左下角的display only graphs containing data 置为不选,然后选中web page breakdown ,点击“open graph”添加需要分析的功能项。   web page breakdown中显示的是每个页面的下载时间。点选左下角web page breakdown 展开,可以看到每个页中包括的css 样式表,js 脚本,jsp 页面等所有的属性。   在select page to breakdown 中选择页面。选中后,在选择栏下方看到属于它的组件。哪一行的事物占据的时间较长,那么它的消耗时间点就在这里,分析问题也就要从这里入手。 对相应的组件所标注的颜色分析如下: 1、dns resolution 显示使用最近的dns服务器,将dns解析为ip地址所需要的时间,“dns查找”度量是指示dns解析问题或dns服务器问题的一个很好的指示器。 2、connection 显示与包含指定的URL的web服务器建立初始连接所需要的时间。连接度量是一个很好的网络问题指示器。另外,他还能判断服务器是否对请求作出响应。 3、first buffer 显示从初始HTTP请求(通常为get) 到成功收到来自web服务器的第一次缓冲时为止所经过的时间。第一次缓冲度量可以判断是否存在web服务器延迟或者网络滞后。 注意点:由于缓冲区最大为8k,因此第一次缓冲时间可能也就是完成元素下载所需要的时间。 4、ssl handshaking 显示建立ssl连接(包括客户端请求,服务器请求,客户端公用密钥传输,服务器证书传输及其它部分可选阶段)所用的时间。自此点之后,客户端及服务器之间所有的通信都将被加密。 注意点:ssl握手度量仅适用用https通信。 5、receive 显示从服务器收到最后一个字节,并完成下载之前所经过的时间。 接收度量可以查看网络质量,查看用来计算接收速率的时间/大小比率。 6、ftp authentication 显示验证客户端所用的时间。如果使用ftp,则服务器在开始处理客户端命令之前,必须验证该客户端。、 此功能只是用与使用ftp通信。 7、client 显示因浏览器思考时间或其它与客户端有关的延迟而使客户机上的请求发生延迟时,所经过的平均时间。 8、error 显示从发出HTTP请求到返回错误消息(仅限于HTTP错误)期间所经过的平均时间。 分析以上指标,结合系统资源监控指标,会比较准确快速的定位问题。从而对系统的性能及随后的调优提供针对性的意见。 使用LoadRunner进行性能测试的一般步骤是什么? ☆ 确定需要进行测试的业务或交易,通过手工操作和Vuser Generator的录制功能来记录并生成虚拟用户脚本。 ☆ 手工修改虚拟用户脚本,确定脚本能够成功回放。 ☆ 在Controller中对场景进行配置后,启动测试。在测试过程中,Controller控制Load Generator对被测系统的加压方式和行为。 ☆ Controller同时负责搜集被测系统各个环节的性能数据。各个Loaded Generator会记录最终用户响应时间和脚本执行的日志。 ☆ 压力运行结束后,Loaded Generaror将数据传输到Controller中,有Controller对测试结果进行汇总。 ☆ 借助数据分析工具Analysis对性能测试数据进行分析,确定瓶颈和调优方法。 ☆ 对系统进行针对性的调优,重复进行压力测试,确定性能是否有所提高。 loadrunner中的设置线程和进程的区别 loadrunner中,在进行运行设置中有一项选择,是按进程运行Vuser或按线程运行Vuser?下面进行分别来讲: 1.按进程运行Vuser:Controller将使用驱动程序mdrv运行Vuser。如果按进程方式运行每个Vuser,则对于每个Vuser实例,都将启动一个mdrv进程。如果设置了10个Vuser,则在任务管理器中出现10个mdrv进程。多个mdrv进程肯定会占用大量内存及其他系统资源,这就限制了可以在任一负载生成器上运行的Vuser的数量。 2.按线程运行Vuser:及设置了10个Vuser,其只会调用一个驱动程序mdrv.而每个Vuser都按线程运行,这些线程Vuser将共享父进程的内存段。这就节省了大量内存控件,从而可以在一个负载生成器上运行更多的Vuser。 任何选择都是有两面性的。选择线程方式运行Vuser会带来一些安全问题。因为线程的资源是从进程资源中分配出来的,因此同一个进程中的多个线程会有共享的内存空间,这样可能会引起多个线程的同步问题,调度不好,就会出问题,不如A线程要用的资源就必须等待B线程释放,而B也在等待其他资源释放才能继续。这就会出现这样的问题:同一个测试场景,用线程并发就会超时失败或报错,而用进程并发就没错。 虽然会有区别,但两种方式的运行都会给服务端造成的压力是一样的。 如何用loadrunner录制sql server测试一个sql语句或存储过程的执行 本次通过loadRunner录制SQL Server介绍一下如何测试一个sql语句或存储过程的执行性能。 主要分如下几个步骤完成: 第一步、测试准备 第二步、配置ODBC数据源 第三步、录制SQL语句在Sql Server查询分析器中的运行过程 第四步、优化录制脚本,设置事务 第五步、改变查询数量级查看SQL语句的性能 第六步、在controller中运行脚本 下面开始具体的介绍: 测试准备阶段我们首先要确认测试数据库服务器:我们可以在本地安装SQL SERVER数据库服务端及客户端,也可以确定一台装好的SQL SERVER服务器。 接下来,准备测试数据:对数据库测试时我们要考虑的不是SQL语句是否能够正确执行,而是在某数量级的情况下SQL语句的执行效率及数据库服务的运行情况,所以我们分别准备不同数量级的测试数据,即根据实际的业务情况预估数据库中的记录数,在本次讲解中我们不考虑业务逻辑也不考虑数据表之间的关系,我们只建立一张表,并向此表中加入不同数量级的数据,如分别加入1000条、10000条、50000条、100000条数据查看某SQL语句的执行效率。 在查询分析器中运行如下脚本: --创建测试数据库 create database loadrunner_test; use loadrunner_test --创建测试数据表 create table test_table (username varchar(50),sex int,age int,address varchar(100),post int) --通过一段程序插入不同数量级的记录,具体的语法在这里就不多说了 declare @i int set @i=0 while @i<1000 //循环1000次,可以根据测试数据情况改变插入条数 begin BEGIN TRAN T1 insert into test_table (username,sex,age,address,post) values ('户瑞海'+cast(@i as varchar),@i-1,@i+1,'北京市和平里'+cast(@i as varchar)+'号',123456); IF @@ERROR <> 0 begin rollback; select @@error end else begin commit; set @i = @i+1 end end 好了,执行完上述语句后,建立的数据表中已经有1000条记录了,下面进行第二步的操作,配置ODBC数据源,为了能让loadrunner能够通过ODBC协议连接到我们建立的SQL SERVER数据路,我们需要在本机上建立ODBC数据源,建立方法如下: 控制面板—性能和维护—管理工具—数据源(ODBC)--添加,在列表中选择SQL SERVER点击完成,根据向导输入数据源名称,链接的服务器,下一步,输入链接数据库的用户名和密码,更改链接的数据库,完成ODBC的配置,如果配置正确的话,在最后一步点击“测试数据源”,会弹出测试成功的提示。 配置好ODBC数据源后就要录制SQL语句在查询分析器中的执行过程了: 1、 打开loadrunner,选择ODBC协议 2、 在start recording中的application type 选择win32 application;program to record中录入SQL SERVER查询分析器的路径“..\安装目录\isqlw.exe” 3、 开始录制,首先通过查询分析器登录SQL SERVER,在打开的查询分析器窗口中输入要测试的SQL语句,如“select * from test_table;” 4、 在查询分析器中执行该语句,执行完成后,结束录制 好了,现在就可以看到loadrunner生成的脚本了(由于脚本过长,在这里就不粘贴了,有需要的朋友可以加我QQ,我把脚本发给你们),通过这些语句,我们可以看出,登录数据库的过程、执行SQL语句的过程。 接下来,我们来优化脚本,我们分别为数据库登录部分和执行SQL语句的部分加一个事物,在增加一个double的变量获取事务执行时间,简单内容如下: Action() { double trans_time; //定义一个double型变量用来保存事务执行时间 lr_start_transaction("sqserver_login"); //设置登录事务的开始 lrd_init(&InitInfo, DBTypeVersion); //初始化链接(下面的都是loadrunner生成的脚本了,大家可以通过帮助查到每个函数的意思) lrd_open_context(&Ctx1, LRD_DBTYPE_ODBC, 0, 0, 0); lrd_db_option(Ctx1, OT_ODBC_OV_ODBC3, 0, 0); lrd_alloc_connection(&Con1, LRD_DBTYPE_ODBC, Ctx1, 0 /*Unused*/, 0); ……………… trans_time=lr_get_transaction_duration( "sqserver_login" ); //获得登录数据库的时间 lr_output_message("sqserver_login事务耗时 %f 秒", trans_time); //输出该时间 lr_end_transaction("sqserver_login", LR_AUTO); //结束登录事务 lr_start_transaction("start_select");//开始查询事务 lrd_cancel(0, Csr2, 0 /*Unused*/, 0); lrd_stmt(Csr2, "select * from test_table;\r\n", -1, 1, 0 /*None*/, 0);//此句为执行的SQL lrd_bind_cols(Csr2, BCInfo_D42, 0); lrd_fetch(Csr2, -10, 1, 0, PrintRow24, 0); …………….. trans_time=lr_get_transaction_duration( "start_select" ); //获得该SQL的执行时间 lr_output_message("start_select事务耗时 %f 秒", trans_time); //输出该时间 lr_end_transaction("start_select", LR_AUTO); //结束查询事务 优化后,在执行上述脚本后,就可以得到登录到数据库的时间及运行select * from test_table这条语句的时间了,当然我们也可以根据实际情况对该条语句进行参数化,可以测试多条语句的执行时间,也可以将该语句改为调用存储过程的语句来测试存储过程的运行时间。 接下来把该脚本在controller中运行,设置虚拟用户数,设置集合点,这些操作我就不说了,但是值得注意的是,没有Mercury 授权的SQL SERVER用户license,在运行该脚本时回报错,提示“You do not have a license for this Vuser type. Please contact Mercury Interactive to renew your license.”我们公司穷啊买不起loadrunner,所以我也无法继续试验,希望有license朋友们监控一下运行结果! 最起码在VUGen中运行该脚本我们可以得到任意一个SQL语句及存储过程的执行时间,如果我们测试的B/S结构的程序 如何完全卸载LoadRunner? 1.首先保证所有LoadRunner的相关进程(包括Controller、VuGen、Analysis和Agent Process)全部关闭。 2.备份好LoadRunner安装目录下测试脚本,一般存放在LoadRunner安装目录下的“scrīpts”子目录里。 3.在控制面板的“删除与添加程序”中运行LoadRunner的卸载程序。如果弹出提示信息关于共享文件的,都选择全部删除。 4.卸载向导完成后,重新启动电脑。完成整个LoadRunner卸载过程。 5.删除整个LoadRunner目录。(包括Agent Process) 6.在操作中查找下列文件,并且删除它们(如果有) 1) wlrun.* 2) vugen.*7.运行注册表程序(开始- 运行- regedit)8.删除下列键值: 如果只安装了MI公司的LoadRunner这一个产品,请删除: HKEY_LOCAL_MACHINESOFTWAREMercury Interactive. HKEY_CURRENT_USERSOFTWAREMercury Interactive. 否则请删除: HKEY_LOCAL_MACHINESOFTWAREMercury InteractiveLoadRunner. HKEY_CURRENT_USERSOFTWAREMercury InteractiveLoadRunner. 9.最后清空回收站 完成了以上操作就可以正常的重新安装LoadRunner。安装LoadRunner时最好关闭所有的杀毒程序。 loadrunner如何遍历一个页面中的url并进行访问? 代码如下: Action() { char temp[64]; int num = 0 ; int i = 0 ; char *str ; // char *temp ; //获取函数,是一个数组 web_reg_save_param( “UrlList”, “LB/ALNUMIC=Recording Options进入录制的设置窗体 2.Recording标签页:选用哪种录制方式 3.Browser标签页:浏览器的选择 4.Recording Proxy 标签页:浏览器上的代理设置 5.Advanced 标签页:可以设置录制时的think time,支持的字符集标准等 6.Correlation标签页:手工设置关联,通过关联可在测试执行过程中保存动态值。使用这些设置可以配置 VuGen 在录制过程中执行的自动关联的程度 LoadRunner如何选择协议? 很多人使用loadrunner录制脚本时都得不到理想的结果,出现这种情况大多是由于录制脚本时选择了不当的协议。那我们在录制脚本前如何选择合适的通信协议呢?用单协议还是双协议? LoadRunner属于应用在客户端的测试工具,在客户端模拟大量并发用户去访问服务器,从而达到给服务器施加压力的目的。所以说LoadRunner模拟的就是客户端,其脚本代表的是客户端用户所进行的业务操作,即只要脚本能表示用户的业务操作就可以。 1.LR支持多种协议,请大家一定要注意,这个地方协议指的是你的Client端通过什么协议访问的Server,Client一般是面向最终使用者的,Server是第一层Server端,因为现在的体系架构中经常Server层也分多个层次,什么应用层,什么数据层等等,LR只管Client如何访问第一层Server. 2.特别要注意某些应用,例如一个Web系统,这个系统是通过ActiveX控件来访问后台的,IE只是一个容器,而ActiveX控件访问后台是通过COM/DCOM协议的,这种情况就不能使用Web协议,否则你什么也录制不到,所以,LR工程师一定要了解应用程序的架构和使用的技术。   3. 象HTTPS,一般来讲一定要选择多协议,但在选择具体协议的时候一定只选Web协议,这时候才能作那个端口映射。 n通常协议选择 1.对于常见的B/S系统,选择Web(Http/Html) 2.测一个C/S系统,根据C/S结构所用到的后台数据库来选择不同的协议,如果后台数据库是sybase,则采用sybaseCTlib协议,如果是SQL server,则使用MS SQL server的协议,至于oracle 数据库系统,当然就使用Oracle 2-tier协议。 3.对于没有数据库的C/S(ftp,smtp)这些可以选择Windwos Sockets协议。 4.至于其他的ERP,EJB(需要ejbdetector.jar),选择相应的协议即可. 5. 一般可以使用Java vuser协议录制由java编写的C/S模式的软件, ,当其他协议都没有用时,只能使用winsocket协议 Loadrunner支持哪些常用协议? · Web(HTTP/HTML) · Sockets · .net 协议 · web services · 常用数据库协议(ODBC,ORACLE,SQLSERVER 等) · 邮件(SMTP、pop3) · 其它协议 性能测试的类型都有哪些? 负载测试(Load Test) 通过逐步增加系统负载,测试系统性能的变化,并最终确定在满足性能指标的情况下,系统所能承受的最大负载量的测试。 压力测试(Stress Test) 通过逐步增加系统负载,测试系统性能的变化,并最终确定在什么负载条件下系统性能处于失效状态,并以此来获得系统能够提供的最大服务级别的测试。 压力测试是一种特定类型的负载测试。 疲劳强度测试 通常是采用系统稳定运行情况下能够支持的最大并发用户数或者日常运行用户数,持续执行一段时间业务,通过综合分析交易执行指标和资源监控指标来确定系统处理最大工作量强度性能的过程。 疲劳强度测试可以反映出系统的性能问题,例如内存泄漏等。 大容量测试(Volume Test) 对特定存储、传输、统计、查询业务的测试 并发用户数是什么?跟在线用户数什么关系? 并发主要是针对服务器而言,是否并发的关键是看用户操作是否对服务器产生了影响。因此,并发用户数量的正确理解为:在同一时刻与服务器进行了交互的在线用户数量,这种交互既可以是单向的传输数据,也可以是双向的传送数据。 · 并发用户数是指系统运行期间同一时刻进行业务操作的用户数量。 · 该数量取决于用户操作习惯、业务操作间隔和单笔交易的响应时间。 · 使用频率较低的应用系统并发用户数一般为在线用户数的5%左右。 · 使用频率较高的应用系统并发用户数一般为主线用户数的10%左右 Loadrunner常用的分析点都有哪些? Vusers: 提供了生产负载的虚拟用户运行状态的相关信息,可以帮助我们了解负载生成的结果。 Rendezvous(负载过程中集合点下的虚拟用户): 当设置集合点后会生成相关数据,反映了随着时间的推移各个时间点上并发用户的数目,方便我们了解并发用户的变化情况。 Errors(错误统计): 通过错误信息可以了解错误产生的时间和错误类型,方便定位产生错误的原因。 Errors per Second(每秒错误): 了解在每个时间点上错误产生的数目,数值越小越好。通过统计数据可以了解错误随负载的变化情况,定为何时系统在负载下开始不稳定甚至出错。 Average Transaction Response Time(平均事务响应时间): 反映随着时间的变化事务响应时间的变化情况,时间越小说明处理的速度越快。如果和用户负载生成图合并,就可以发现用户负载增加对系统事务响应时间的影响规律。 Transactions per Second(每秒事务): TPS吞吐量,反映了系统在同一时间内能处理事务的最大能力,这个数据越高,说明系统处理能力越强。 Transactions Summary(事务概要说明) 统计事物的Pass数和Fail数,了解负载的事务完成情况。通过的事务数越多,说明系统的处理能力越强;失败的事务数越小说明系统越可靠。 Transaction performance Summary(事务性能概要): 事务的平均时间、最大时间、最小时间柱状图,方便分析事务响应时间的情况。柱状图的落差越小说明响应时间的波动小,如果落差很大,说明系统不够稳定。 Transaction Response Time Under Load(用户负载下事务响应时间): 负载用户增长的过程中响应时间的变化情况,该图的线条越平稳,说明系统越稳定。 Transactions Response time(事务响应时间百分比): 不同百分比下的事务响应时间范围,可以了解有多少比例的事物发生在某个时间内,也可以发现响应时间的分布规律,数据越平稳说明响应时间变化越小。 Transaction Response Time(各时间段上的事务数): 每个时间段上的事务个数,响应时间较小的分类下的是无数越多越好。 Hits per Second(每秒点击): 当前负载重对系统所产生的点击量记录,每一次点击相当于对服务器发出了一次请求,数据越大越好。 Throughput(吞吐量): 系统负载下所使用的带宽,该数据越小说明系统的带宽依赖就越小,通过这个数据可以确定是不是网络出现了瓶颈。 HTTP Responses per Second(每秒HTTP响应): 每秒服务器返回各种状态的数目,一般和每秒点击量相同。点击量是客户端发出的请求数,而HTTP响应数是服务器返回的响应数。如果服务器的响应数小于点击量,那么说明服务器无法应答超出负载的连接请求。 Connections per Second(每秒连接): 统计终端的连接和新建的连接数,方便了解每秒对服务器产生连接的数量。同时连接数越多,说明服务器的连接池越大,当连接数随着负载上升而停止时,说明系统的连接池已满,通常这时候服务器会返回504错误。需要修改服务器的最大连接来解决该问题。 LoadRunner不执行检查方法怎么解决? 在录制Web协议脚本中添加了检查方法Web_find,但是在脚本回放的过程中并没有执行。 错误现象:在脚本中插入函数Web_find,在脚本中设置文本以及图像的检查点,但是在回放过程中并没有对设置的检查点进行检查,即Web_find失效。 错误分析:由于检查功能会消耗一定的资源,因此LoadRunner默认关闭了对文本以及图像的检查,所以在设置检查点后,需要开启检查功能。 解决办法:打开运行环境设置对话框进行设置,在“Run-time Settings”的“Internet Protocol”选项里的“Perference”中勾选“Check”下的“Enable Image and text check”选项。 LoadRunner请求无法找到如何解决? 在录制Web协议脚本回放脚本的过程中,会出现请求无法找到的现象,而导致脚本运行停止。 错误现象:Action.c(41): Error -27979: Requested form. not found [MsgId: MERR-27979] Action.c(41): web_submit_form. highest severity level was “ERROR”,0 body bytes, 0 header bytes [MsgId: MMSG-27178]” 这时在tree view中看不到此组件的相关URL。 错误分析:所选择的录制脚本模式不正确,通常情况下,基于浏览器的Web应用会使用“HTML-based script”模式来录制脚本;而没有基于浏览器的Web应用、Web应用中包含了与服务器进行交互的Java Applet、基于浏览器的应用中包含了向服务器进行通信的JavaScript/VBScript代码、基于浏览器的应用中使用HTTPS安全协议,这时则使用“URL-based script”模式进行录制。 解决办法:打开录制选项配置对话框进行设置,在“Recording Options”的“Internet Protocol”选项里的“Recording”中选择“Recording Level”为“HTML-based script”,单击“HTML Advanced”,选择“Script. Type”为“A script. containing explicit”。然后再选择使用“URL-based script”模式来录制脚本。 LoadRunner HTTP服务器状态代码都有哪些?如何解决? 在录制Web协议脚本回放脚本的过程中,会出现HTTP服务器状态代码,例如常见的页面-404错误提示、-500错误提示。 错误现象1:-404 Not Found服务器没有找到与请求URI相符的资源,但还可以继续运行直到结束。 错误分析:此处与请求URI相符的资源在录制脚本时已经被提交过一次,回放时不可再重复提交同样的资源,而需要更改提交资源的内容,每次回放一次脚本都要改变提交的数据,保证模拟实际环境,造成一定的负载压力。 解决办法:在出现错误的位置进行脚本关联,在必要时插入相应的函数。 错误现象2:-500 Internal Server Error服务器内部错误,脚本运行停止。 错误分析:服务器碰到了意外情况,使其无法继续回应请求。 解决办法:出现此错误是致命的,说明问题很严重,需要从问题的出现位置进行检查,此时需要此程序的开发人员配合来解决,而且产生的原因根据实际情况来定,测试人员无法单独解决问题,而且应该尽快解决,以便于后面的测试。 这两天测试并发修改采购收货时,录制回放正确,运行脚本,集合点3个并发时,却老是出错 如下: Action.c(30): Error -26612: HTTP Status-Code=500 (Internal Server Error) for http://192.168.100.88:88/Purchase/stockin_action.asp?Oper=Edt 解决过程:按Help提示在浏览器输入原地址,发现提示“请重新登陆系统”。 被此误导,偶以为是Session ID、或Cookie失效,于是尝试找关联,花了N多时间。可是脚本里确实不存在需要关联的地方呀,系统默认关联了。 与程序员沟通,证实此过程不会涉及到Session ID 或Cookie。那为什么? 因为集合点下一站就是修改的提交操作,于是查找web_submit_data–>定位查找Log文档 注意点:怎么找log文件 –>Controller–>Results–>Results Settings 查找本次log文件保存目录–>到该目录下查找log文件夹–>打开 惊喜的发现其中竟然有所有Vuser 的运行log。–>打开Error 查找报错的Vuser–>打开相应的log文件 查找error,然后偶发现了一段让偶热泪盈眶的话: Action.c(30):    

Microsoft OLE DB Provider for ODBC Drivers 错误 ’800040 Action.c(30):     05′\n Action.c(30):    

\n Action.c(30):     [Microsoft][ODBC SQL Server Driver][SQL Server]事务(进程 ID  53) Action.c(30):     与另一个进程已被死锁在  lock 资源上,且该事务已被选作死锁牺牲品。请重新运行该事务。 Action.c(30):     \n Action.c(30):    

\n Action.c(30):     /Purchase/stockin_action.asp,行 Action.c(30):     205 Action.c(30): Error -26612: HTTP Status-Code=500 (Internal Server Error) for “http://192.168.100.88:88/Purchase/stockin_action.asp?Oper=Edt”   [MsgId: MERR-26612] Action.c(30): t=37758ms: Closing connection to 192.168.100.88 after receiving status code 500   [MsgId: MMSG-26000] Action.c(30): t=37758ms: Closed connection to 192.168.100.88:88 after completing 43 requests   [MsgId: MMSG-26000] Action.c(30): t=37760ms: Request done “http://192.168.100.88:88/Purchase/stockin_action.asp?Oper=Edt”   [MsgId: MMSG-26000] Action.c(30): web_submit_data(“stockin_action.asp”) highest severity level was “ERROR”, 1050 body bytes, 196 header bytes   [MsgId: MMSG-26388] Ending action Action. [MsgId: MMSG-15918] Ending iteration 1. [MsgId: MMSG-15965] Ending Vuser… [MsgId: MMSG-15966] Starting action vuser_end. [MsgId: MMSG-15919] 解决了。。。。。。。 很寒。由此可以看出,查看日志文件是件多么重要的事情啊!!!!! 其实并发死锁本来就是本次的重点,之前是写事务,但没有做整个页面的锁定,只是写在SQL里。程序员说这样容易出现页面错误, 又改成页面锁定,具体怎么锁偶没看懂asp外行。之前事务冲突,偶让他写个标志,定义个数值字段增一,偶就可以直观看出来了。 这次改成页面就删掉这些标志了,于是出错就无处可寻。 这次最大的收获就是知道怎么查找Controller的log文件。以后看到Error就不会被牵着鼻子走了~~~~ LoadRunner脚本中出现乱码如何解决? 在录制Web协议脚本时出现中文乱码,在回放脚本时会使回放停止在乱码位置,脚本无法运行。 错误现象:某个链接或者图片名称为中文乱码,脚本运行无法通过。 错误分析:脚本录制可能采用的是URL-based script方式,如果程序定义的字符集合采用的是国际标准,脚本就会出现乱码现象。 解决办法:重新录制脚本,在录制脚本前,打开录制选项配置对话框进行设置,在“Recording Options”的“Advanced”选项里先将“Surport Charset”选中,然后选中支持“UTF-8”的选项。 LoadRunner超时错误如何解决? 在录制Web协议脚本回放时超时情况经常出现,产生错误的原因也有很多,解决的方法也不同。 错误现象1:Action.c(16): Error -27728: Step download timeout (120 seconds) has expired when downloading non-resource(s)。 错误分析:对于HTTP协议,默认的超时时间是120秒(可以在LoadRunner中修改),客户端发送一个请求到服务器端,如果超过120秒服务器端还没有返回结果,则出现超时错误。 解决办法:首先在运行环境中对超时进行设置,默认的超时时间可以设置长一些,再设置多次迭代运行,如果还有超时现象,需要在“Runtime Setting”>“Internet Protocol:Preferences”>“Advanced”区域中设置一个“winlnet replay instead of sockets”选项,再回放是否成功。 错误现象2:Action.c(81):Continuing after Error -27498: Timed out while processing URL=http://172.18.20.70:7001/workflow/bjtel/leasedline/ querystat/ subOrderQuery.do 错误分析:这种错误常常是因为并发压力过大,服务器端太繁忙,无法及时响应客户端的请求而造成的,所以这个错误是正常现象,是压力过大造成的。 如果压力很小就出现这个问题,可能是脚本某个地方有错误,要仔细查看脚本,提示的错误信息会定位某个具体问题发生的位置。 解决办法:例如上面的错误现象问题定位在某个URL上,需要再次运行一下场景,同时在其他机器上访问此URL。如果不能访问或时间过长,可能是服务器或者此应用不能支撑如此之大的负载。分析一下服务器,最好对其性能进行优化。 如果再次运行场景后还有超时现象,就要在各种图形中分析一下原因,例如可以查看是否服务器、DNS、网络等方面存在问题。 最后,增加一下运行时的超时设置,在“Run-Time Settings”>“Internet Protocol:Preferences”中,单击“options”,增加“HTTP-request connect timeout”或者“HTTP-request receive”的值。 Error -27257: Pending web_reg_save_param/reg_find/create_html_param如何解决? 问题描述Error -27257: Pending web_reg_save_param/reg_find/create_html_param[_ex] request(s) detected and reset at the end of iteration number 1 解决方法:web_reg_save_param位置放错了,应该放到请求页面前面。 Failed to transmit data to network: [10057]Socket is not connected什么错误? 这个错误是由网络原因造成的,PC1和PC2上面都装了相同的loadrunner 9.0,且以相同数量的虚拟用户数运行相同的业务(机器上的其他条件都相同),PC1上面有少部分用户报错,PC2上的用户全部执行通过。 Overlapped transmission of request to … WSA_IO_PENDING错误如何解决? - 这个问题,解决方法: 1、方法一,在脚本前加入web_set_sockets_option(“OVERLAPPED_SEND”, “0″),禁用TTFB细分,问题即可解决,但是TTFB细分图将不能再使用,附图。 2、方法二,可以通过增加连接池和应用系统的内存,每次增加25%。 Failed to connect to server错误是什么原因? 这个问题一般是客户端链接到服务失败,原因有两个客户端连接限制(也就是压力负载机器),一个网络延迟严重,解决办法: 1、修改负载机器注册表中的TcpTimedWaitDelay减小延时和MaxUserPort增加端口数。注:这将增加机器的负荷。 2、检查网络延迟情况,看问题出在什么环节。 建议为了减少这种情况,办法一最好测试前就完成了,保证干净的网络环境,每个负载机器的压力测试用户数不易过大,尽量平均每台负载器的用户数,这样以上问题出现的概率就很小了。 has shut down the connection prematurely什么错误? 一般是在访问应用服务器时出现,大用户量和小用户量均会出现。 来自网上的解释: 1>应用访问死掉 小用户时:程序上的问题。程序上存在数据库的问题 2>应用服务没有死 应用服务参数设置问题 例如: 在许多客户端连接Weblogic应用服务器被拒绝,而在服务器端没有错误显示,则有可能是Weblogic中的server元素的AcceptBacklog属性值设得过低。如果连接时收到connection refused消息,说明应提高该值,每次增加25% Java连接池的大小设置,或JVM的设置等 3>数据库的连接 在应用服务的性能参数可能太小了 数据库启动的最大连接数(跟硬件的内存有关) 以上信息有一定的参考价值,实际情况可以参考此类调试。 如果是以上所说的小用户时:程序上的问题。程序上存在数据库的问题,那就必须采用更加专业的工具来抓取出现问题的程序,主要是程序中执行效率很低的sql语句,weblogic可以采用introscope定位,期间可以注意观察一下jvm的 垃圾回收情况看是否正常,我在实践中并发500用户和600用户时曾出现过jvm锯齿型的变化,上升下降都很快,这应该是不太正常的。 ————————————— 实际测试中,可以用telent站点看看是否可以连接进去,可以通过修改连接池中的连接数和适当增加应用内存值,问题可以解决。 LoadRunner出现open many files错误是什么原因? 问题一般都在压力较大的时候出现,由于服务器或者应用中间件本身对于打开的文件数有最大值限制造成,解决办法: 1、修改操作系统的文件数限制,aix下面修改limits下的nofiles限制条件,增大或者设置为没有限制,尽量对涉及到的服务器都作修改。 2、方法一解决不了情况下再去查看应用服务器weblogic的commonEnv.sh文件,修改其中的nofiles文件max-nofiles数增大,应该就可以通过了,具体就是查找到nofiles方法,修改其中else条件的执行体,把文件打开数调大。修改前记住备份此文件,防止修改出错。 3、linux上可以通过ulimit –HSn 4096来修改文件打开数限制,也可以通过ulimit -a来查看。 4、linux上可以通过lsof -p pid | wc -l来查看进程打开的句柄数。 connection refused是什么原因? - 这个的错误的原因比较复杂,也可能很简单也可能需要查看好几个地方,解决起来不同的操作系统方式也不同。 1、首先检查是不是连接weblogic服务过大部分被拒绝,需要监控weblogic的连接等待情况,此时需要增加acceptBacklog,每次增加25%来提高看是否解决,同时还需要增加连接池和调整执行线程数,(连接池数*Statement Cache Size)的值应该小于等于oracle数据库连接数最大值。 2、如果方法一操作后没有变化,此时需要去查看服务器操作系统中是否对连接数做了限制,AIX下可以直接vi文件limits修改其中的连接限制数、端口数,还有tcp连接等待时间间隔大小,wiodows类似,只不过windows修改注册表,具体修改注册表中有TcpTimedWaitDelay和MaxUserPort项,键值在[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\]。因为负载生成器的性能太好,发数据包特别快,服务器也响应特别快,从 而导致负载生成器的机器的端口在没有timeout之前就全部占满了。在全部占满后,就会出现上面的错误。执行netstat –na命令,可以看到打开了很多端口。所以就调整TCP的time out。即在最后一个端口还没有用到时,前面已经有端口在释放了。 1,这里的TcpTimedWaitDelay默认值应该中是30s,所以这里,把这个值调小为5s(按需要调整)。 2,也可以把MaxUserPort调大(如果这个值不是最大值的话)。 drunner出现 Connection reset by peer.是什么原因? 这个问题不多遇见,一般是由于下载的速度慢,导致超时,所以,需要调整一下超时时间。 解决办法:Run-time setting窗口中的‘Internet Protocol’-‘Preferences’设置set advanced options(设置高级选项),重新设置一下“HTTP-request connect timeout(sec),可以稍微设大一些”。 Step download timeout (120 seconds)是什么问题? 这是一个经常会遇到的问题,解决得办法走以下步骤: 1、修改run time setting中的请求超时时间,增加到600s,其中有三项的参数可以一次都修改了,HTTP-request connect timeout,HTTP-request receieve timeout,Step download timeout,分别建议修改为600、600、5000。run time setting设置完了后记住还需要在control组件的option的run time setting中设置相应的参数。 2、办法一不能解决的情况下,解决办法如下: 设置runt time setting中的internet protocol-preferences中的advaced区域有一个winlnet replay instead of sockets选项,选项后再回放就成功了。切记此法只对windows系统起作用 Loadrunner相关问题 1,action和init、end除了迭代的区别还有其他吗? 在init、end 中不能使用集合点、事务等。 2,HTTP的超时有哪三种? HTTP-request connect timeout、HTTP-request receive timeout、step download timeout   3,在什么地方设置HTTP页面filter? 在runtime_settings中download filter里面进行设置。 4,pot mapping的原理是什么? 就是代理服务器 5,如何设置可以让一个虚拟IP对应到一个Vuser? 利用线程和进程做中介,逻辑上的对应。 选中Expert Mode,设置Options中的General   6,什么是contentcheck?如何来用? ContentCheck的设置是为了让VuGen 检测何种页面为错误页面。如果被测的Web 应用没有使用自定义的错误页面,那么这里不用作更改;如果被测的Web 应用使用了自定义的错误页面,那么这里需要定义,以便让VuGen 在运行过程中检测,服务器返回的页面是否包含预定义的字符串,进而判断该页面是否为错误页 面。如果是,VuGen就停止运行,指示运行失败。 使用方法:点击在runtime settings中点击“contentcheck”,然后新建立一个符合要求的应用程序和规则,设定需要查找的文本和前缀后缀即可使用。   7,network中的speed simulation是模拟的什么带宽? 模拟用户访问速度的带宽。   8,进程和线程有什么区别? 程和线程的区别网上很多,不作过多讨论,重点说一下其在LR中选择的区别。最显著的区别是:线程有 自己的全局数据。线程存在于进程中,因此一个进程的全局变量由所有的线程共享。由于线程共享同样的系 统区域,操作系统分配给一个进程的资源对该进程的所有线程都是可用的,正如全局数据可供所有线程使用 一样。在Controller中将使用驱动程序(如mdrv.exe、r3vuser.exe)运行vuser。如果按进程运行每个 vuser,则对于每个vuser实例,都将反复启动同一驱动程序并将其加载到内存中。将同一驱动程序加载到 内存中会占用大量的RAM(随机存储器)及其他系统资源。这就限制了可以在任一负载生成器上运行的 vuser数量。如果按线程运行每个vuser,Controller为每50个vuser(默认情况下)仅启动驱动程序(如 mdrv.exe)的一个实例。该驱动程序将启动几个vuser,每个vuser都按线程运行。这些线程vuser将共享父 驱动进程的内存段。这就消除了多次重新加载驱动程序/进程的需要,节省了大量内存空间,从而可以在一 个负载生成器上运行更多的Vuser。   9,生成WEB性能图有什么意义?大概描述即可。 可以很直观的看到,在负载下系统的运行情况以及各种资源的使用情况,可以对系统的性能瓶颈定位、性 能调优等起到想要的辅助作用。   10,如果刷新controller里的脚本? 在controller中,点击detailis-Refresh-script即可。   11,WAN emulation是模拟什么的? 答:是模拟广域网环境的。模拟大量网络基础架构的行为。可以设置突出 WAN 效果的参数(如延迟、丢包、动态路由效果和链接故障),并监控模拟设置对网络性能的影响。   12,如何把脚本和结果放到load generator的机器上? 在controller中,点击Results-Results settings,在里面进行相应的设置即可。   13,如何设置才能让集合点只对一半的用户生效? 对集合点策略进行相应的设置即可。即在controller中,点击Scenario-Rendezvous-policy进行相应的设 置即可,由于题目中“一半的用户”没有说明白具体指什么样的用户,现在不好确定具体对里面的哪个选项 进行设置。   14,在设置windows资源图监控的时候,用到的是什么端口和协议?在这一过程中,会有大概哪些问题?(大概描述) 这个比较容易看吧,连上去,netstat -nao就可以看了 microsoft-ds :445 ;要有权限、开启服务。 LR中的API分为几类? A:通用的API:,就是跟具体的协议无关,在任何协议的脚本里都能用的; B:针对协议的:像lrs前缀是winsock的;lrd的是针对database; C:自定义的:这个范围就比较广了; 比如至少有Java Vuser API 、lrapi、XML API。还可以添加WindowsAPI和自定义函数库。 树视图和脚本视图各有什么优点? 拖拽,用户可以把任意一个节点拖拽到他想 要的地方,从而达到修改脚本的目的。用户可以右键单击节点,进行修改/删除当前函数参数属性,增加函 数等操作,通过Tree View能够增加LoadRunner提供的部分常用通用函数和协议相关函数。 Script View适合一些高级用户,在Script View中能够看到一行行的API函数,通过Script View向脚本中增加一些其他API函数,对会编程的高手来说很方便 LR的协议包分为多少类? 协议包不是指vuser类型。打开LR后,在选择vuser类型时,我们一般选择的上面一个下拉框都是all protocol。那个就是我说的协议包。 应用程序部署解决方案:Citrix ICA。 客户端/服务器:DB2 CLI、DNS、Informix、MS SQL Server、ODBC、Oracle(2层)、Sybase Ctlib、Sybase Dblib和Windows Sockets协议。 自定义:C模板、Visual Basic模板、Java模板、JavaScript和VBScript类型的脚本。 分布式组件:适用于COM/DCOM、Corba-Java和Rmi-Java协议。 电子商务:FTP、LDAP、Palm、PeopleSoft 8 mulit-lingual、SOAP、Web(HTTP/HTML)和双Web/WinSocket协议。 Enterprise Java Bean:EJB测试和Rmi-Java协议。 ERP/CRM:Baan、Oracle NCA、PeopleSoft-Tuxedo、SAP-Web、SAPGUI、 Siebel-DB2 CLI、Siebel-MSSQL、Siebel-Web和Siebel-Oracle协议。 传统:终端仿真(RTE)。 邮件服务:Internet邮件访问协议(IMAP)、MS Exchange(MAPI)、POP3和SMTP。 中间件:Jacada和Tuxedo(6、7)协议。 流数据:Media Player(MMS)和Real协议。 无线:i-Mode、VoiceXML和WAP协议。 需要关联的数据怎么确定? (1)通过LR自动关联来确定。 (2)通过手动关联,查找服务器返回的动态数据,利用关联函数来确定。 (3)对录制好的脚本,通过“scan action for correlations或CTRL+F8”来进行扫描查找需要关联的数据 (4)如果知道需要做关联数据的左右边界等信息,可以自己添加相应的关联的规则来录制脚本,从而确定 需要关联的数据。 场景设置有哪几种方法? 性能测试用例设计首先要分析出用户现实中的典型场景,然后参照典型场景进行设计。下面详细介绍一下常见的三类用户场景:   一天内不同时间段的使用场景。在同一天内,大多数系统的使用情况都会随着时间发生变化。例如对于新浪、网易等门户网站,在周一到周五早上刚一上班时,可能邮件系统用户比较多,而上班前或者中午休息时间则浏览新闻的用户较多;而对于一般的OA系统则早上阅读公告的较多,其他时间可能很多人没有使用系统或者仅有少量的秘书或领导在起草和审批公文。这类场景分析的任务是找出对系统产生压力较大的场景进行测试。   系统运行不同时期的场景。系统运行不同时期的场景是大数据量性能测试用例设计的依据。随着时间的推移,系统历史数据将会不断增加,这将对系统响应速度产生很大的影响。大数据量性能测试通常会模拟一个月、一季度、半年、一年、……的数据量进行测试,其中数据量的上限是系统历史记录转移前可能产生的最大数据量,模拟的时间点是系统预计转移数据的某一时间。   不同业务模式下的场景。同一系统可能会处于不同的业务模式,例如很多电子商务系统在早上8点到10点以浏览模式为主,10点到下午3点以定购模式为主,而在下午3点以后可能以混合模式为主。因此需要分析哪些模式是典型的即压力较大的模式,进而对这些模式单独进行测试,这样做可以有效的对系统瓶颈进行隔离定位。与“一天内不同时间段的场景测试”不同,“不同业务模式下的场景测试”更专注于某一种模式的测试,而“一天内不同时间段的场景测试”则多数是不同模式的混合场景,更接近用户的实际使用情况 什么是吞吐量? 网络定义:吞吐量是指在没有帧丢失的情况下,设备能够接受的最大速率。 软件工程定义:吞吐量是指在单位时间内中央处理器(CPU)从存储设备读取->处理->存储信息的量。   影响吞吐量因素:   1、存储设备的存取速度,即从存储器读出数据或数据写入存储器所需时间;   2、CPU性能:1)时钟频率;                2)每条指令所花的时钟周期数(即CPI);   3)指令条数;   3、系统结构,如并行处理结构可增大吞吐量。 解释以下函数及他们的不同之处。 Lr_debug_message Lr_output_message Lr_error_message Lrd_stmt Lrd_fetch 【lr_message】 int lr_message (const char *format, exp1, exp2,…expn.); 中文解释:lr_message函数将信息发送到日志文件和输入窗口。在VuGen中运行时,输入文件为output.txt。 【lr_log_message】 int lr_log_message (const char *format, exp1, exp2,…expn.); 中文解释:lr_log_message函数将消息发送到Vuser或代理日志文件(取决于应用程序),而不是发送到输出窗口。通过向日志文件 发送错误消息或其他信息性消息,可以将该函数用于调试。 【lr_error_message】 int lr_error_message (const char *format, exp1, exp2,…expn. ); 中文解释:lr_error_message函数将错误消息发送到输出窗口和Vuser日志文件。要发送不是特定错误消息的特殊通知,请使用lr_output_message。 【lr_output_message】 int lr_output_message (const char *format, exp1, exp2,…expn.); 中文解释:lr_output_message函数将带有脚本部分的行号的消息发送到输出窗口和日志文件。 【lr_debug_message函数组】 int lr_debug_message (unsigned int message_level, const char *format, … ); 中文解释:lr_debug_message函数在指定的消息级别处于活动状态时发送一条调试信息。如果指定的消息级别未出于活动状态,则不 发送消息。您可以从用户界面或者使用lr_set_debug_message, 将处于活动状态的消息级别设置为 MSG_CLASS_BRIEF_LOG 或MSG_CLASSS_EXTENDED_LOG。要确定当前级别,请使用lr_get_debug_message。 unsigned int lr_get_debug_message ( ); 中文解释:lr_get_debug_message函数返回当前的日志运行时设置。该设置确定发送到输出端的信息。日志设置是使用运行时设置对 话框或通过使用lr_set_debug_message函数指定的。 int lr_set_debug_message (unsigned int message_level, unsigned int on_off); 中文解释:lr_set_debug_message函数设置脚本执行的调试消息级别message_lvl。通过设置消息级别,可以确定发送哪些信息。 启 动设置的方法是将LR_SWITCH_ON作为on_off传递,禁用设置的方法是传递LR_SWITCH_OFF。 【lrd_stmt 】:将SQL语句与光标关联 【lrd_fetch】: 提取结果集中得下一条记录 如何识别性能瓶颈? 性能瓶颈,可以侦测到使用显示器。这些显示器可能是应用服务器的监测,监控Web服务器,数据库服务器的监控和网络监控。他们帮助找到了动乱地区的情况,原因增加响应时间。该测量通常性能的响应时间,吞吐量,访问/秒,网络延迟图表等 响应时间和吞吐量之间的关系是什么? 吞吐量图显示的是虚拟用户每秒钟从服务器接收到的字节数。当和响应时间比较时,可以发现随着吞吐量的降低,响应时间也降低,同样的,吞吐量的峰值和最大响应时间差不多在同时出现。 以线程方式运行的虚拟用户有哪些优点? VuGen提供了用多线程的便利。这使得在每个生成器上可以跑更多的虚拟用户。如果是以进程的方式跑虚拟用户,为每个用户加载相同的驱动程序到内存中,因此占用了大量的内存。这就限制了在单个生成器上能跑的虚拟用户数。如果按进程运行,给定的所有虚拟用户数(比如100)只是加载一个驱动程序实例到内存里。每个进程共用父驱动程序的内存,因此在每个生成器上可以跑更多的虚拟用户。 LR中如何编写自定义函数? 在创建用户自定义函数前我们需要和创建DLL(external libary)。把库放在VuGen bin 目录下。一旦加了库,把自定义函数分配做一个参数。该函数应该具有一下格式:__declspec (dllexport) char* (char*, char*)。 如何调试LoadRunner脚本? VuGen 包含两个选项来帮助调试 Vuser 脚本:“分步运行”命令和断点。这些选 项不适用于 VBscript 和 VB 应用程序类型的 Vuser。 要查看“调试”工具栏,请执行下列操作: 右键单击工具栏区域,然后选择“调试”。“调试”工具栏将显示在工具栏区域 中。         “分步运行”命令 “分步运行”命令在运行脚本时一次运行一行。通过该命令,可以依次查看脚本 每一行的执行情况。 要分步运行脚本,请执行下列操作: 1 依次选择“Vuser” > “分步运行”,或者单击“调试”工具栏上的“步骤”按 钮。 VuGen 将执行脚本的第一行。 2 继续单击“步骤”按钮来执行该脚本,直到脚本运行完成为止。 断点 通过断点可以使脚本在特定位置暂停执行。它可用于在执行期间的预定点处检查 该脚本对应用程序的影响。要管理书签,请参阅第 186 页上的“断点管理器”。 要设置断点,请执行下列操作: 1 将光标置于脚本中要停止执行的行上。 2 依次选择“插入” > “切换断点”,或者单击“调试”工具栏上的“断点”按 钮。也可以按键盘上的 F9 键。将在脚本的左边距显示“断点”符号 ( )。 3 要禁用断点,请将光标置于包含断点符号的行上,然后单击“调试”工具栏上的 “启用 / 禁用断点”按钮。“断点”符号中将会显示一个白点 ( )。禁用一个断点 后,执行将在下一个断点处暂停。再次单击该按钮可以启用断点。 要删除断点,请将光标置于包含断点符号的行上,然后单击“断点”按钮或者按 F9 键。 要运行包含断点的脚本,请执行下列操作: 1 照常运行脚本。 到达断点时, VuGen 将暂停脚本的执行。可以检查脚本运行到断点时的效果, 并进行必要的更改,然后从断点处重新启动脚本。 2 要继续执行,请依次选择“Vuser” > “运行”。 重新启动后,脚本将继续执行,直到遇到下一个断点或脚本完成。 断点管理器 可以使用断点管理器来查看和管理断点。通过断点管理器您可以操纵脚本中的所 有断点。 要打开断点管理器,请选择“编辑” > “断点”。 要跳至脚本中的断点处,请执行下列操作: 1 从列表中选择一个断点。 2 单击“在脚本中突出显示”。则将在脚本中突出显示该行。 注意,每次只能突出显示一个断点。 管理断点 可以通过断点管理器添加、删除、禁用断点或者为断点设置条件 要添加断点,请执行下列操作: 1 单击“添加”。将打开“添加断点”对话框。 2 选择“操作”,并指定要添加断点的行号。 3 单击“确定”。该断点将被添加到断点列表中。 要删除断点,请执行下列操作: 1 要删除单个断点,请选择该断点并单击“删除”。 2 要立即删除所有断点,请单击“全部删除”。 要启用 / 禁用断点,请执行下列操作: 1 要启用断点,请在“操作”列内选中操作的复选框。 2 要禁用断点,请在“操作”列内清除操作的复选框。 通过断点管理器您可以将断点设置为在某些条件下暂停执行。 要为断点设置条件,请执行下列操作: 1 要在特定的迭代次数后暂停运行脚本,请选择“当迭代次数为下值时暂停”并输 入所需的数字。 2 要在参数 X 具有特定值时暂停脚本,请选择“当参数 X 值为下值时暂停”并输 入所需的值。有关参数的详细信息,请参阅第 8 章“使用 VuGen 参数”。 书签 当使用脚本视图时, VuGen 使您可以在脚本中各个不同的置放置书签。您可以 在书签之间导航来分析和调试代码。 要创建书签,请执行下列操作: 1 将光标置于所需的位置,然后按 Ctrl + F2 组合键。VuGen 会在脚本的左边距放 置一个图标。 2 要删除书签,请单击要删除的标签,然后按 Ctrl + F2 组合键。VuGen 将删除左 边距处的图标。 3 要在书签之间移动,请执行下列操作: 要移动到下一个书签,请按 F2 键。 要导航到上一个书签,请按 Shift + F2 组合键 您还可以通过“编辑” > “书签”菜单项来创建书签和在书签之间进行导航。 注意: 只能在当前操作中的书签之间导航。要导航到另一操作中的书签,请在左 窗格中选择该操作然后按 F2 键。 “转至”命令 要不使用书签在脚本中进行导航,可以使用“转至”命令。请依次选择“编辑” > “转至行”并指定脚本的行号。在树视图中也支持此种导航。 如果要检查特定步骤或函数的“回放日志”消息,请在 VuGen 中选择该步骤, 然后依次选择“编辑” > “转至回放日志中的步骤”。VuGen 将把光标放置在 “输出”窗口的“回放日志”选项卡中的相应步骤处。 你在VUGen中何时选择关闭日志?何时选择标准和扩展日志? Run-time,log, 当调试脚本时,可以只输出错误日志,当在场景找你管加载脚本时,日志自动变为不可用。 Standard Log Option:选择标准日志时,就会在脚本执行过程中,生成函数的标准日志并且输出信息,供调试用。大型负载测试场景不用启用这个选项。 扩展日志包括警告和其他信息。大型负载测试不要启用该选项。用扩展日志选项,可以指定哪些附加信息需要加到扩展日志中 你如何找出哪里需要关联?请给一些你所在项目的实例 哪里设置自动关联选项? 两种方法:首先,我们可以扫描的关联,看到的清单价值可关联。从这一点我们可以选择一个值的关联。其次,我们可以记录两个脚本并加以比较。我们可以期待的差异档案,看看的价值观,需要予以密切相关。在我的项目,有一个独特的ID为每一个客户,它只是保险号码,这是自动生成的,它是连续和这个值是独 一无二的。我有关联这个值,为了避免错误,同时运行的脚本。我没有使用扫描相关的 两种方法:首先,我们可以扫描的关联,看到的清单价值可关联。从这一点我们可以选择一个值的关联。其次,我们可以记录两个脚本并加以比较。我们可以期待的差异档案,看看的价值观,需要予以密切相关。在我的项目,有一个独特的ID为每一个客户,它只是保险号码,这是自动生成的,它是连续和这个值是独一无二的。我有关联这个值,为了避免错误,同时运行的脚本。我没有使用扫描相关的 比如登陆网站后的sessionID 请解释一下如何录制web脚本? 解释:1.基于浏览器的应用程序推荐使用HTML-based Script, 脚本中采用 HTML页面的形式来表示,这种方式的Script脚本容易维护,容易理解,使用该选项中的advance中的第一个选项,如果单纯的HTML方式,是不允许使用关联的。 2.不是基于浏览器的应用程序推荐使用URL-based Script,脚本中的表示采用基于URL 的方式,不是很好阅读。 解释:1.是否记录录制过程中的ThinkTime,如果记录,还可以设置最大值,一般我不记录这个值。 2.通知Vugen去重新设置每个action之间的Http context,缺省是需要的。 3.完整记录录制过程的log, 4.保存一个本地的snapshot,可以加速显示 5.把html的title放到web_reg_find函数里面 6.支持的字符集标准 7.Http header的录制,我们采用缺省即可,不需要用web_add_header去录制非标准的header信息。 对录制的content的内容进行filter,不作为resource处理的。 解释:这个就是我前面提到的关联,系统已经预先设置好了一些常见的关联rules,我们录制脚本之前,可以把系统的 什么是场景?场景的重要性有哪些?如何设置场景? 用例场景应该说是写测试用例,甚至是分析测试要素、设计测试策略另外一个重要的依据了。 首先,软件研发最终是要再用户那里使用的,用例场景都将在用户的使用过程中被一一实现。 其次,需求的文档会变,设计会变,但用户的用例场景是基本上不会变的(除非是政策或者战略上的变更)。这样使测试工作的任务更加明确了,也更加容易定义修改的优先级以及在修改建议上和开发人员达成一致。毕竟满足用户的用例场景是首要的。 与微软等技术主导的软件企业相比,我向国内的软件更多的是市场主导,用户需求主导的软件企业和设计思想甚至开发模式。 用例场景会比需求文档和分析报告更容易理解,同时也是对于理解用户的需求,产品设计更有帮助。在测试中能够帮助我们发现不仅仅是功能上的问题。 测试有两个目的:确认功能是否实现正确;确认软件是否实现了正确的功能。 “正确的功能”,我想就是符合用户需求的功能吧?不根据 什么是集合点?设置集合点有什么意义?Loadrunner中设置集合点的函数是哪个? 插入集合点是为了衡量在加重负载的情况下服务器的性能情况。在测试计划中,可能会要求系统能够承受1000 人同时提交数据,在LoadRunner 中可以通过在提交数据操作前面加入集合点,这样当虚拟用户运行到提交数据的集合点时,LoadRunner 就会检查同时有多少用户运行到集合点,如果不到1000 人,LoadRunner 就会命令已经到集合点的用户在此等待,当在集合点等待的用户达到1000 人时,LoadRunner 命令1000 人同时去提交数据,从而达到测试计划中的需求。 说明:在脚本中设置了“集合点”后,当运行场景时可以对集合点进行设置,可以设置当百分之多少用户到达时,系统开始执行以下操作,详细的可以参考中文的用户手册 添加方法: 1、其中录制脚本script view中添加:lr_rendezvous(“XXX”); 2、在录制脚本的tree view里添加:rendezvous-XXX; LoadRunner由哪些部件组成? 使用LoadRunner 完成测试一般分为四个步骤:   1)Virtual User Generator 创建脚本   创建脚本,选择协议   录制脚本   编辑脚本   检查修改脚本是否有误   2)中央控制器(Controller)来调度虚拟用户   创建Scenario,选择脚本   设置机器虚拟用户数   设置Schedule   如果模拟多机测试,设置Ip Spoofer   3)运行脚本   分析scenario   4)分析测试结果   安装LoadRunner 中文版   LoadRunner 分为Windows 版本和Unix 版本。如果我们的所有测试环境基于Windows 平台, 那么我们只要安装Windows 版本即可。本章讲解的安装过程就是LoadRunner7.8中文的Windows 版本的安装。 简述使用Loadrunner的步骤 1   开发测试脚本 工具:VuGen 步骤: 1).使用VuGen提供的录制功能,自动产生基本的脚本。 2).在基本脚本的基础之上,编辑脚本。在比较重要的业务环节中插入 Transactions来衡量该环节中服务器的性能 Rendezvous   points(集合点)衡量最常用的环节在n个用户同时访问的大负载量下的性能 添加注释,便于维护 参数化输入 3)Run-Time设置 - General:“Automatic   Transactions”可以选择第二个,这样LoadRunner默认把每一步操作都当作Transactions处理 - Proxys:不要使用代理服务器,或者在IE中设置本地连接不使用代理 - Browser   Emulation:Advanced   ——Step   Download   Timeout   默认是120s,建议设的时间短一点,在60s之内(因为实际用户可能没有那么大的耐心) - NetWork:暂且使用最大带宽吧 4).在VuGen中运行一下脚本,确保没有任何错误 注意:   可能会在VuGen中开发多个脚本,每个脚本的开发最好遵从以上的步骤 2   创建测试场景 工具:Controller 步骤: 1). 选择场景的类型:根据现在的情况,选择“Manual   Scenario”,配置时可以更加的灵活 2). 选择每个脚本要运行的虚拟用户数量 3). 添加Load   Generator,添加后要connect一次,确保连接正常 4). 分配用户到不同的Load   Genrator上 5). 配置Rendezvous 6). Run-Time设置:同上设置 7). 配置Schedule:为了充分利用资源,可以配置成晚上10:00以后开始运行,连续运行n个小时,第二天上班来看结果 8). 设置结果文件的保存路径 9). 添加性能计数器:(以下所有性能计数器采用默认即可) - System   Resources——Windows   Resources   默认即可 -  NetWork   Delay   Time - MSIIS - ASP.NET   Applications - oracle (简单步骤描述: 1,创建脚本-创建脚本,选择协议-录制脚本-编辑脚本-检查修改脚本是否有误 2,用中央控制器来调度虚拟用户-创建场景,选择脚本-设置机器虚拟用户数-设置事务-如果模拟多机测试,设置IP 3,运行脚本 4,分析测试结果 什么是并发?在lordrunner中,如何进行并发的测试? 在同一时间点,支持多个不同的操作。LoadRunner中提供IP伪装,集合点,配合虚拟用户的设计,以及在多台电脑上设置,可以比较好的模拟真实的并发。 LoadRunner面试题 英文的 1. What is load testing? – Load testing is to test that if the application works fine with the loads that result from large number of simultaneous users, transactions and to determine weather it can handle peak usage periods. 2. What is Performance testing? – Timing for both read and update transactions should be gathered to determine whether system functions are being performed in an acceptable timeframe. This should be done standalone and then in a multi user environment to determine the effect of multiple transactions on the timing of a single transaction. 3. Did u use LoadRunner? What version? – Yes. Version 7.2. 4. Explain the Load testing process? - Step 1: Planning the test. Here, we develop a clearly defined test plan to ensure the test scenarios we develop will accomplish load-testing objectives. Step 2: Creating Vusers. Here, we create Vuser scripts that contain tasks performed by each Vuser, tasks performed by Vusers as a whole, and tasks measured as transactions. Step 3: Creating the scenario. A scenario describes the events that occur during a testing session. It includes a list of machines, scripts, and Vusers that run during the scenario. We create scenarios using LoadRunner Controller. We can create manual scenarios as well as goal-oriented scenarios. In manual scenarios, we define the number of Vusers, the load generator machines, and percentage of Vusers to be assigned to each script. For web tests, we may create a goal-oriented scenario where we define the goal that our test has to achieve. LoadRunner automatically builds a scenario for us. Step 4: Running the scenario. We emulate load on the server by instructing multiple Vusers to perform tasks simultaneously. Before the testing, we set the scenario configuration and scheduling. We can run the entire scenario, Vuser groups, or individual Vusers. Step 5: Monitoring the scenario. We monitor scenario execution using the LoadRunner online runtime, transaction, system resource, Web resource, Web server resource, Web application server resource, database server resource, network delay, streaming media resource, firewall server resource, ERP server resource, and Java performance monitors. Step 6: Analyzing test results. During scenario execution, LoadRunner records the performance of the application under different loads. We use LoadRunner.s graphs and reports to analyze the application.s performance. 5. When do you do load and performance Testing? – We perform load testing once we are done with interface (GUI) testing. Modern system architectures are large and complex. Whereas single user testing primarily on functionality and user interface of a system component, application testing focuses on performance and reliability of an entire system. For example, a typical application-testing scenario might depict 1000 users logging in simultaneously to a system. This gives rise to issues such as what is the response time of the system, does it crash, will it go with different software applications and platforms, can it hold so many hundreds and thousands of users, etc. This is when we set do load and performance testing. 6. What are the components of LoadRunner? – The components of LoadRunner are The Virtual User Generator, Controller, and the Agent process, LoadRunner Analysis and Monitoring, LoadRunner Books Online. 7. What Component of LoadRunner would you use to record a Script? – The Virtual User Generator (VuGen) component is used to record a script. It enables you to develop Vuser scripts for a variety of application types and communication protocols. 8. What Component of LoadRunner would you use to play Back the script in multi user mode? – The Controller component is used to playback the script in multi-user mode. This is done during a scenario run where a vuser script is executed by a number of vusers in a group. 9. What is a rendezvous point? – You insert rendezvous points into Vuser scripts to emulate heavy user load on the server. Rendezvous points instruct Vusers to wait during test execution for multiple Vusers to arrive at a certain point, in order that they may simultaneously perform a task. For example, to emulate peak load on the bank server, you can insert a rendezvous point instructing 100 Vusers to deposit cash into their accounts at the same time. 10. What is a scenario? – A scenario defines the events that occur during each testing session. For example, a scenario defines and controls the number of users to emulate, the actions to be performed, and the machines on which the virtual users run their emulations. 11. Explain the recording mode for web Vuser script? – We use VuGen to develop a Vuser script by recording a user performing typical business processes on a client application. VuGen creates the script by recording the activity between the client and the server. For example, in web based applications, VuGen monitors the client end of the database and traces all the requests sent to, and received from, the database server. We use VuGen to: Monitor the communication between the application and the server; Generate the required function calls; and Insert the generated function calls into a Vuser script. 12. Why do you create parameters? – Parameters are like script variables. They are used to vary input to the server and to emulate real users. Different sets of data are sent to the server each time the script is run. Better simulate the usage model for more accurate testing from the Controller; one script can emulate many different users on the system. 13. What is correlation? Explain the difference between automatic correlation and manual correlation? – Correlation is used to obtain data which are unique for each run of the script and which are generated by nested queries. Correlation provides the value to avoid errors arising out of duplicate values and also optimizing the code (to avoid nested queries). Automatic correlation is where we set some rules for correlation. It can be application server specific. Here values are replaced by data which are created by these rules. In manual correlation, the value we want to correlate is scanned and create correlation is used to correlate. 14. How do you find out where correlation is required? Give few examples from your projects? – Two ways: First we can scan for correlations, and see the list of values which can be correlated. From this we can pick a value to be correlated. Secondly, we can record two scripts and compare them. We can look up the difference file to see for the values which needed to be correlated. In my project, there was a unique id developed for each customer, it was nothing but Insurance Number, it was generated automatically and it was sequential and this value was unique. I had to correlate this value, in order to avoid errors while running my script. I did using scan for correlation. 15. Where do you set automatic correlation options? – Automatic correlation from web point of view can be set in recording options and correlation tab. Here we can enable correlation for the entire script and choose either issue online messages or offline actions, where we can define rules for that correlation. Automatic correlation for database can be done using show output window and scan for correlation and picking the correlate query tab and choose which query value we want to correlate. If we know the specific value to be correlated, we just do create correlation for the value and specify how the value to be created. 16. What is a function to capture dynamic values in the web Vuser script? – Web_reg_save_param function saves dynamic data information to a parameter. 17. When do you disable log in Virtual User Generator, When do you choose standard and extended logs? – Once we debug our script and verify that it is functional, we can enable logging for errors only. When we add a script to a scenario, logging is automatically disabled. Standard Log Option: When you select Standard log, it creates a standard log of functions and messages sent during script execution to use for debugging. Disable this option for large load testing scenarios. When you copy a script to a scenario, logging is automatically disabled Extended Log Option: Select extended log to create an extended log, including warnings and other messages. Disable this option for large load testing scenarios. When you copy a script to a scenario, logging is automatically disabled. We can specify which additional information should be added to the extended log using the Extended log options. 18. How do you debug a LoadRunner script? – VuGen contains two options to help debug Vuser scripts-the Run Step by Step command and breakpoints. The Debug settings in the Options dialog box allow us to determine the extent of the trace to be performed during scenario execution. The debug information is written to the Output window. We can manually set the message class within your script using the lr_set_debug_message function. This is useful if we want to receive debug information about a small section of the script only. 19. How do you write user defined functions in LR? Give me few functions you wrote in your previous project? – Before we create the User Defined functions we need to create the external library (DLL) with the function. We add this library to VuGen bin directory. Once the library is added then we assign user defined function as a parameter. The function should have the following format: __declspec (dllexport) char* (char*, char*)Examples of user defined functions are as follows:GetVersion, GetCurrentTime, GetPltform are some of the user defined functions used in my earlier project. 20. What are the changes you can make in run-time settings? – The Run Time Settings that we make are: a) Pacing – It has iteration count. b) Log – Under this we have Disable Logging Standard Log and c) Extended Think Time – In think time we have two options like Ignore think time and Replay think time. d) General – Under general tab we can set the vusers as process or as multithreading and whether each step as a transaction. 21. Where do you set Iteration for Vuser testing? – We set Iterations in the Run Time Settings of the VuGen. The navigation for this is Run time settings, Pacing tab, set number of iterations. 22. How do you perform functional testing under load? – Functionality under load can be tested by running several Vusers concurrently. By increasing the amount of Vusers, we can determine how much load the server can sustain. 23. What is Ramp up? How do you set this? – This option is used to gradually increase the amount of Vusers/load on the server. An initial value is set and a value to wait between intervals can be specified. To set Ramp Up, go to ‘Scenario Scheduling Options’ 24. What is the advantage of running the Vuser as thread? – VuGen provides the facility to use multithreading. This enables more Vusers to be run per generator. If the Vuser is run as a process, the same driver program is loaded into memory for each Vuser, thus taking up a large amount of memory. This limits the number of Vusers that can be run on a single generator. If the Vuser is run as a thread, only one instance of the driver program is loaded into memory for the given number of Vusers (say 100). Each thread shares the memory of the parent driver program, thus enabling more Vusers to be run per generator. 25. If you want to stop the execution of your script on error, how do you do that? – The lr_abort function aborts the execution of a Vuser script. It instructs the Vuser to stop executing the Actions section, execute the vuser_end section and end the execution. This function is useful when you need to manually abort a script execution as a result of a specific error condition. When you end a script using this function, the Vuser is assigned the status “Stopped”. For this to take effect, we have to first uncheck the .Continue on error. option in Run-Time Settings. 26. What is the relation between Response Time and Throughput? – The Throughput graph shows the amount of data in bytes that the Vusers received from the server in a second. When we compare this with the transaction response time, we will notice that as throughput decreased, the response time also decreased. Similarly, the peak throughput and highest response time would occur approximately at the same time. 27. Explain the Configuration of your systems? – The configuration of our systems refers to that of the client machines on which we run the Vusers. The configuration of any client machine includes its hardware settings, memory, operating system, software applications, development tools, etc. This system component configuration should match with the overall system configuration that would include the network infrastructure, the web server, the database server, and any other components that go with this larger system so as to achieve the load testing objectives. 28. How do you identify the performance bottlenecks? – Performance Bottlenecks can be detected by using monitors. These monitors might be application server monitors, web server monitors, database server monitors and network monitors. They help in finding out the troubled area in our scenario which causes increased response time. The measurements made are usually performance response time, throughput, hits/sec, network delay graphs, etc. 29. If web server, database and Network are all fine where could be the problem? – The problem could be in the system itself or in the application server or in the code written for the application. 30. How did you find web server related issues? – Using Web resource monitors we can find the performance of web servers. Using these monitors we can analyze throughput on the web server, number of hits per second that occurred during scenario, the number of http responses per second, the number of downloaded pages per second. 31. How did you find database related issues? – By running .Database. monitor and help of .Data Resource Graph. we can find database related issues. E.g. You can specify the resource you want to measure on before running the controller and than you can see database related issues 32. Explain all the web recording options? 33. What is the difference between Overlay graph and Correlate graph? – Overlay Graph: It overlay the content of two graphs that shares a common x-axis. Left Y-axis on the merged graph show.s the current graph.s value & Right Y-axis show the value of Y-axis of the graph that was merged. Correlate Graph: Plot the Y-axis of two graphs against each other. The active graph.s Y-axis becomes X-axis of merged graph. Y-axis of the graph that was merged becomes merged graph.s Y-axis. 34. How did you plan the Load? What are the Criteria? – Load test is planned to decide the number of users, what kind of machines we are going to use and from where they are run. It is based on 2 important documents, Task Distribution Diagram and Transaction profile. Task Distribution Diagram gives us the information on number of users for a particular transaction and the time of the load. The peak usage and off-usage are decided from this Diagram. Transaction profile gives us the information about the transactions name and their priority levels with regard to the scenario we are deciding. 35. What does vuser_init action contain? – Vuser_init action contains procedures to login to a server. 36. What does vuser_end action contain? – Vuser_end section contains log off procedures. 37. What is think time? How do you change the threshold? – Think time is the time that a real user waits between actions. Example: When a user receives data from a server, the user may wait several seconds to review the data before responding. This delay is known as the think time. Changing the Threshold: Threshold level is the level below which the recorded think time will be ignored. The default value is five (5) seconds. We can change the think time threshold in the Recording options of the Vugen. 38. What is the difference between standard log and extended log? – The standard log sends a subset of functions and messages sent during script execution to a log. The subset depends on the Vuser type Extended log sends a detailed script execution messages to the output log. This is mainly used during debugging when we want information about: Parameter substitution. Data returned by the server. Advanced trace. 39. Explain the following functions: – lr_debug_message – The lr_debug_message function sends a debug message to the output log when the specified message class is set. lr_output_message – The lr_output_message function sends notifications to the Controller Output window and the Vuser log file. lr_error_message – The lr_error_message function sends an error message to the LoadRunner Output window. lrd_stmt – The lrd_stmt function associates a character string (usually a SQL statement) with a cursor. This function sets a SQL statement to be processed. lrd_fetch – The lrd_fetch function fetches the next row from the result set. 40. Throughput – If the throughput scales upward as time progresses and the number of Vusers increase, this indicates that the bandwidth is sufficient. If the graph were to remain relatively flat as the number of Vusers increased, it would be reasonable to conclude that the bandwidth is constraining the volume of data delivered. 41. Types of Goals in Goal-Oriented Scenario – Load Runner provides you with five different types of goals in a goal oriented scenario: o The number of concurrent Vusers o The number of hits per second o The number of transactions per second o The number of pages per minute o The transaction response time that you want your scenario 42. Analysis Scenario (Bottlenecks): In Running Vuser graph correlated with the response time graph you can see that as the number of Vusers increases, the average response time of the check itinerary transaction very gradually increases. In other words, the average response time steadily increases as the load increases. At 56 Vusers, there is a sudden, sharp increase in the average response time. We say that the test broke the server. That is the mean time before failure (MTBF). The response time clearly began to degrade when there were more than 56 Vusers running simultaneously. 43. What is correlation? Explain the difference between automatic correlation and manual correlation? – Correlation is used to obtain data which are unique for each run of the script and which are generated by nested queries. Correlation provides the value to avoid errors arising out of duplicate values and also optimizing the code (to avoid nested queries). Automatic correlation is where we set some rules for correlation. It can be application server specific. Here values are replaced by data which are created by these rules. In manual correlation, the value we want to correlate is scanned and create correlation is used to correlate. 44. Where do you set automatic correlation options? – Automatic correlation from web point of view, can be set in recording options and correlation tab. Here we can enable correlation for the entire script and choose either issue online messages or offline actions, where we can define rules for that correlation. Automatic correlation for database, can be done using show output window and scan for correlation and picking the correlate query tab and choose which query value we want to correlate. If we know the specific value to be correlated, we just do create correlation for the value and specify how the value to be created. 45. What is a function to capture dynamic values in the web vuser script? – Web_reg_save_param function saves dynamic data information to a parameter. (  1。什么是负载测试吗?-负载测试是测试,如果应用程序美好的荷载引起大量的同时用户、交易和确定能应付天气使用的高峰期的时期。 2。性能测试是什么?同时读取-时机和更新交易是否应该聚集在系统的功能正在进行一个可接受的时间。这应该是独立的,然后做在多用户环境的影响,确定mult) Loadrunner面试题 Q1:什么是负载测试?什么是性能测试?   A1:负载测试是通过逐步增加系统负载,测试系统性能的变化,并最终确定在满足性能指标的情况下,系统所能承受的最大负载量的测试,例如,访问一个页面的响应时间规定不超过1秒,负载测试就是测试在响应时间为1秒时,系统所能承受的最大并发访问用户的数量。   性能测试:指在一定的约束条件下(指定的软件、硬件、网络环境等),确定系统所能承受的最大负载压力。   Q2.性能测试包含了哪些测试(至少举出3种)   A2:性能测试包含负载测试、压力测试、大数据量测试、疲劳强度测试等。   Q3.简述性能测试的步骤   Q4.简述使用Loadrunner的步骤   A4:制定性能测试计划—>开发测试脚本—>设计测试场景—>执行测试场景—>监控测试场景—>分析测试结果   Q5.什么时候可以开始执行性能测试?   A5:功能测试通过;一般需要进行性能测试的系统,都是用户量比较大、业务使用比较频繁、比较重要的功能模块。   Q6.LoadRunner由哪些部件组成?   A6:主要有三部分组成:   Q7.你使用LoadRunner的哪个部件来录制脚本?   A7:使用Virtual User Generator录制测试脚本   Q8.LoadRunner的哪个部件可以模拟多用户并发下回放脚本?   A8:LoadRunner的Controller组件。   Q9.什么是集合点?设置集合点有什么意义?Loadrunner中设置集合点的函数是哪个?   A9:在性能测试过程中,需要模拟大量用户在同一时刻,访问系统并同时操作某一任务,可以通过配置集合点来实现,多个用户同时进行某操作;   集合点可以在服务器上创建密集的用户负载,使LoadRunner能够测试服务器在负载状态下的性能。   设置集合点函数:lr_rendezvous(“Meeting”); // Meeting是集合点名称   Q10.什么是场景?场景的重要性有哪些?如何设置场景?   A10:场景用于模拟用户实际业务操作;   LoadRunner中场景有手工场景和面向目标的场景。   设置场景:选择场景类型、设置运行时设置、模拟用户数、加减压方式、持续时间,配置负载生成器。  Q11.请解释一下如何录制web脚本?   A11:利用Virtual User Generator录制测试脚本,录制步骤:   1、选择合适的协议   2、设置录制选项   3、开始录制   Q12.为什么要创建参数?如何创建参数?   A12:LoadRunner在录制脚本的时候,只是忠实的记录了所有从客户端发送到服务器的数据,而在进行性能测试的时候,为了更接近真实的模拟现实应用,对于某些信息需要每次提交不同的数据,或者使用多个不同的值进行循环输入。这时,在LoadRunner中就可以进行参数化设置,以使用多个不同的值提交应用请求。   【参数化】:使用指定数据源中的值来替换脚本录制生成的语句中的参数。   【参数化好处】   ● 减少脚本的大小   ● 提供使用不同的值执行脚本的能力,更加真实的模拟现实应用。   【参数化步骤】   ● 用参数替换Vuser脚本中的常量值   ● 为参数设置属性和数据源   Q13.什么是关联?请解释一下自动关联和手动关联的不同。   A13:【关联的定义】简单的说:就是把脚本中某些写死(固定)的数据,转变成动态的数据,或者说将前面语句的结果数据保存下来,然后在后面的语句提交请求时使用这些数据。   【需要关联的前提条件】:   客户端需要从服务器端返回数据中获取部分数据,并将这些部分数据处理后作为自己下一次请求的一部分发出。   【自动关联与手工关联的不同】:自动关联是在脚本录制过程中,VuGen会根据已经制定好的规则,自动找出需要关联的值或脚本录制完成后,执行脚本一次,通过Correlation Studio自动找出需要关联的数据,并建立关联;而手动关联是需要录制两份相同业务流程的脚本,输入的数据要相同,利用WinDiff工具,找出两份脚本之间不同之处,也就是需要关联的数据,再通过web_reg_save_param函数手动建立关联,将脚本中用到关联的数据参数化。 Q14.你如何找出哪里需要关联?请给一些你所在项目的实例。   A14:   1、录制两份相同业务流程的脚本,输入的数据要相同   2、利用WinDiff工具,找出两份脚本之间不同之处,也就是需要关联的数据   3、通过web_reg_save_param函数手动建立关联,将脚本中用到关联的数据参数化。   示例:   通过录制两份脚本,进行对比,可知jsessionid、sap-ext-sid、sap-wd-cltwndid、sap-wd-tstamp需要进行关联。   Q15.你在哪里设置自动关联选项?   A15:录制选项中进行设置,如下图所示:   Q16.哪个函数是用来截取虚拟用户脚本中的动态值?(手工关联)   A16:Web_reg_save_param函数主要根据需要做关联的动态数据前面和后面的固定字符串来识别、提取动态数据,所以在做关联时,需要找出动态数据的左、右边界字符串。   1.函数原型:   int web_reg_save_param (const char *ParamName, , LAST);   2.参数说明:   ParamNam:存放动态数据的参数名称   List of Attributes:其它属性,包含Notfound、LB、RB、RelFrameID、Search、ORD、SaveOffset、Convert、SaveLen。 Q21.你在不同的环境下如何设置迭代?   A21:在“运行时设置”中设置,如下图所示:   Q22.你如何在负载测试模式下执行功能测试?   A22:在负载测试模式下,可以通过同时运行数个虚拟用户,通过增加虚拟用户数,确定服务器在多大的负载量下,仍然可以正常运行,我一般进行核心功能操作,验证核心功能运行是否正常。   Q23.什么是逐步递增?你如何来设置?   A23:虚拟用户数随着负载时间逐渐增加,可以帮助确定系统响应时间减慢的准确时间点。   可以在“加压”选项卡中进行设置:如下图所示,将设置更改为:“每 30 秒启动 2 个 Vuser”   Q24.以线程方式运行的虚拟用户有哪些优点?   A24:以线程方式运行的虚拟用户,在默认情况下,Controller为每50个用户仅启动一个mmdrv进程,而每个用户都按线程方式来运行,这些线程用户将共享父进程的内存,这就节省了大量内存空间,从而可以在一个负载生成器上运行更多的用户。   Q25.当你需要在出错时停止执行脚本,你怎么做?   A25:取消运行设置中的“Continue on error”复选框。   或者使用lr_abort函数。   Q26.响应时间和吞吐量之间的关系是什么?   A26:当系统吞吐量未达到系统处理极限时,系统性能不会衰减,交易平均响应时间一般也不会递增,当系统达到吞吐量极限时,客户端交易会在请求队列中排队等待,等待的时间会记录在响应时间中,故交易平均响应时间一般会递增。   Q27.说明一下如何在LR中配置系统计数器?   A27:以windows资源监控为例,可右键点“添加度量”,输入系统IP、选择平台类型,确定即可,详细参加LR自带操作手册^_^。   对于监控不同类型的操作系统,需要做一些准备工作,可参见监控操作系统资源部分。 Q28.你如何识别性能瓶颈?   A28:性能瓶颈分为:硬件瓶颈和软件瓶颈   性能瓶颈可以通过监控器来分析发现,这些监控器包括应用服务器监控、web服务器监控、数据库服务器监控器和网络监控器;它们可以帮助分析导致响应时间增加的原因;性能度量一般包括响应时间、吞吐量、每秒点击率、网络延迟等等。   Q29.如果web服务器、数据库以及网络都正常,问题会出在哪里?   A29:问题可能出在系统本身或应用服务器、或为应用编写的代码编写中。   Q30.如何发现web服务器的相关问题?   A30:可以利用web资源监控器发现web服务器相关问题,在场景执行过程中,可以利用监控器分析web服务器吞吐量、每秒点击率、每秒HTTP响应数、每秒页面下载数,以及web服务器硬件资源使用情况等。   Q31.如何发现数据库的相关问题?   A31:可以通过数据库监控器和数据资源图发现数据库相关的问题,例如在运行Controller之前,可以指定需要度量的资源,之后可以根据监控的数据,分析数据库相关的问题。   Q32.解释所有web录制配置?   A32:选择录制协议、设置录制选项、选择浏览器、选择存放路径、开始录制。   Q33.解释一下覆盖图和关联图的区别?   A33:覆盖图:合并两个图的内容,使用同一个X轴,合并图左Y轴显示当前图的值,合并图右Y轴显示被合并图的值。   关联图:当前活动图的Y轴变为合并图的X轴,被合并图的Y轴变成合并图的Y轴。   Q34.你如何设计负载?标准是什么?   A34:负载测试计划多少用户数量、使用什么类型的机器、以及在什么环境下进行。主要基于两个重要的文档,任务分布图和事务信息,任务分布图告诉我们在负载时间段内,某一个事务使用的用户数,高峰使用率及低峰使用率均来自该文档;   事务信息告诉我们事务名及优先级,在设计场景时可以参考。   Q35.Vuser_init中包括什么内容?   A35:Vuser_init中包含在脚本执行过程中只需执行一次的脚本。一般来说,所有需要初始化的都可以放在vuser_init里面,比如登录。   Q36. Vuser_end中包括什么内容?   A36:vuser_end中一般包含退出的过程,比如退出系统,主要在脚本执行完成或停止时运行,在设置了迭代次数时,vuser_end和vuser_int均只执行一次。   Q37.什么是think time?think_time有什么用?   A37:思考时间:用户在各步骤之间停下来进行思考的时间,由于用户基于其经验水平和目标而与应用程序进行交互操作,因此技术水平更高的用户工作起来可能会比新用户要快。   通过启用思考时间,可以使 Vuser在负载测试期间更准确地模拟其对应的真实世界用户。   Q38.标准日志和扩展日志的区别是什么?   A38:标准日志:脚本执行过程中,将函数集及信息发送到日志文件中   扩展日志:可以将详细的脚本执行信息输出到日志文件中,可以选择以下三种扩展日志信息:   ● 参数替换:脚本运行过程中,可以将参数及当前参数值输出到日志文件中   ● 服务器返回的数据:将服务器返回给客户端的数据输出到日志文件中   ● 高级跟踪:所有的虚拟用户信息和函数调用输出到日志文件中   Q39.解释以下函数及他们的不同之处。   A39:lr_debug_message:发送调试信息到输出窗口或业务监控日志文件中   lr_output_message:发送日志信息到输出窗口或业务监控日志文件中   lr_error_message:发送错误信息到输出窗口或业务监控日志文件中   lrd_stmt:赋予一个SQL语句用于处理   lrd_fetch:获取结果集中的下一行数据   Q40.什么是吞吐量?   A40:客户端每秒从服务器接收到的数据,或系统服务器每秒能处理通过的交易数。一般随着虚拟用户数的增加,吞吐量也增加,说明网络带宽比较充足,反之,吐过随着虚拟用户数的增加,吞吐量比较平稳,呈直线状态,则说明网络带宽成为瓶颈,限制了数据传输。   Q41.场景设置有哪几种方法?   A41:面向目标的场景设置和手动场景 性能测试工程师的面试题(翻译之前的一套面试题) 1.什么是负载测试?什么是性能测试? 2.性能测试包含了哪些测试(至少举出3种) 3.简述性能测试的步骤 4.简述使用Loadrunner的步骤 5.什么时候可以开始执行性能测试? 6.LoadRunner由哪些部件组成? 7.你使用LoadRunner的哪个部件来录制脚本? 8.LoadRunner的哪个部件可以模拟多用户并发下回放脚本? 9.什么是集合点?设置集合点有什么意义?Loadrunner中设置集合点的函数是哪个? 10.什么是场景?场景的重要性有哪些?如何设置场景? 11.请解释一下如何录制web脚本? 12.为什么要创建参数?如何创建参数? 13.什么是关联?请解释一下自动关联和手动关联的不同。 14.你如何找出哪里需要关联?请给一些你所在项目的实例。 15.你在哪里设置自动关联选项? 16.哪个函数是用来截取虚拟用户脚本中的动态值?(手工管联) 17.你在VUGen中何时选择关闭日志?何时选择标准和扩展日志? 18.你如何调试LoadRunner脚本? 19你在LR中如何编写自定义函数?请给出一些你在以前进行的项目中编写的函数。 20.在运行设置下你能更改那些设置? 21.你在不同的环境下如何设置迭代? 22.你如何在负载测试模式下执行功能测试? 23.什么是逐步递增?你如何来设置? 24.以线程方式运行的虚拟用户有哪些优点? 25.当你需要在出错时停止执行脚本,你怎么做? 26.响应时间和吞吐量之间的关系是什么? 27.说明一下如何在LR中配置系统计数器? 28.你如何识别性能瓶颈? 29.如果web服务器、数据库以及网络都正常,问题会出在哪里? 30.如何发现web服务器的相关问题? 31.如何发现数据库的相关问题? 32.解释所有web录制配置? 33.解释一下覆盖图和关联图的区别? 34.你如何设计负载?标准是什么? 35.Vuser_init中包括什么内容? 36. Vuser_end中包括什么内容? 37.什么是think time?think_time有什么用? 38.标准日志和扩展日志的区别是什么? 39.解释以下函数及他们的不同之处。 Lr_debug_message Lr_output_message Lr_error_message Lrd_stmt Lrd_fetch 40.什么是吞吐量? 41.场景设置有哪几种方法? 雅虎公司C#笔试题(1) 雅虎公司C#笔试题,包括问答题和选择题两部分。试试看,你能回答出多少题,可以通过雅虎的考试吗? Question 1. (单选) 在计算机网络中,表征数据传输可靠性的指标是 1. 传输率 2. 误码率 3. 信息容量 4. 频带利用率 Question 2. (单选) 以下关于链式存储结构的叙述中哪一条是不正确的? 1. 结点除自身信息外还包括指针域,因此存储密度小于顺序存储结构 2. 逻辑上相邻的结点物理上不必邻接 3. 可以通过计算直接确定第i个结点的存储地址 4. 插入、删除运算操作方便,不必移动结点 Question 3. (单选) 以下哪一个不是栈的基本运算 1. 删除栈顶元素 2. 删除栈底元素 3. 判断栈是否为空 4. 将栈置为空栈 Question 4. (单选) 以下关于广义表的叙述中,正确的是 1. 广义表是0个或多个单元素或子表组成的有限序列 2. 广义表至少有一个元素是子表 3. 广义表不可以是自身的子表 4. 广义表不能为空表 Question 5. (单选) 如果一棵二叉树结点的前序序列是A、B、C,后序序列是C、B、A,则该二叉树结点的对称序序列 1. 必为A、B、C 2. 必为A、C、B 3. 必为B、C、A 4. 不能确定 Question 6. (单选) 在虚拟页式存储管理方案中,下面哪一部分完成将页面调入内存的工作? 1. 缺页中断处理 2. 页面淘汰过程 3. 工作集模型应用 4. 紧缩技术利用 Question 7. (单选) 在DOS系统中,用于记录和管理磁盘数据区使用情况的数据结构 1. 位图表 2. 空闲块表 3. 文件分配表 4. 文件控制块 Question 8. (单选) 设有关系R(S,D,M),其函数依赖集F={S→D,D→M}。则关系R至多满足 1. 1NF 2. 2NF 3. 3NF 4. BCNF Question 9. (单选) 在数据库逻辑设计中,当将E-R图转换为关系模式时,下面的做法哪一个是不正确的? 1. 一个实体类型转换为一个关系模式 2. 一个联系类型转换为一个关系模式 3. 由实体类型转换成的关系模式的主键是该实体类型的主键 4. 由联系类型转换成的关系模式的属性是与该联系类型相关的诸实体类型的属性的全体 Question 10. (单选) 计算机网络按照所覆盖的地理范围分类,可以分广域网、局域网与 1. TCP/IP网 2. ATM网 3. ISDN 4. 城域网 Question 11. (单选) 计算机网络拓扑结构主要取决于它的 1. 资源子网 2. FDDI网 3. 通信子网 4. 路由器 Question 12. (单选) 网络协议的三个要素是语法、语义与 1. 工作原理 2. 时序 3. 进程 4. 服务原语 Question 13. (单选) TCP/IP参考模型中,电子邮件协议SMTP依赖于传输层的 1. UDP协议 2. IP协议 3. TCP协议 4. 802.2协议 Question 14. (单选) IEEE802.2协议中10BASE-T标准规定在使用5类双绞线时,从网卡到集线器的最大距离为 1. 100m 2. 185m 3. 300m 4. 500m Question 15. (单选) 100Mbps Fast Ethernet与10Mbps Ethernet 工作原理的相同之处主要在 1. 介质访问控制方法 2. 物理层协议 3. 网络层 4. 发送时钟周期 Question 16. (单选) 在Client/Server计算模式中,中间件middleware的作用是隔离应用与 1. 结构化查询语言SQL 2. 应用进程 3. 网络 4. IP地址 Question 17. (单选) 当用户向ISP申请Internet帐户时,用户的E-mail帐户应包括 1. IP地址 2. WWW地址 3. 用户密码(Password) 4. 用户名(User Name)与用户密码(Password) Question 18. (单选) WWW的超链接中定位信息所在的位置使用的是 1. 超文本(hypertext)技术 2. 统一资源定位器(URL, Uniform Resource Locators) 3. 超媒体(hypermedia技术) 4. 超文本标注语言HTML Question 19. (单选) 计算机网络系统与分布式系统之间的区别主要是 1. 系统物理结构 2. 系统高层软件 3. 传输介质类型 4. 服务器类型 Question 20. (单选) 帧中继系统设计的主要目标是用于互连多个 1. 广域网 2. 电话网 3. 局域网 4. 0)ATIM网 Question 21. (单选) ATM网络采用固定长厦的信元传送数据,信元长度为 1. 1024B 2. 53B 3. 128B 4. 64B Question 22. (单选) TCP/IP参考模型中的主机-网络层对应于OSI RM中的 1. 网络层 2. 物理层 3. 数据链路层 4. 物理层与数据链路层 Question 23. (单选) 计算机网络最突出的优点是: 1. 计算精度高 2. 内存容量大 3. 运算速度快 4. 连网的计算机能够相互共享资源 Question 24. (单选) 计算机网络分为局域网、城域网与广域网,其划分的依据是: 1. 数据传输所使用的介质 2. 网络的作用范围 3. 网络的控制方式 4. 网络的拓扑结构 Question 25. (单选) 用二分法查找一个长度为10的、排好序的线性表,查找不成功时,最多需要比较多少次? 1. 5 2. 2 3. 4 4. 1 Question 26. (单选) 模块内聚度越高,说明模块内各成分彼此结合的程度越 1. 松散 2. 紧密 3. 无法判断 4. 相同 Question 27. (单选) 软件需求分析阶段的输出主要是 1. 需求说明书 2. 开发计划 3. 可行性报告 4. 设计说明书 Question 28. (单选) 以下选项中不是项目经理的职责的是? 1. 需求分析 2. 计划 3. 计划跟踪 4. 质量管理 Question 29. (单选) 单元测试一般在什么时候进行? 1. 编码完成后 2. 系统测试前 3. 测试用例编写完成后 4. 集成测试后 Question 30. (多选) 配置管理能起到以下哪些作用? 1. 版本管理 2. 变更管理 3. 需求管理 4. 测试管理 Question 31. (单选) 根据线程安全的相关知识,分析以下代码,当调用test方法时i>10时是否会引起死锁? public void test(int i) { lock(this) { if (i>10) { i–; test(i); } } } 1. 会锁死 2. 不会锁死 Question 32. (单选) 以下描述错误的是() 1. 在C++中支持抽象类而在C#中不支持抽象类。 2. C++中可在头文件中声明类的成员而在CPP文件中定义类的成员,在C#中没有头文件并且在同一处声明和定义类的成员。 3. 在C#中可使用 new 修饰符显式隐藏从基类继承的成员。 4. 在C#中要在派生类中重新定义基类的虚函数必须在前面加Override。 Question 33. (单选) int[][] myArray3=new int[3][]{new int[3]{5,6,2},new int[5]{6,9,7,8,3},new int[2]{3,2}}; myArray3[2][2]的值是()。 1. 9 2. 2 3. 6 4. 越界 Question 34. (单选) 在C#中利用Socket进行网络通信编程的一般步骤是:建立Socket侦听、( )、利用Socket接收和发送数据。 1. 建立Socket连接 2. 获得端口号; 3. 获得IP地址; 4. 获得主机名; Question 35. (单选) 如果设treeView1=new TreeView(),TreeNode node=new TreeNode(“根结点” ),则treeView1.Nodes.Add(node)返回的是一个 ()类型的值。 1. TreeNode; 2. int; 3. string; 4. TreeView; 软件测试LoadRunner面试题:What is a function to capture dynamic values in the web vuser script? Web_reg_save_param function saves dynamic data information to a parameter. 软件测试LoadRunner面试题: Where do you set automatic correlation options? Automatic correlation from web point of view, can be set in recording options and correlation tab. Here we can enable correlation for the entire script and choose either issue online messages or offline actions, where we can define rules for that correlation.  Automatic correlation for database, can be done using show output window and scan for correlation and picking the correlate query tab and choose which query value we want to correlate. If we know the specific value to be correlated, we just do create correlation for the value and specify how the value to be created. 软件测试LoadRunner面试题:What is correlation? Explain the difference between automatic correlation and manual correlation? Correlation is used to obtain data which are unique for each run of the script and which are generated by nested queries. Correlation provides the value to avoid errors arising out of duplicate values and also optimizing the code (to avoid nested queries). Automatic correlation is where we set some rules for correlation. It can be application server specific. Here values are replaced by data which are created by these rules. In manual correlation, the value we want to correlate is scanned and create correlation is used to correlate. 软件测试LoadRunner面试题: Analysis Scenario (Bottlenecks) In Running Vuser graph correlated with the response time graph you can see that as the number of Vusers increases, the average response time of the check itinerary transaction very gradually increases. In other words, the average response time steadily increases as the load increases. At 56 Vusers, there is a sudden, sharp increase in the average response time. We say that the test broke the server. That is the mean time before failure (MTBF). The response time clearly began to degrade when there were more than 56 Vusers running simultaneously. 软件测试LoadRunner面试题: Types of Goals in Goal-Oriented Scenario Load Runner provides you with five different types of goals in a goal oriented scenario: · The number of concurrent Vusers · The number of hits per second · The number of transactions per second · The number of pages per minute · The transaction response time that you want your scenario 软件测试LoadRunner面试题: Throughput - If the throughput scales upward as time progresses and the number of Vusers increase, this indicates that the bandwidth is sufficient. If the graph were to remain relatively flat as the number of Vusers increased, it would be reasonable to conclude that the bandwidth is constraining the volume of data delivered. 软件测试LoadRunner面试题:Explain the following functions: – lr_debug_message The lr_debug_message function sends a debug message to the output log when the specified message class is set. lr_output_message – The lr_output_message function sends notifications to the Controller Output window and the Vuser log file. lr_error_message – The lr_error_message function sends an error message to the LoadRunner Output window. lrd_stmt – The lrd_stmt function associates a character string (usually a SQL statement) with a cursor. This function sets a SQL statement to be processed. lrd_fetch – The lrd_fetch function fetches the next row from the result set. 软件测试LoadRunner面试题:What is the difference between standard log and extended log? The standard log sends a subset of functions and messages sent during script execution to a log. The subset depends on the Vuser type Extended log sends a detailed script execution messages to the output log. This is mainly used during debugging when we want information about: Parameter substitution. Data returned by the server. Advanced trace. 软件测试LoadRunner面试题:What is think time? How do you change the threshold? - Think time is the time that a real user waits between actions. Example: When a user receives data from a server, the user may wait several seconds to review the data before responding. This delay is known as the think time. Changing the Threshold: Threshold level is the level below which the recorded think time will be ignored. The default value is five (5) seconds. We can change the think time threshold in the Recording options of the Vugen. 软件测试LoadRunner面试题:What do vuser_init action and vuser_end action contain? Vuser_init action contains procedures to login to a server. Vuser_end section contains log off procedures. 软件测试LoadRunner面试题:How did you plan the Load? What are the Criteria? Load test is planned to decide the number of users, what kind of machines we are going to use and from where they are run. It is based on 2 important documents, Task Distribution Diagram and Transaction profile. Task Distribution Diagram gives us the information on number of users for a particular transaction and the time of the load. The peak usage and off-usage are decided from this Diagram. Transaction profile gives us the information about the transactions name and their priority levels with regard to the scenario we are deciding. 软件测试LoadRunner面试题:What is the difference between Overlay graph and Correlate graph? Overlay Graph: It overlay the content of two graphs that shares a common x-axis. Left Y-axis on the merged graph show.s the current graph.s value & Right Y-axis show the value of Y-axis of the graph that was merged. Correlate Graph: Plot the Y-axis of two graphs against each other. The active graph.s Y-axis becomes X-axis of merged graph. Y-axis of the graph that was merged becomes merged graph.s Y-axis. 软件测试LoadRunner面试题:How did you find database related issues? By running .Database. monitor and help of .Data Resource Graph. we can find database related issues. E.g. You can specify the resource you want to measure on before running the controller and than you can see database related issues 软件测试LoadRunner面试题:How did you find web server related issues? - Using Web resource monitors we can find the performance of web servers. Using these monitors we can analyze throughput on the web server, number of hits per second that occurred during scenario, the number of http responses per second, the number of downloaded pages per second. 软件测试LoadRunner面试题:If web server, database and Network are all fine where could be the problem? The problem could be in the system itself or in the application server or in the code written for the application. 软件测试LoadRunner面试题:How do you identify the performance bottlenecks? Performance Bottlenecks can be detected by using monitors. These monitors might be application server monitors, web server monitors, database server monitors and network monitors. They help in finding out the troubled area in our scenario which causes increased response time. The measurements made are usually performance response time, throughput, hits/sec, network delay graphs, etc. 软件测试LoadRunner面试题:Explain the Configuration of your systems? The configuration of our systems refers to that of the client machines on which we run the Vusers. The configuration of any client machine includes its hardware settings, memory, operating system, software applications, development tools, etc. This system component configuration should match with the overall system configuration that would include the network infrastructure, the web server, the database server, and any other components that go with this larger system so as to achieve the load testing objectives. 软件测试LoadRunner面试题:What is the relation between Response Time and Throughput? The Throughput graph shows the amount of data in bytes that the Vusers received from the server in a second. When we compare this with the transaction response time, we will notice that as throughput decreased, the response time also decreased. Similarly, the peak throughput and highest response time would occur approximately at the same time. 软件测试LoadRunner面试题:If you want to stop the execution of your script on error, how do you do that? The lr_abort function aborts the execution of a Vuser script. It instructs the Vuser to stop executing the Actions section, execute the vuser_end section and end the execution. This function is useful when you need to manually abort a script execution as a result of a specific error condition. When you end a script using this function, the Vuser is assigned the status “Stopped”. For this to take effect, we have to first uncheck the .Continue on error. option in Run-Time Settings. 软件测试LoadRunner面试题:What is the advantage of running the Vuser as thread? VuGen provides the facility to use multithreading. This enables more Vusers to be run per generator. If the Vuser is run as a process, the same driver program is loaded into memory for each Vuser, thus taking up a large amount of memory. This limits the number of Vusers that can be run on a single generator. If the Vuser is run as a thread, only one instance of the driver program is loaded into memory for the given number of Vusers (say 100). Each thread shares the memory of the parent driver program, thus enabling more Vusers to be run per generator. 软件测试LoadRunner面试题:What is Ramp up? How do you set this? This option is used to gradually increase the amount of Vusers/load on the server. An initial value is set and a value to wait between intervals can be specified. To set Ramp Up, go to ‘Scenario Scheduling Options’ 软件测试LoadRunner面试题:Where do you set Iteration for Vuser testing?How do you perform functional testing under load? We set Iterations in the Run Time Settings of the VuGen. The navigation for this is Run time settings, Pacing tab, set number of iterations. Functionality under load can be tested by running several Vusers concurrently. By increasing the amount of Vusers, we can determine how much load the server can sustain. 软件测试LoadRunner面试题:What are the changes you can make in run-time settings? The Run Time Settings that we make are: a) Pacing – It has iteration count. b) Log - Under this we have Disable Logging Standard Log and c) Extended Think Time – In think time we have two options like Ignore think time and Replay think time. d) General – Under general tab we can set the vusers as process or as multithreading and whether each step as a transaction. 软件测试LoadRunner面试题:How do you write user defined functions in LR? Give me few functions you wrote in your previous project? - Before we create the User Defined functions we need to create the external library (DLL) with the function. We add this library to VuGen bin directory. Once the library is added then we assign user defined function as a parameter. The function should have the following format: __declspec (dllexport) char* (char*, char*)Examples of user defined functions are as follows:GetVersion, GetCurrentTime, GetPltform are some of the user defined functions used in my earlier project. 软件测试LoadRunner面试题:How do you debug a LoadRunner script? VuGen contains two options to help debug Vuser scripts-the Run Step by Step command and breakpoints. The Debug settings in the Options dialog box allow us to determine the extent of the trace to be performed during scenario execution. The debug information is written to the Output window. We can manually set the message class within your script using the lr_set_debug_message function. This is useful if we want to receive debug information about a small section of the script only. 软件测试LoadRunner面试题:When do you disable log in Virtual User Generator, When do you choose standard and extended logs? Once we debug our script and verify that it is functional, we can enable logging for errors only. When we add a script to a scenario, logging is automatically disabled. Standard Log Option: When you select Standard log, it creates a standard log of functions and messages sent during script execution to use for debugging. Disable this option for large load testing scenarios. When you copy a script to a scenario, logging is automatically disabled Extended Log Option: Select extended log to create an extended log, including warnings and other messages. Disable this option for large load testing scenarios. When you copy a script to a scenario, logging is automatically disabled. We can specify which additional information should be added to the extended log using the Extended log options. 软件测试LoadRunner面试题:Where do you set automatic correlation options? Automatic correlation from web point of view can be set in recording options and correlation tab. Here we can enable correlation for the entire script and choose either issue online messages or offline actions, where we can define rules for that correlation. Automatic correlation for database can be done using show output window and scan for correlation and picking the correlate query tab and choose which query value we want to correlate. If we know the specific value to be correlated, we just do create correlation for the value and specify how the value to be created. 软件测试LoadRunner面试题:How do you find out where correlation is required? Give few examples from your projects? Two ways: First we can scan for correlations, and see the list of values which can be correlated. From this we can pick a value to be correlated. Secondly, we can record two scripts and compare them. We can look up the difference file to see for the values which needed to be correlated.  In my project, there was a unique id developed for each customer, it was nothing but Insurance Number, it was generated automatically and it was sequential and this value was unique. I had to correlate this value, in order to avoid errors while running my script. I did using scan for correlation. 软件测试LoadRunner面试题:What is correlation? Explain the difference between automatic correlation and manual correlation? Correlation is used to obtain data which are unique for each run of the script and which are generated by nested queries. Correlation provides the value to avoid errors arising out of duplicate values and also optimizing the code (to avoid nested queries). Automatic correlation is where we set some rules for correlation. It can be application server specific. Here values are replaced by data which are created by these rules. In manual correlation, the value we want to correlate is scanned and create correlation is used to correlate. 软件测试LoadRunner面试题:Why do you create parameters? Parameters are like script variables. They are used to vary input to the server and to emulate real users. Different sets of data are sent to the server each time the script is run. Better simulate the usage model for more accurate testing from the Controller; one script can emulate many different users on the system. 软件测试LoadRunner面试题:Explain the recording mode for web Vuser script? We use VuGen to develop a Vuser script by recording a user performing typical business processes on a client application. VuGen creates the script by recording the activity between the client and the server. For example, in web based applications, VuGen monitors the client end of the database and traces all the requests sent to, and received from, the database server. We use VuGen to: Monitor the communication between the application and the server; Generate the required function calls; and Insert the generated function calls into a Vuser script. 软件测试LoadRunner面试题:What is a scenario? A scenario defines the events that occur during each testing session. For example, a scenario defines and controls the number of users to emulate, the actions to be performed, and the machines on which the virtual users run their emulations. 软件测试LoadRunner面试题:What is a rendezvous point? You insert rendezvous points into Vuser scripts to emulate heavy user load on the server. Rendezvous points instruct Vusers to wait during test execution for multiple Vusers to arrive at a certain point, in order that they may simultaneously perform a task. For example, to emulate peak load on the bank server, you can insert a rendezvous point instructing 100 Vusers to deposit cash into their accounts at the same time. 软件测试LoadRunner面试题:What Component of LoadRunner would you use to play Back the script in multi user mode? The Controller component is used to playback the script in multi-user mode. This is done during a scenario run where a vuser script is executed by a number of vusers in a group. 软件测试LoadRunner面试题:What Component of LoadRunner would you use to record a Script? The Virtual User Generator (VuGen) component is used to record a script. It enables you to develop Vuser scripts for a variety of application types and communication protocols. 软件测试LoadRunner面试题:What are the components of LoadRunner? The components of LoadRunner are The Virtual User Generator, Controller, and the Agent process, LoadRunner Analysis and Monitoring, LoadRunner Books Online. 软件测试LoadRunner面试题:When do you do load and performance Testing? We perform load testing once we are done with interface (GUI) testing. Modern system architectures are large and complex. Whereas single user testing primarily on functionality and user interface of a system component, application testing focuses on performance and reliability of an entire system. For example, a typical application-testing scenario might depict 1000 users logging in simultaneously to a system. This gives rise to issues such as what is the response time of the system, does it crash, will it go with different software applications and platforms, can it hold so many hundreds and thousands of users, etc. This is when we set do load and performance testing. 软件测试LoadRunner面试题:Explain the Load testing process? Step 1: Planning the test. Here, we develop a clearly defined test plan to ensure the test scenarios we develop will accomplish load-testing objectives. Step 2: Creating Vusers. Here, we create Vuser scripts that contain tasks performed by each Vuser, tasks performed by Vusers as a whole, and tasks measured as transactions. Step 3: Creating the scenario. A scenario describes the events that occur during a testing session. It includes a list of machines, scripts, and Vusers that run during the scenario. We create scenarios using LoadRunner Controller. We can create manual scenarios as well as goal-oriented scenarios. In manual scenarios, we define the number of Vusers, the load generator machines, and percentage of Vusers to be assigned to each script. For web tests, we may create a goal-oriented scenario where we define the goal that our test has to achieve. LoadRunner automatically builds a scenario for us. Step 4: Running the scenario. We emulate load on the server by instructing multiple Vusers to perform tasks simultaneously. Before the testing, we set the scenario configuration and scheduling. We can run the entire scenario, Vuser groups, or individual Vusers. Step 5: Monitoring the scenario. We monitor scenario execution using the LoadRunner online runtime, transaction, system resource, Web resource, Web server resource, Web application server resource, database server resource, network delay, streaming media resource, firewall server resource, ERP server resource, and Java performance monitors. Step 6: Analyzing test results. During scenario execution, LoadRunner records the performance of the application under different loads. We use LoadRunner.s graphs and reports to analyze the application.s performance. 软件测试LoadRunner面试题:What is load testing and performance testing? Load testing is to test that if the application works fine with the loads that result from large number of simultaneous users, transactions and to determine weather it can handle peak usage periods. Timing for both read and update transactions should be gathered to determine whether system functions are being performed in an acceptable timeframe. This should be done standalone and then in a multi user environment to determine the effect of multiple transactions on the timing of a single transaction. 软件测试面试题:When you create GUI map do you record all the objects of specific objects? If we are learning a window then WinRunner automatically learns all the objects in the window else we will we identifying those object, which are to be learned in a window, since we will be working with only those objects while creating scripts. 软件测试面试题:How do you view the contents of the GUI map? GUI Map editor displays the content of a GUI Map. We can invoke GUI Map Editor from the Tools Menu in WinRunner. The GUI Map Editor displays the various GUI Map files created and the windows and objects learned in to them with their logical name and physical description. 软件测试面试题:What is the different between GUI map and GUI map files? The GUI map is actually the sum of one or more GUI map files. There are two modes for organizing GUI map files. Global GUI Map file: a single GUI Map file for the entire application. GUI Map File per Test: WinRunner automatically creates a GUI Map file for each test created. GUI Map file is a file which contains the windows and the objects learned by the WinRunner with its logical name and their physical description. 软件测试面试题:What is meant by the logical name of the object?If the object does not have a name then what will be the logical name? An object.s logical name is determined by its class. In most cases, the logical name is the label that appears on an object. If the object does not have a name then the logical name could be the attached text. 软件测试面试题:What are the reasons that WinRunner fails to identify an object on the GUI? - WinRunner fails to identify an object in a GUI due to various reasons.  The object is not a standard windows object. If the browser used is not compatible with the WinRunner version, GUI Map Editor will not be able to learn any of the objects displayed in the browser window. 软件测试面试题:What is the purpose of loading WinRunner Add-Ins? Add-Ins are used in WinRunner to load functions specific to the particular add-in to the memory. While creating a script only those functions in the add-in selected will be listed in the function generator and while executing the script only those functions in the loaded add-in will be executed else WinRunner will give an error message saying it does not recognize the function. 软件测试面试题:What are the different modes of recording? There are two type of recording in WinRunner.  Context Sensitive recording records the operations you perform on your application by identifying Graphical User Interface (GUI) objects. Analog recording records keyboard input, mouse clicks, and the precise x- and y-coordinates traveled by the mouse pointer across the screen. 软件测试面试题:Have you integrated your automated scripts from TestDirector? When you work with WinRunner, you can choose to save your tests directly to your TestDirector database or while creating a test case in the TestDirector we can specify whether the script in automated or manual. And if it is automated script then TestDirector will build a skeleton for the script that can be later modified into one which could be used to test the AUT. 软件测试面试题:What is the use of Test Director software? TestDirector is Mercury Interactive.s software test management tool. It helps quality assurance personnel plan and organize the testing process. With TestDirector you can create a database of manual and automated tests, build test cycles, run tests, and report and track defects. You can also create reports and graphs to help review the progress of planning tests, running tests, and tracking defects before a software release. 软件测试面试题:How do you analyze results and report the defects? Following each test run, WinRunner displays the results in a report. The report details all the major events that occurred during the run, such as checkpoints, error messages, system messages, or user messages. If mismatches are detected at checkpoints during the test run, you can view the expected results and the actual results from the Test Results window. If a test run fails due to a defect in the application being tested, you can report information about the defect directly from the Test Results window. This information is sent via e-mail to the quality assurance manager, who tracks the defect until it is fixed. 软件测试面试题:Have you performed debugging of the scripts and how to run the test script? Yes, I have performed debugging of scripts. We can debug the script by executing the script in the debug mode. We can also debug script using the Step, Step Into, Step out functionalities provided by the WinRunner.We run tests in Verify mode to test your application. Each time WinRunner encounters a checkpoint in the test script, it compares the current data of the application being tested to the expected data captured earlier. If any mismatches are found, WinRunner captures them as actual results. 软件测试面试题:How does WinRunner evaluate test results? Following each test run, WinRunner displays the results in a report. The report details all the major events that occurred during the run, such as checkpoints, error messages, system messages, or user messages. If mismatches are detected at checkpoints during the test run, you can view the expected results and the actual results from the Test Results window. 软件测试面试题:Have you created test scripts and what is contained in the test scripts? Yes I have created test scripts. It contains the statement in Mercury Interactive.s Test Script Language (TSL). These statements appear as a test script in a test window. You can then enhance your recorded test script, either by typing in additional TSL functions and programming elements or by using WinRunner.s visual programming tool, the Function Generator. 软件测试面试题:How does WinRunner recognize objects on the application? WinRunner uses the GUI Map file to recognize objects on the application. When WinRunner runs a test, it uses the GUI map to locate objects. It reads an object.s description in the GUI map and then looks for an object with the same properties in the application being tested. 软件测试面试题:What is contained in the GUI map? WinRunner stores information it learns about a window or object in a GUI Map. When WinRunner runs a test, it uses the GUI map to locate objects. It reads an object.s description in the GUI map and then looks for an object with the same properties in the application being tested. Each of these objects in the GUI Map file will be having a logical name and a physical description. There are 2 types of GUI Map files. Global GUI Map file: a single GUI Map file for the entire application. GUI Map File per Test: WinRunner automatically creates a GUI Map file for each test created. 测试面试题:How you used WinRunner in your project? Explain WinRunner testing process? Yes, I have been using WinRunner for creating automated scripts for GUI, functional and regression testing of the AUT. * Create GUI Map File so that WinRunner can recognize the GUI objects in the application being tested * Create test scripts by recording, programming, or a combination of both. While recording tests, insert checkpoints where you want to check the response of the application being tested. * Debug Test: run tests in Debug mode to make sure they run smoothly * Run Tests: run tests in Verify mode to test your application. * View Results: determines the success or failure of the tests. * Report Defects: If a test run fails due to a defect in the application being tested, you can report information about the defect directly from the Test Results window. Linux Interview Questions For software testers Software testing – Questions and Answers – Linix / Unix 1. Q. How do you list files in a directory? A. ls  – list directory contents ls �l (-l  use a long listing format) 2. Q. How do you list all files in a directory, including the hidden files? A. ls -a  (-a, do not hide entries starting with .) 3. Q. How do you find out all processes that are currently running? A. ps -f (-f does full-format listing.) 4. Q. How do you find out the processes that are currently running or a particular user? A. ps -au Myname   (-u by effective user ID (supports names)) (a – all users) 5. Q. How do you kill a process? A. kill -9  8 (process_id 8) or kill -9  %7  (job number 7) kill -9 -1  (Kill all processes you can kill.) killall – kill processes by name most (useful – killall java) 6. Q. What would you use to view contents of the file? A. less filename cat filename pg filename pr filename more filename most useful is command: tail file_name – you can see the end of the log file. 7. Q. What would you use to edit contents of the file? A. vi  screen editor or jedit, nedit or ex  line editor 8. Q. What would you use to view contents of a large error log file? A. tail  -10 file_name   ( last 10 rows) 9. Q. How do you log in to a remote Unix box? A. Using telnet server_name or ssh -l ( ssh – OpenSSH SSH client (remote login program)) 10.Q. How do you get help on a UNIX terminal? A. man command_name info command_name (more information) 11.Q. How do you list contents of a directory including all of its subdirectories, providing full details and sorted by modification time? A. ls -lac -a all entries -c by time 12.Q. How do you create a symbolic link to a file (give some reasons of doing so)? A. ln /../file1 Link_name Links create pointers to the actual files, without duplicating the contents of the files. That is, a link is a way of providing another name to the same file. There are two types of links to a file:Hard link, Symbolic (or soft) link; 13.Q. What is a filesystem? A. Sum of all directories called file system. A file system is the primary means of file storage in UNIX. File systems are made of inodes and superblocks. 14.Q. How do you get its usage (a filesystem)? A. By storing  and manipulate  files. 15.Q. How do you check the sizes of all users� home directories (one command)? A. du -s df The du command summarizes disk usage by directory. It recurses through all subdirectories and shows disk usage by each subdirectory with a final total at the end. Q. in current directory A. ls -ps (p- directory; s – size) 16.Q. How do you check for processes started by user ‘pat’? A. ps -fu pat   (-f -full_format u -user_name ) 17.Q. How do you start a job on background? A. bg  %4  (job 4) 18 Q. What utility would you use to replace a string ’2001′ for ’2002′ in a text file? A. Grep,  Kde( works on Linux and Unix) 19. Q. What utility would you use to cut off the first column in a text file? A. awk, kde 20. Q. How to copy file into directory? A. cp  /tmp/file_name . (dot mean in the current directory) 21. Q. How to remove directory with files? A. rm -rf directory_name 22. Q. What is the difference between internal and external commands? A. Internal commands are stored in the; same level as the operating system while external commands are stored on the hard disk among the other utility programs. 23. Q. List the three main parts of an operating system command: A. The three main parts are the command, options and arguments. 24  Q. What is the difference between an argument and an option (or switch)? A. An argument is what the command should act on: it could be a filename, directory or name. An option is specified when you want to request additional information over and above the basic information each command supplies. 25. Q. What is the purpose of online help? A. Online help provides information on each operating system command, the syntax, the options, the arguments with descriptive information. 26.  Q. Name two forms of security. A.  Two forms of security are Passwords and File Security with permissions specified. 27. Q. What command do you type to find help about the command who? A. $ man who 28. Q. What is the difference between home directory and working directory? A. Home directory is the directory you begin at when you log into the system. Working directory can be anywhere on the system and it is where you are currently working. 29. Q. Which directory is closer to the top of the file system tree, parent directory or current directory? A. The parent directory is above the current directory, so it is closer to the root or top of the file system. 30. Q. Given the following pathname: $ /business/acctg/payable/supplier/april a) If you were in the directory called acctg, what would be the relative pathname name for the file called april? b) What would be the absolute pathname for april? A. a) $ payable/supplier/april b) $ /business/acctg/payable/supplier/april 31. Q. Suppose your directory had the following files: help. 1 help.2 help.3 help.4 help.O1 help.O2 aid.O1 aid.O2 aid.O3 back. 1 back.2 back.3 a) What is the command to list all files ending in 2? b) What is the command to list all files starting in aid? c) What is the command to list all “help” files with one character extension? A. a) ls *2 b) ls aid.* c) ls help.? 32. Q. What are two subtle differences in using the more and the pg commands? A.  With the more command you display another screenful by pressing the spacebar, with pg you press the return key. The more command returns you automatically to the UNIX shell when completed, while pg waits until you press return. 33. Q. When is it better to use the more command rather than cat command? A. It is sometimes better to use the more command when you are viewing a file that will display over one screen. 34. Q. What are two functions the move mv command can carry out? A. The mv command moves files and can also be used to rename a file or directory. 35. Q. Name two methods you could use to rename a file. A. Two methods that could be used: a. use the mv command b. copy the file and give it a new name and then remove the original file if no longer needed. 36. The soccer league consists of boy and girl teams. The boy file names begin with B, the girl teams begin with G. All of these files are in one directory called “soccer”, which is your current directory: Bteam.abc Bteam.OOl Bteam.OO2 Bteam.OO4 Gteam.win Gteam.OOl Gteam.OO2 Gteam.OO3 Write the commands to do the following: a) rename the file Bteam.abc to Bteam.OO3. b) erase the file Gteam. win after you have viewed the contents of the file c) make a directory for the boy team files called “boys”, and one for the girl team files called” girls” d) move all the boy teams into the “boys” directory e) move all the girl teams into the “girls” directory f) make a new file called Gteam.OO4 that is identical to Gteam.OOl g) make a new file called Gteam.OO5 that is identical to Bteam.OO2 A. a) mv Bteam.abc Bteam.OO3. b) cat Gteam.win -or- more Gteam.win rm Gteam. win c) mkdir boys mkdir girls d) mv Bteam* boys e) mv Gteam* girls f) cd girls cp Gteam.OO1 Gteam.OO4 g) There are several ways to do this. Remember that we are currently in the directory /soccer/girls. cp ../boys/Bteam.OO2 Gteam.OO5 or cd ../boys cp Bteam.OO2 ../girls/Gteam.OO5 37. Q. Draw a picture of the final directory structure for the “soccer” directory, showing all the files and directories. 38. Q. What metacharacter is used to do the following: 1.1 Move up one level higher in the directory tree structure 1.2 Specify all the files ending in .txt 1.3 Specify one character 1.4 Redirect input from a file 1.5 Redirect the output and append it to a file A. 1. 1.1 double-dot or .. 1.2 asterisk or * 1.3 question or ? 1.4 double greater than sign: >> 1.5 the less than sign or < 39. Q. List all the files beginning with A A. To list all the files beginning with A command: ls A* 40. Q. Which of the quoting or escape characters allows the dollar sign ($) to retain its special meaning? A. The double quote (“) allows the dollar sign ($) to retain its special meaning. Both the backslash (\) and single quote (‘) would remove the special meaning of the dollar sign. 41. Q. What is a faster way to do the same command? mv fileO.txt newdir mv filel.txt newdir mv file2.txt newdir mv file3.txt newdir A. A shortcut method would be:   mv file?.txt newdir 42. Q. List two ways to create a new file: A. a. Copy a file to make a new file. b. Use the output operator e.g. ls -l > newfile.txt 43. Q. What is the difference between > and >> operators? A. The operator > either overwrites the existing file (WITHOUT WARNING) or creates a new file. The operator >> either adds the new contents to the end of an existing file or creates a new file. 44. Write the command to do the following: 44.1 Redirect the output from the directory listing to a printer. 44.2 Add the file efg.txt to the end of the file abc.txt. 44.3 The file testdata feeds information into the file called program 44.4 Observe the contents of the file called xyz.txt using MORE. 44.5 Observe a directory listing that is four screens long. A. 44.1 ls > lpr 44.2 cat efg.txt >> abc.txt 44.3 program < testdata 44.4 more < xyz.txt 44.5 ls > dirsave | more 45. Q. How do you estimate file space usage A. Use du command (Summarize disk usage of each FILE, recursively for directories.) Good to use arguments du -hs (-h, –human-readable print sizes in human readable format (e.g., 1K 234M 2G) (-s, –summarize display only a total for each argument) 46. Q. How can you see all mounted drives? A. mount -l 47. Q. How can you find a path to the file in the system? A. locate file_name (locate – list files in databases that match a pattern) 48. Q. What Linux  HotKeys do you know? A. Ctrl-Alt-F1    Exit to command prompt Ctrl-Alt-F7 or F8    Takes you back to KDE desktop from command prompt Crtl-Alt-Backspace    Restart XWindows Ctrl-Alt-D    Show desktop 49. Q. What can you tell about the tar Command? A. The tar program is an immensely useful archiving utility. It can combine an entire directory tree into one large file suitable for transferring or compression. 50.  Q. What types of files you know? A. Files come in eight flavors: Normal files Directories Hard links Symbolic links Sockets Named pipes Character devices Block devices 51.  Q. How to copy files from on PC to another on the same network A. Use the following command:scp yur_file you_login@your_IP example: copy .conf file from your PC  to alex computer- scp /etc/X11/xorg.conf alex@10.0.10.169: 52.  Q. Please describe information below: -rw-rw-r–    1 dotpc    dotpc         102 Jul 18  2003 file.buf drwxr-xr-x    9 dotpc    dotpc        4096 Oct 21 09:34 bin lrwxrwxrwx    1 dotpc    dotpc          20 Mar 21 15:00 client -> client-2.9.5 drwxrwxr-x   11 dotpc    dotpc        4096 Sep  2  2005 client-2.8.9 drwxrwxr-x    7 dotpc    dotpc        4096 Dec 14 12:13 data drwxr-xr-x   12 dotpc    dotpc        4096 Oct 21 09:41 docs drwxr-xr-x    5 dotpc    dotpc        4096 Dec  7 14:22 etc drwxr-xr-x   11 dotpc    dotpc        4096 Mar 21 15:54 client-2.9.5 -rw-r–r–    1 dotpc    dotpc      644836 Mar 22 09:53 client-2.9.5.tar.gz A. This is a result of command $ls -l we have two files, 6 directories and one link to client-2.9.5 directory. There is number of files in every directory, size and data of last change. 53. Q. If you would like to run two commands in sequence what operators you can use? A. ; or && the difference is: if you separate commands with ; second command will be run automatically. if you separate commands with && second command will be run only in the case the first was run successfully. 54.  Q. How you will uncompress the file? A. Use tar command (The GNU version of the tar archiving utility): tar -zxvf file_name.tar.gz 55. Q.How do you execute a program or script, my_script in your current directoty? A. ./my_script 56. Q.How to find current time configuration in the file my_new.cfg A. grep time my_new.cfg Grep  searches the named input files (or standard input if no files are named, or the file name – is given) for lines containing a match to the given pattern. Q. What does grep() stand for? A. General Regular Expression Parser. 57. Q. What does the top command display? A. Top provides an ongoing look at processor activity in real time.   It  displays  a  listing of the most CPU-intensive tasks on the system, and can provide an interactive inter face for manipulating processes. (q is to quit) 58. Q. How can you find configuration on linux? A. by using /sin/ifconfig If no arguments are given, ifconfig displays the  status  of  the  cur- rently  active interfaces.  If a single interface argument is given, it displays the status of the given interface only; if a single  -a  argu- ment  is  given,  it  displays the status of all interfaces, even those that are down.  Otherwise, it configures an interface. 59.  Q. How to find difference in two configuration files on the same server? A. Use diff command that is compare files line by line diff -u /usr/home/my_project1/etc/ABC.conf /usr/home/my_project2/etc/ABC.conf 60.  Q. What is the best way to see the end of a logfile.log file? A. Use tail command – output the last part of files tail -n file_name ( the last N lines, instead of the last 10 as default) 61.  Q. Please write a loop for removing all files in the current directory that contains a word ‘log’ A. for i in *log*; do rm $i; done 62.  Question: How to switch to a previously used directory? Answer:   cd -

下载文档,方便阅读与编辑

文档的实际排版效果,会与网站的显示效果略有不同!!

需要 5 金币 [ 分享文档获得金币 ]
1 人已下载

下载文档

相关文档