进入QTP的基础.doc_第1页
进入QTP的基础.doc_第2页
进入QTP的基础.doc_第3页
进入QTP的基础.doc_第4页
进入QTP的基础.doc_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

此文档收集于网络,如有侵权,请联系网站删除进入QTP的基础基础: QTP基于VBScript,因此首先你要熟悉VBS。其次,在QTP的测试基于GUI(通常是这样),其中的“Object Respository”即是体现(同时它也是MI提倡的测试先行思想的体现)。为了熟悉这些,你完全可以按照使用手册中向导学习,将Sample完整的测试下来。 在这个部分,你至少应该学会录制、分解动作、数据驱动、Checkpoint设置。 提高: 在比较新的QTP8.2中有一个QuicTest Plus,安装后会提供更多的脚本支持。通过进一步学习VBS中WIM特性,可让你的QTP脚本获得极大的提升。在这个部分,你至少应该学会提升脚本复用性、多脚本运行。从命令行运行QTP脚本。 高级: QTP和WinRunner一样,它的脚本可供LoadRunner作为性能测试脚本。此外,QTP的Bussiness Componet和Scripted Componet也是该部分必不可少的内容(这两个需用到MI的另外一个产品QC)。此外,如何保持脚本间的Object Respository一致性,也要在这部分解决。 浅见!希望对你有所帮助。北京鼎普科技股份有限公司 QTP面试题 QTP 填空:1. QTP脚本语言采用_(备注:我猜好像是VBS,本人对QTP学的也是皮毛,基本上等于不会)2. 通过DESKTOP对象可以访问windows的桌面顶层对象,想要截屏应使用的方法是_3. 激活窗口使用的方法_。问答题:1. QTP中RO与TO的区别?2. QTP中OBJECT SPY的作用?3. 编写在QTP脚本,实现向记事本中输入“0123456789ABCDEFG”后,按ENTER?4. 下面脚本的目的是获取当前桌面中名为“test_记事本”的窗口对象,请补全?set objdesc=Description.Create()objdesc(“text”).value=”test_记事本”set object couection=Desktop._填空:1. QTP脚本语言采用_(备注:我猜好像是VBS,本人对QTP学的也是皮毛,基本上等于不会)2. 通过DESKTOP对象可以访问windows的桌面顶层对象,想要截屏应使用的方法是_3. 激活窗口使用的方法_。问答题:1. QTP中RO与TO的区别?2. QTP中OBJECT SPY的作用?3. 编写在QTP脚本,实现向记事本中输入“0123456789ABCDEFG”后,按ENTER?4. 下面脚本的目的是获取当前桌面中名为“test_记事本”的窗口对象,请补全?set objdesc=Description.Create()objdesc(“text”).value=”test_记事本”set object couection=Desktop._如何用QTP判断一个文件的扩展名? QTP面试题专栏, 软件测试面试题专栏 当使用QTP时,我们有可能需要判断一个网页上的图片是否是.jpg, .gif等扩展名结尾的,以下是判断扩展名的解决方案:1. 我们使用Mercury 的demo应用 /. image2. 需要检查的图片就是上面红色椭圆里面的图片3. 现在”Object spy”上面那个image对象4. 找到包含文件名的属性。通常这个属性的名字就是filename. 在这个例子中她的值是featured_destination.gif.5. 把这个值通过GETTO属性放到一个数组中6. 使用split函数来分割,以”.”为分割符7. 数组的最后一个值就应该是你的文件扩展名以下是实例代码:Dim filename, arrfilePut filename into the arrayfilename = Browser(”Welcome: Mercury Tours”).Page(”Welcome: Mercury Tours”).Image(”Featured Destination:”).GetTOProperty(”file name”)msgbox arrfile(Ubound(arrfile)如何用QTP脚本删除一个文件夹? QTP面试题专栏, 软件测试面试题专栏 代码如下例所示,假设要删除的文件夹是在C:drive.如何用QTP脚本删除一个文件夹:Dim strDrive, strfoldername,objFSO, objFolder, strPathstrDrive = “c:” 你要删除的文件夹所在的盘符strfoldername=”test” 你要删除的文件夹名strPath= strDrive&strfoldername 创建FileSystemObject.Set objFSO = CreateObject(”Scripting.FileSystemObject”)On Error Resume Next Incase folder is not foundobjFSO.DeleteFolder(strPath)如何用QTP脚本创建一个文件夹? QTP面试题专栏, 软件测试面试题专栏 代码如下例所示,假设要创建的文件夹是在C:drive.如何用QTP脚本创建一个文件夹:Dim strDrive, strfoldername,objFSO, objFolder, strPathstrDrive = “c:” 你要创建的文件夹所在的盘符strfoldername=”test” 你要创建的文件夹名strPath= strDrive&strfoldername 创建FileSystemObject.Set objFSO = CreateObject(”Scripting.FileSystemObject”)On Error Resume Next 如果文件夹已经存在 用strPath创建一个文件夹Set objFolder = objFSO.CreateFolder(strPath)If err.Number = 58 then VB script运行时异常,如果文件已经存在msgbox “Folder already exist at” & strPathexitTestEnd Ifmsgbox “Folder created is at ” & strPath如何关掉msgbox的提示框? QTP面试题专栏 在调试脚本的时候,通常会用采用很多msgbox函数,但是这些提示框必须要手动关闭,否则脚本不会继续往下执行,你可以设计一个函数,在几秒钟之后自动关闭提示框吗?答案:Set WshShell = CreateObject(”Wscript.Shell”)WshShell.Popup “请等待5秒钟,5秒后该窗口自动关闭”, 5, “Title”QTP面试题:如何通过脚本来删除cookies? QTP, 软件测试 没有一个现成的方法来删除cookies, 所以你需要写一个Shell Script去删除你的Cookie所在目录的所有文件。实现的代码如下:Const COOKIES = &H21&Set objShell = CreateObject(”Shell.Application”)Set objFolder = objShell.Namespace(COOKIES)Set objFolderItem = objFolder.SelfstrPath = objFolderItem.Path & “*.*”Set objFSO = CreateObject(”Scripting.FileSystemObject”)objFSO.DeleteFile(strPath)如何使用Dictionary Object? QTP面试题专栏, 软件测试面试题专栏 如下代码是一个典型的使用Dictionary Object的例子:Dim dict Create a variable.Set dict = CreateObject(”Scripting.Dictionary”)dict.Add “Company”, “HP” Adding keys and corresponding items.dict.Add “Tool”, “QuickTest Pro”dict.Add “Website”, “LearnQTP”dict.Add “Country”, “India”Dim dict 建立一个变量.Set dict = CreateObject(”Scripting.Dictionary”)dict.Add “Name”, “IT公司面试手册” Adding keys and corresponding items.dict.Add “Website”, “”dict.Add “Country”, “China”例子中的dict是类Scripting.Dictionary的一个对象,dictionary object的其他方法有Exists方法,Items方法,Keys方法,Remove方法,RemoveAll方法。同类其他面试题 点击新一篇或旧一篇可QTP面试题:什么是Dictionary Object? QTP面试题专栏, 软件测试面试题专栏 Dictionary Object不是QTP特有的一个对象,它是Microsoft开发的,是VB scripting 的一部分。简单来说,Dictionary Object跟数组非常相似,两者的不同之处是dictionary object 的每个元素都有一个唯一Key.这个key可以帮助你在需要的时候调用相应的元素。QTP和QC版本是如何匹配的?哪种版本的QC可以跟哪种版本的QTP整合? QTP面试题专栏, 软件测试面试题专栏 QC 9.0可以跟QTP 8.2 SP1, QTP 8.2 SP2, QTP 9.0, QTP 9.1 和QTP 9.2整合。要确定你的QTP版本跟哪种版本的QC整合,可以参阅安装目录的ReadMe如何使用AOM把QTP脚本上传到QC? QTP, 软件测试 连接到Quality Center后,使用AOM打开测试并保存到QC. 代码如下:qtqcApp.Open “C:QTPProjectQTPTestScript1, True 得到测试对象Set qtqcTest = qtqcApp.Test 使用SaveAs方法把测试保存到QCqtqcApp.Test.SaveAs “QualityCenter SubjectFolderNameQTPTScript”如何查找TDConnection对象的方法和属性? QTP面试题专栏, 软件测试面试题专栏 可以到以下目录下查看这个对象的属性和方法,QTP Help QTP Advanced Reference Quick Test Automation TDConnection如何使用AOM连接Quality Center Open Test Architecture(OTA)? QTP面试题专栏, 软件测试面试题专栏 可以使用QCUtil对象(如果是QTP6.5或者以前,是AKA TDUtil),你可以在QTP Help Quick Test Object model reference Utility Objects QCUtil Object下找到所有相关的属性,如CurrentRun, TestRun, Current TestSet, CurrentTestSetTest, IsConnected, QCConnection等等。如果QTP自动连接QC时QC的登录信息改变了怎么办? QTP面试题专栏, 软件测试面试题专栏 修改QTP安装目录下的mic.ini文件,通常是在C:Program FilesMercury InteractiveQuickTest Professionalbin目录下,把以下属性从1改到01. LoginAutomatically=0 2. ReconnectToDB=0 3. ReconnectToServer=0怎么在QTP启动的时候自动连接QC? QTP面试题专栏, 软件测试面试题专栏 到File Quality Center Connection, 选中 Reconnect to server on start-up选择框。QTP connects to QC when start-up如何使用Automation Object Model(AOM)连接QC和QTP? QTP面试题专栏, 软件测试面试题专栏 可以使用TDConnection Object来进行连接,实例代码如下: Create the QuickTest Professional application object.Set qtqcApp = CreateObject(”QuickTest.Application”)qtqcApp.Launch Launch QTPqtqcApp.Visible = True Make it visibleConnect to Quality CenterqtqcApp.TDConnection.Connect , , , , qtqcApp.TDConnection.Connect “http:/QualityCenterServer/tdbin”,“FR”, “Flights”, “learnqtp”, “welcome”, False如何把QTP和QC连接起来工作? QTP面试题专栏, 软件测试面试题专栏 可以按照如下步骤:1. 在QC的Tool Options Run in QTP下选中Allow other Mercury products to run tests and components2. 如果你是在同一个有QC 客户端的机器上跑测试,你需要: 1. QTP Connectivity Add-In 2. QTP Add-in3. 如果你是在另外一个没有QC Client的机器上运行测试,你需要: 1. QC Client端安装QTP Add-in 2. QTP端安装QTP Add-in 和QC connectivity Add-in4. QC connectivity 可以在 QC server URL Add-ins Page link QC Connectivity link Download Add-in找到5. QTP Add-in可以再QC Server URL Add-ins Page link More QC Add-ins link Download and Install QTP Add0-in according to its version下找到。介绍一下你使用QTP进行自动化测试的流程 QTP面试题专栏, 软件测试面试题专栏 1. 准备录制在录制测试前,请确认应用程序和 QuickTest 已按测试要求设置。请确保应用程序显示要录制的元素,例如,工具栏或特殊窗口窗格;还要确保应用程序选项已按测试目标设置。为了确保 QuickTest 可以正确地录制和存储信息,您还应该查看“测试设置”对话框(“测试”“设置”)和“选项”对话框(“工具”“选项”)中的设置。例如,应该确认测试已设置为使用适当的对象库模式。2. 录制应用程序上的会话浏览应用程序或网站时,QuickTest 会将您执行的每个步骤图形化显示为关键字视图中的一行。步骤是任何引起应用程序发生更改的用户操作,例如单击链接或图像,或者向表单输入数据。3. 增强测试通过在测试中插入检查点可以搜索页面、对象或文本字符串中的特定值,这有助于确定应用程序或网站是否正常运行。通过扩大测试范围(用参数替换固定值),可以检查应用程序如何使用多组数据来执行相同的操作。通过添加逻辑和条件语句或循环语句,可以向测试添加复杂的检查。4. 调试测试调试测试,确保测试可以流畅而无中断地运行。5. 运行测试运行测试,检查应用程序或网站的行为。在运行时,QuickTest 将打开应用程序,或者连接到网站,并执行测试中的每个步骤。6. 分析测试结果检查测试结果以便确定应用程序中的缺陷。7. 报告缺陷如果已安装了 Quality Center,则可以将发现的缺陷报告给数据库。Quality Center 是 Mercury Interactive 的软件测试管理工具。同类其他面试题 点击新一篇或旧一篇可浏览全部同类面试题QTP中Window ID属性有什么用?何时会变? QTP面试题专栏, 软件测试面试题专栏 Window Id对应Windows应用程序的控件ID(Control ID),是指Windows指定给每个控件的数值型标识符,用来标识一种控件类型。不同类型的控件id就会不一样,同样类型的控件id是一样的。例如windows资源管理器的control id和打开文件对话框中的资源管理器属于同样的控件,它们的control id都是1如果应用程序调用系统控件,那么系统控件的windows id 一般都是0。比如window内置的 open(打开), save as(另存为) 等等窗口得id都为0。Window Id在运行前后一般都不会有什么变化。如果变了,应该不是id变,而是控件变了QTP面试题:如何用QTP录制鼠标右键点击事件 QTP面试题专栏, 软件测试面试题专栏 QTP录制鼠标右键单击事件要通过模拟键盘操作来实现Step 1,修改ReplayType为2,一般情况默认设置是1的。(1 使用浏览器事件运行鼠标操作。 2 使用鼠标运行鼠标操作)Setting.WebPackage(”ReplayType”) = 2Step 2,鼠标右键单击事件(附:Click的事件有三种 micLeftBtn 0 鼠标左键。 micRightBtn 1 鼠标右键。 micMiddleBtn 2 鼠标中键)Browser(”支付宝 网上支付 安全快速!”).Page(”支付宝 网上支付 安全快速!”).Link(”返回我要付款”).Click , , micRightBtnStep 3,点击右键弹出的菜单(采用键盘事件来模拟)Set wshShell = CreateObject(”WScript.Shell”)wshShell.SendKeys “DOWN” /键盘向下的箭头wshShell.SendKeys “DOWN”wshShell.SendKeys “ENTER” /回车键Step 4,修改ReplayType为1(使用浏览器事件运行鼠标操作)Setting.WebPackage(”ReplayType”) = 1Good to go now.同类其他面试题 点击新一篇或旧一篇可浏览全部同QTP面试题:如何用QTP打开word并录入内容 QTP面试题专栏, 软件测试面试题专栏 Set wobj = CreateObject(”Word.Application”)wobj.Visible = TrueSet Doc = wobj.Documents.AddSet Range = Doc.Paragraphs.Add.RangeRange.Text = “The first Paragraph”Doc.Paragraphs.AddSet Range2 = Doc.Paragraphs.Add.RangeRange2.Text = “The second Paragraph”软件测试QTP面试题 QTP面试题专栏, 软件测试面试题专栏 1. What are the Features & Benefits of Quick Test Pro (QTP 8.0)? Operates stand-alone, or integrated into Mercury Business Process Testing and Mercury Quality Center. Introduces next-generation zero-configuration Keyword Driven testing technology in Quick Test Professional 8.0 allowing for fast test creation, easier maintenance, and more powerful data-driving capability. Identifies objects with Unique Smart Object Recognition, even if they change from build to build, enabling reliable unattended script execution. Collapses test documentation and test creation to a single step with Auto-documentation technology. Enables thorough validation of applications through a full complement of checkpoints.2. How to handle the exceptions using recovery scenario manager in QTP? There are 4 trigger events during which a recovery scenario should be activated. A pop up window appears in an opened application during the test run: A property of an object changes its state or value, A step in the test does not run successfully, An open application fails during the test run, These triggers are considered as exceptions.You can instruct QTP to recover unexpected events or errors that occurred in your testing environment during test run. Recovery scenario manager provides a wizard that guides you through the defining recovery scenario. Recovery scenario has three steps: 1. Triggered Events 2. Recovery steps 3. Post Recovery Test-Run3. What is the use of Text output value in QTP? Output values enable to view the values that the application talks during run time. When parameterized, the values change for each iteration. Thus by creating output values, we can capture the values that the application takes for each run and output them to the data table.4. How to use the Object spy in QTP 8.0 version? There are two ways to Spy the objects in QTP: 1) Thru file toolbar, In the File Toolbar click on the last toolbar button (an icon showing a person with hat). 2) True Object repository Dialog, In Object repository dialog click on the button object spy. In the Object spy Dialog click on the button showing hand symbol. The pointer now changes in to a hand symbol and we have to point out the object to spy the state of the object if at all the object is not visible. or window is minimized then, hold the Ctrl button and activate the required window to and release the Ctrl button.5. How does Runtime data (Parameterization) is handled in QTP? You can then enter test data into the Data Table, an integrated spreadsheet with the full functionality of Excel, to manipulate data sets and create multiple test iterations, without programming, to expand test case coverage. Data can be typed in or imported from databases, spreadsheets, or text files.6. What is keyword view and Expert view in QTP?- Quick Tests Keyword Driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View. Advanced testers can view and edit their tests in the Expert View, which reveals the underlying industry-standard VBScript that Quick Test Professional automatically generates. Any changes made in the Expert View are automatically synchronized with the Keyword View.7. Explain about the Test Fusion Report of QTP? Once a tester has run a test, a Test Fusion report displays all aspects of the test run: a high-level results overview, an expandable Tree View of the test specifying exactly where application failures occurred, the test data used, application screen shots for every step that highlight any discrepancies, and detailed explanations of each checkpoint pass and failure. By combining Test Fusion reports with Quick Test Professional, you can share reports across an entire QA and development team.8. Which environments does QTP support?- Quick Test Professional supports functional testing of all enterprise environments, including Windows, Web,.NET, Java/J2EE, SAP, Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe terminal emulators, and Web services.9. What is QTP?- Quick Test is a graphical interface record-playback automation tool. It is able to work with any web, java or windows client application. Quick Test enables you to test standard web objects and ActiveX controls. In addition to these environments, Quick Test Professional also enables you to test Java applets and applications and multimedia objects on Applications as well as standard Windows applications, Visual Basic 6 applications and.NET framework applications.10. Explain QTP Testing process Quick Test testing process consists of the following main phases:1. Creating your test plan Prior to automating there should be a detailed description of the test including the exact steps to follow, data to be input, and all items to be verified by the test. The verification information should include both data validations and existence or state verifications of objects in the application.2. Recording a session on your application As you navigate through your application, Quick Test graphically displays each step you perform in the form of a collapsible icon-based test tree. A step is any user action that causes or makes a change in your site, such as clicking a link or image, or entering data in a form.3. Enhancing your test Inserting checkpoints into your test lets you search for a specific value of a page, object or text string, which helps you identify whether or not your application is functioning correctly. NOTE: Checkpoints can be added to a test as you record it or after the fact via the Active Screen. It is much easier and faster to add the checkpoints during the recording process. Broadening the scope of your test by replacing fixed values with parameters lets you check how your application performs the same operations with multiple sets of data. Adding logic and conditional statements to your test enables you to add sophisticated checks to your test.4. Debugging your test If changes were made to the script, you need to debug it to check that it operates smoothly and without interruption.5. Running your test on a new version of your application You run a test to check the behavior of your application. While running, Quick Test connects to your application and performs each step in your test.6. Analyzing the test results You examine the test results to pinpoint defects in your application.7. Reporting defects As you encounter failures in the application when analyzing test results, you will create defect reports in Defect Reporting Tool.11. Explain the QTP Tool interface- It contains the following key elements: Title bar, displaying the name of the currently open test, Menu bar, displaying menus of Quick Test commands, File toolbar, containing buttons to assist you in managing tests, Test toolbar, containing buttons used while creating and maintaining tests, Debug toolbar, containing buttons used while debugging tests. Note: The Debug toolbar is not displayed when you open Quick Test for the first time. You can display the Debug toolbar by choosing View . Toolbars . Debug. Action toolbar, containing buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow. Note: The Action toolbar is not displayed when you open Quick Test for the first time. You can display the Action toolbar by choosing View . Toolbars . Action. If you insert a reusable or external action in a test, the Action toolbar is displayed automatically. Test pane, containing two tabs to view your test-the Tree View and the Expert View ,Test Details pane, containing the Active Screen. Data Table, containing two tabs, Global and Action, to assist you in parameterizing your test. Debug Viewer pane, containing three tabs to assist you in debugging your test-Watch Expressions, Variables, and Command. (The Debug Viewer pane can be opened only when a test run pauses at a breakpoint.) Status bar, displaying the status of the test.12. How does QTP recognize Objects in AUT? Quick Test stores the definitions for application objects in a file called the Object Repository. As you record your test, Quick Test will add an entry for each item you interact with. Each Object Repository entry will be identified by a logical name (determined automatically by Quick Test), and will contain a set of properties (type, name, etc) that uniquely identify each object. Each line in the Quick Test script will contain a reference to the object that you interacted with, a call to the appropriate method (set, click, check) and any parameters for that method (such as the value for a call to the set method). The references to objects in the script will all be identified by the logical name, rather than any physical, descriptive properties.13. What are the types of Object Repositories in QTP? Quick Test has two types of object repositories for storing object information: shared object repositories and action object repositor

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论