QTP自动化测试—考核题目
mercuryQTP考题(1-150)
Objective Type / Multiple Choice Questions on QTP - QuickTest Professional under the Series(Quickly Review Your QTP Skills before appearing for HP Certification Exam)Set of 10 QuestionsQ. 1: You can manage the test actions and the test or function library steps using the _______ menu commandsA. FileB. EditC. AutomationD. Tools<<<<<< =================== >>>>>>√Q. 2: To expand all the steps in the keyword view which option you would use from the View menu. BA. ExpandB. Expand AllC. Expand ItemsD. Expand Rows<<<<<< =================== >>>>>>√Q. 3: What is the shortcut key to open a Step Generator? DA. F2B. F5C. F6D. F7<<<<<< =================== >>>>>>√Q. 4: Function Definition Generator in found in which menu option. CA. FileB. ToolsC. InsertD. View<<<<<< =================== >>>>>>√Q. 5: The shortcut keys for Record, Stop and Run respectively are AA. F3, F4, F5B. F4, F3, F5C. F4, F5, F3D. F3, F5, F4<<<<<< =================== >>>>>>√Q. 6: What is the shortcut key for opening an Object Repository? CA. Alt+RB. Shift+RC. Ctrl+RD. Shift+O+R<<<<<< =================== >>>>>>√Q. 7: Shortcut key to Insert/Remove a breakpoint is AA. F9B. F8C. Ctrl+bD. Shift+b<<<<<< =================== >>>>>>√Q. 8: The ______C____ runs only the current line of the script. If the current line calls a method, the method is displayed in the view but is not performed.A. Step overB. Step outC. Step into单步调试:只运行脚本的当前行D. Step Till<<<<<< =================== >>>>>>√Q. 9: The ____A____ runs only the current line of the script. When the current line calls a method, the method is performed in its entirety, but is not displayed in the view.A. Step OverB. Step OutC. Step IntoD. Step Till<<<<<< =================== >>>>>>Q. 10: What is the shortcut key to clear all Breakpoints? ABA. Ctrl+Shift+F9B. Shift+Ctrl+F9C. Alt+Shift+F9D. Alt+Ctrl+F9<<<<<< =================== >>>>>>√Q. 11: Using the Object Spy, you can view AA. The run-time or test object properties and methods of any object in an open application. 可以看到运行时的对象和方法B. The run-time or test object properties of any object in an open application.C. The test object properties and methods of any object in an open application.D. The run-time object properties and methods of any object in an open application.<<<<<< =================== >>>>>>√Q. 12: There are ________ object type filters in Object spy dialog box.AA. Two RO & TOB. ThreeC. FourD. Five<<<<<< =================== >>>>>>Q. 13: In the Object Spy window, in the Properties TabA. Copying of Properties and its values is possible with CTRL+CB. Copying of Properties and its values is possible by right clicking on it and choosing copy.C. Copying of Properties and its values is possible with both A. and B.D. Copying of Properties and its values is possible is not possible<<<<<< =================== >>>>>>Q. 14: In the Object Spy window, in the methods TabA. Copying of Methods is possible with CTRL+CB. Copying of Methods is possible by right clicking on it and choosing copy.C. Copying of Methods is possible with both A. and B. methodsD. Copying of Methods is possible is not possible<<<<<< =================== >>>>>>√Q. 15: Object Spy dialog box AA. Can be resizedB. Cannot be resized<<<<<< =================== >>>>>>√Q. 16: The _____D______ are the highest level of the test hierarchy in the Keyword view.A. TestsB. StepsC. Call to ActionsD. Actions<<<<<< =================== >>>>>>√Q. 17: You can copy and paste or drag and drop actions to move them to a different location within a test AA. TrueB. False<<<<<< =================== >>>>>>Q. 18: You can print the contents of the Keyword View to your Windows default printer (and even preview the contents prior to printing).可以打印,也可以查看打印视图A. True<<<<<< =================== >>>>>>√Q. 19: In the Keyword View, you can also view properties for items such as checkpoints. A在关键字试图可以查看对象的属性A. TrueB. False<<<<<< =================== >>>>>>√Q. 20: In the step Browser > Page > Edit > Set "Genius", identify container object(s) D哪些是容器对象?A. BrowserB. EditC. PageD. Both Browser & Page√Q. 21: Object Spy can be found in ____B______ menu.A. ToolB. ToolsC. TaskD. Tasks<<<<<< =================== >>>>>>Q. 22: The ____________ displays the open documents side-by-side.A. Tile Vertically 垂直地B. Tile Horizontally 水平地C. Cascade 瀑布模式D. Tile Cascade<<<<<< =================== >>>>>>√Q. 23: For opening the Quick Test Professional Help we can use _____C____A. F3B. F5D. F2<<<<<< =================== >>>>>>Q. 24: If QTP cannot find any object that matches the description, or if it finds more than one object that matches, QuickTest may use the ____________ mechanism to identify the object.A. Ordinal Identifier 顺序B. Index Identifier 索引C. Smart Identification 智能识别D. Assistive Identification<<<<<< =================== >>>>>>√Q. 25: You can configure the ____A_____ and ___________.properties that QuickTest uses to record descriptions of the objects in your application强制附属次序属性A. Mandatory, assistive, and ordinal identifierB. Mandatory, required, and ordinal identifierC. Smart, assistive, and ordinal identifierD. Index, assistive, and ordinal identifier<<<<<< =================== >>>>>>Q. 26: The ________ property set for each test object is created and maintained by QuickTest.A. Run-Time ObjectB. Test Object TO属性,仓库对象C. Smart Identification ObjectD. Assistive Object<<<<<< =================== >>>>>>Q. 27: You can access and perform _________ methods using the Object property.A. Run-Time Object RO属性,实际对象B. Test ObjectC. Smart Identification ObjectD. Assistive Object<<<<<< =================== >>>>>>Q. 28: You can view or modify the test object property values that are stored with your test in the ______________A. Information PaneB. Data TableC. Information Pane & Data Table BothD. Object Properties & Object Repository dialog box.可以通过**修改仓库对象属性<<<<<< =================== >>>>>>Q. 29: You can retrieve or modify property values of the test object during the run session by adding ____________ statements in the Keyword View or Expert View.A. GetROProperty & SetROPropertyB. GetTOProperty & SetTOProperty获得TO/修改TO值C. GetTOProperty & SetROPropertyD. GetROProperty & SetTOProperty<<<<<< =================== >>>>>>Q. 30: If the available test object methods or properties for an object do not provide the functionality you need, you can access _________ of any run-time object using the Object property.A. The internal methods and properties 内部的方法和属性???B. The mandatory methods and propertiesC. The selective methods and propertiesD. The assistive methods and properties√Q. 31: The Information pane provides a list of ___B_____ in the test:A. Semantic errorsB. Syntax errors 语法错误C. Common errorsD. Logic errors<<<<<< =================== >>>>>>√Q. 32: When we switch from Expert view to the Keyword view, QTP automatically checks for syntax errors in the test and shows them in the information pane. AA. TrueB. False<<<<<< =================== >>>>>>√Q.33: If the information pane is not open, QTP automatically opens it in case a syntax error is detected. A语法错误QTP会自动打开检查A. TrueB. False<<<<<< =================== >>>>>>√Q. 34: The ____B___ provides a list of the resources that are specified in your test but cannot be found.A. Missing paneB. Missing Resources paneC. Resources paneD. Missing Items pane<<<<<< =================== >>>>>>√Q. 35: Whenever you open a test or a function library, QTP automatically checks for the availability of specified resources. AA. TrueB. False<<<<<< =================== >>>>>>√Q. 36: The Data Table does not assist you in parameterize your test. BA. TrueB. False<<<<<< =================== >>>>>>√Q. 37: Tabs in the Debug Viewer pane are: CA. Watch, Variables, DebugB. Watch, Data, CommandC. Watch, Variables, CommandD. View, Variables, Command<<<<<< =================== >>>>>>√Q. 38: The ___A____ tab enables you to view the current value of any variable or VBScript expression.A. Watch 可以点右键add到watch查看B. ViewC. LocateD. Current<<<<<< =================== >>>>>>√Q. 39: The ___B_____ tab displays the current value of all variables that have been recognized up to the last step performed in the run session.A. ViewB. Variables 展示当前所有运行中的已定义的变量C. LocateD. Current<<<<<< =================== >>>>>>√Q. 40: The____C______ tab enables you to run a line of script to set or modify the current value of a variable or VBScript object in your test or function library.A. ViewB. VariablesC. CommandD. Current√Q. 41: QuickTest processes comments when it runs a test. B运行时不执行注释语句A. TrueB. False<<<<<< =================== >>>>>>√Q. 42: Press ___A______ to add a new step below the currently selected step.A. F8B. Shift + AC. F0D. Shift + A + Q<<<<<< =================== >>>>>>Q. 43: While working with the Keyword View, you can ______ steps to move them to a different location in a test or in an actionA. Copy and Paste 拷贝和粘贴B. Cut and PasteC. Drag and drop 拖拉D. Both A. and C.<<<<<< =================== >>>>>>√Q. 44: You can specify the order in which the columns are displayed in the Keyword view. A可以在关键字视图里指定列的排列次序A. TrueB. False<<<<<< =================== >>>>>>Q. 45: You can view _____ while working with keyword view.A. Object properties 对象属性B. Action propertiesC. Action call properties 调用属性D. Checkpoint properties 检查点属性E. Output value properties 输出值属性F. None of the aboveG. All of above<<<<<< =================== >>>>>>√Q. 46: You cannot manage some aspects of a local object repository using the QuickTest Object Repository automation object model.BA. TrueB. False<<<<<< =================== >>>>>>√Q. 47: For each action, you can use a combination of objects from your local and shared object repositories.A本地和共享的对象属性A. TrueB. False<<<<<< =================== >>>>>>√Q. 48: QuickTest adds all new objects to the local object repository even if one or more shared object repositories are already associated with the action assuming that an object with the same description does not already exist in one of the associated shared object repositories. A 可以把不存在于任何共享对象库的属性添加到本地对象库A. TrueB. False<<<<<< =================== >>>>>>√Q. 49: If a child object is added to a local object repository, and its parents are in a shared object repository, then you have to manually drag and drop its parent objects from shared object repository to local object repository. B不用手动添加,父对象直接跟过来A. TrueB. False<<<<<< =================== >>>>>>Q. 50: The _____ is not accessible as a separate fileA. Local object repositoryB. Shared object repositoryC. BothD. NoneQ. 51: You can use the Keyword View to add a step _______ in your test.A. At the endB. Below the currently selected stepC. At the beginningD. At any point<<<<<< =================== >>>>>>Q. 52: The Documentation cell is ___________.A. Read-onlyB. Write-onlyC. Read and WriteD. Read write & execute<<<<<< =================== >>>>>>Q. 53: An Item column can be any of the following:A. A test objectB. A statement like Dim 声明C. A step generated by step generator 步骤D. All of above<<<<<< =================== >>>>>>Q. 54: The Operation cell in the keyword view specifies the operation to be performed on the item listed in the ___________ Column.A. OperationB. DocumentationC. ItemD. Value<<<<<< =================== >>>>>>Q. 55: Even if the Item column in the Keyword View is displayed to the right of the Operation column, you must still first select an item to view the list of available operations in the Operation column.A. TrueB. False<<<<<< =================== >>>>>>Q. 56: The Value cell in the keyword view can contain ___________ ValueA. Constant 常量B. Parameter 参数化的变量C. Both A. & B.D. None of these<<<<<< =================== >>>>>>Q. 57: The ______________ enables you to encode your passwords and place secure values into the Data Table.A. Password Encoder 密码编译器B. Password DecoderC. Password EncodeD. Password Decode<<<<<< =================== >>>>>>Q. 58: You can also encrypt strings in Data Table cells using the_____________ option in the Data Table menu.A. DecryptB. Encrypt 将…译成密码C. Encrypt CodeD. Decrypt Code<<<<<< =================== >>>>>>Q. 59: In addition to adding standard statement steps to your test using the Keyword View, you can also insertA. Checkpoint step 检查点B. Output value step 输出值C. Comment step 注释D. All of above<<<<<< =================== >>>>>>Q. 60: The correct syntax of the conditional statement starting with Do is ________A. Do WhileB. Do UntilC. Do Next For … NextD. Both A. and B.Q. 61: In the Object Repository window.A. Local objects are editable (black) 本地对象是可编辑的(黑色)B. Shared objects are in read-only format (gray) 共享对象是只读的(灰色)C. Local objects are in read-only format (gray)D. Shared objects are editable (black)<<<<<< =================== >>>>>>Q. 62: Mark the true statementA. You can delete objects from a shared object repository using the Object Repository window.B. You can delete objects from the local object repository using the Object Repository ManagerC. You can delete objects from the local object repository using the Object Repository window 在对象库窗口中可以删除本地对象D. You can delete objects from a shared object repository using the Object Repository Manager 在对象库管理器可以删除共享对象<<<<<< =================== >>>>>>Q. 63: You can modify an object stored in a shared object repository.A. Using the Object Repository ManagerB. Using the Object Repository windowC. You can copy it to the local object repository and then modify its propertiesD. You cannot modify properties of objects stored in Shared object repository <<<<<< =================== >>>>>>Q. 64: If an object is contained in both local and shared repositories then, during a run session.A. QuickTest will use the object in the local object repositoryB. QuickTest will use the object in the Shared object repositoryC. There will be a conflictD. QuickTest will use Descriptive Programming<<<<<< =================== >>>>>>Q. 65: When you copy an object to the local object repositoryA. Its parent objects are also copied to the local object repositoryB. Its parent objects are not copied to the local object repositoryC. You have to manually copy its parent objects are also copied to the local object repositoryD. You have to manually drag and drop its parent objects<<<<<< =================== >>>>>>Q. 66: For tests, you can also view test object properties and property values for objects in the Active Screen, regardless of whether the objects are stored in the object repository.A. TrueB. False<<<<<< =================== >>>>>>Q. 67: Object Properties window differs for objects stored in Shared and Local object repository.本地对象库和共享对象库是不同的A. TrueB. False<<<<<< =================== >>>>>>Q. 68: You can rename objects in the shared object repository using the Object Repository ManagerA. TrueB. False, you cannot rename objects in shared object repository<<<<<< =================== >>>>>>Q. 69: When you modify the name of an object in the local object repository, the name is automatically updated in ___________ for all occurrences of the object.A. in the Keyword ViewB. in the Expert ViewC. Both Keyword and Expert ViewD. Changing name of an object doest not effect keyword or expert view<<<<<< =================== >>>>>>Q. 70: When you modify the name of an object in a shared repository, the name is automatically updated in all tests open on the same computer that use the object repository as soon as you make the change, even if you have not yet saved the object repository with your changes.A. TrueB. FalseQ. 71: 'Browser navigation timeout' is in which tab of Test Settings (File->Settings) window.A. PropertiesB. ResourcesC. WebD. Web Settings<<<<<< =================== >>>>>>Q. 72: How many tabs are there in Test Settings (File->Settings) window?A. 7B. 6C. 5D. 8<<<<<< =================== >>>>>>Q. 73: Identify the tabs in the Test Settings (File->Settings) windowA. Properties, Run, Resources, Parameters, Environment, Web, RecoveryB. Properties, Run, Resources, Parameters, Environment, Web Settings, RecoveryC. Properties, Run Options, Resources, Parameters, Environment, Web, RecoveryD. Properties, Run, Resources, Input Parameters, Environment, Web, Recovery<<<<<< =================== >>>>>>Q. 74: 'Generate Script' is in which tab of Test Settings (File->Settings) windowA. PropertiesB. WebC. ResourcesD. Recovery<<<<<< =================== >>>>>>Q. 75: The following are the four main columns in the Keyword viewA. Item, Operation, Value, CommentsB. Item, Operation, Value, DocumentationC. Item, Operation, Property, DocumentationD. Number, Operation, Value, Documentation<<<<<< =================== >>>>>>Q. 76: For each object and method in an Expert View statement, a corresponding row exists in the Keyword View.A. TrueB. FalseC. There is a problem with the statement.D. None of above<<<<<< =================== >>>>>>Q. 77: You can work on one or several function libraries at the same time.A. TrueB. False<<<<<< =================== >>>>>>Q. 78: You can insert additional steps on the test objects captured in the Active screen after the recording session.A. TrueB. False<<<<<< =================== >>>>>>Q. 79: The Active Screen enables you to parameterize object values and insert checkpointsA. TrueB. False<<<<<< =================== >>>>>>Q. 80: A QTP user can increase or decrease the active screen information saved with the test.A. TrueB. FalseQ. 81: An __________ assigns a numerical value to a test object that indicates its order or location relative to other objects with an otherwise identical descriptionA. Index identifier.B. Ordinal identifier.C. SMART ID identifier.D. Original identifier.<<<<<< =================== >>>>>>Q. 82: You can add an object to the local object repository only if that object does not already exist in a shared object repository that isassociated with the action. If an object already exists in an associated shared object repository, you can add it to the local object repository using the ______________ option.A. Copy from Shared RepositoryB. Copy from Shared Object RepositoryC. Copy to LocalD. Copy to Local repository<<<<<< =================== >>>>>>Q. 83: You can copy, paste, and move objects in the local object repository using the Object Repository window, and copy, paste, and move objects both within a shared object repository and between shared object repositories using the Object Repository Manager. But you cannot copy objects from a shared object repository to the local object repository to modify them locallyA. TrueB. False<<<<<< =================== >>>>>>Q. 84: At the time of copying, pasting and moving objects, you cannot move an object to any of its descendants.操作的时候子对象不能再动了A. TrueB. False<<<<<< =================== >>>>>>Q. 85: When you remove a step from your test, its corresponding object is also removed from the object repositoryA. TrueB. False<<<<<< =================== >>>>>>Q. 86: You can use the Find and Replace dialog box to replace property or object names.对象和属性可以查找和替换A. TrueB. False<<<<<< =================== >>>>>>Q. 87: The Object Repository window is __________ during record and run sessions录制的时候对象库是只读的A. Read-onlyB. Rad-write onlyC. Read-write and enableD. None of above<<<<<< =================== >>>>>>Q. 88: In the Associated Repositories tab of the Action Properties dialog box, the __________ object repository is always listed first and cannot be moved down the priority list or deleted.A. LocalB. Shared ???共享对象库只可拷贝,不可删除C. BothD. None<<<<<< =================== >>>>>>Q. 89: In the Associated Repositories tab of the Action Properties dialog box, although we can order the object repositories according to our choice except the fact that Shared Repository remains the first one and cannot be removed.A. TrueB. False ???<<<<<< =================== >>>>>>Q. 90: If your object repositories are stored in the file system and you want other users or Mercury products to be able to run this action on other computers, you should set the file path as a ______________.A. Absolute pathB. Relative path 相对路径C. BothD. None of aboveQ. 91: Panes in QTP can have one of the following states—docked or floating.窗口可以停靠和悬浮A. TrueB. False<<<<<< =================== >>>>>>√Q. 92: Which of the following statement is True: AA. Quick Test enables you to open and work on one test at a timeB. Quick Test enables you to open and work on two tests at a timeC. Quick Test enables you to open and work on predefined number of tests at a timeD. Quick Test enables you to open and work on nine test at a time<<<<<< =================== >>>>>>√Q. 93: Which of the following statement is true? BA. You can open and work on two function libraries simultaneouslyB. You can open and work on multiple function libraries simultaneouslyC. You can open and work on nine function libraries simultaneouslyD. You can open and work on one function library at a time<<<<<< =================== >>>>>>√Q. 94: You can open any function library, regardless of whether it is associated with the currently open test. A可以打开不想关联的函数并查看A. TrueB. False<<<<<< =================== >>>>>>Q. 95: You can work with multiple documents (test, component, or application area, function libraries: using the ______ dialog boxA. PanesB. DisplayC. ShowD. Windows<<<<<< =================== >>>>>>√Q. 96: Quick Test has ______ Built-in toolbars. DA. 5B. 6C. 7D. 8<<<<<< =================== >>>>>>√Q. 97: The ________ toolbar contains buttons for recording and running your test. CA. StandardB. ToolsC. AutomationD. Edit<<<<<< =================== >>>>>>√Q. 98: Shortcut Key for opening a new Function Library is:AA. Shift+Alt+NB. Ctrl+Alt+NC. Shift+ND. CRTL+N<<<<<< =================== >>>>>>√Q. 99: Shortcut Key for closing all open Function Libraries in one go.DA. Ctrl+Alt+CB. Shift+A+CB. Shift+ND. None of these<<<<<< =================== >>>>>>√Q. 100: Shortcut Key for Commenting out the current row, or selected rows CA. Shift+MB. Ctrl+CC. Ctrl+MD. Shift+C√Q. 101: By default, new actions are DA. ShortB. ExternalC. ReusableD. Non-reusable<<<<<< =================== >>>>>>√Q. 102: You can display or hide the Action toolbar in the Keyword View by choosing ________ AA. View > Toolbars > ActionB. View > Toolbars > ActionsC. View > Toolbar > ActionD. Views > Toolbars > Action<<<<<< =================== >>>>>>Q. 103: The ____ ____ enables you to view either the entire test flow (the calls to the actions in the test) or you can view the steps for a selected reusable or external action.A. Action FlowB. Action fileC. Action ListD. Action Repository<<<<<< =================== >>>>>>√Q. 104: In the ___A__ the Action List is always visible and the Expert View always displays the script for the selected action.A. Keyword View所有的action都可以看到B. Expert View 只可看见当前选择的actionC. Action FlowD. Action View<<<<<< =================== >>>>>>Q. 105: The _______ method - imports a sheet of a specified file to a specified sheet in the run-time Data Table.。
QTP试题
QTP试题本试卷总分为100分,分填空和选择两类题型填空(共10小题,每题4分共40分。
填写正确得4分,不填不得分,填错扣4分,请用英文填写,中文填写不得分)1:当前使用的QTP主要版本,默认安装了几个插件(Add In)?( 3 )个。
Vb,web,ActiveX2:QTP中的两个视图(view)分别为:(expert view专家视图)和(keyword view 关键字视图)。
3:Datatable中的第一个表(sheet)的名称是(Global )4:数据表(datatable)在脚本文件夹中的名称是:(default.xls )5:用于获得对象的运行时属性值的函数是(GetROProperty )6:在QTP中存放测试对象(Test Object)的地方是()7:在QTP中使用()来查看对象的属性8:QTP的运行模式(run mode)有哪两种(normal)和(fast )9:VBS语法中判断两个值不等的运算符是(<>)10:要求脚本中使用的变量必须定义,使用哪个语句(option explicit )不定项选择(共15题,每题4分共60分,完全正确得4分,不选不得分,错选少选多选扣4分)1:QTP支持在下面的哪些浏览器上录制脚本(AB )NetscapeMicrosoft Internet ExplorerAOL (America Online)带有嵌入式Web 浏览器控件的应用程序A:IE B: Netscape C: Firefox D:Opera2:Emulator You need to identify the values of the following system variables: OSVersion,Product –Dir, and TestDir. What is the tab in QuickTest that contains this information,and where is the tab located?A: Enviroment. It is in Test Settings (File -> Settings)B: Active Screen.It is in Options(Tools->Options)C: Folders. It is in Options(Tools->Options)D: Resourses. It is in Test Settings (File -> Settings)3:一个test中有两个Action,A和B。
项目自动化测试题及答案
项目自动化测试题及答案一、选择题1. 自动化测试的主要目的是提高测试的______。
A. 覆盖率B. 效率C. 准确性D. 可重复性答案:B2. 在自动化测试中,以下哪个不是测试框架的组成部分?A. 测试用例B. 测试执行器C. 测试报告生成器D. 测试环境配置答案:D3. 以下哪个工具不是用于自动化测试的?A. SeleniumB. JUnitC. GitD. TestNG答案:C二、填空题4. 自动化测试可以减少人为错误,提高测试的______和______。
答案:效率;准确性5. 持续集成(CI)是自动化测试中的一个重要概念,它指的是在软件开发过程中,______将代码合并到主分支。
答案:开发者三、简答题6. 请简述自动化测试与手动测试的主要区别。
答案:自动化测试是指使用专门的软件工具来执行测试用例的过程,它可以在无需人工干预的情况下重复执行测试。
手动测试则需要测试人员亲自执行测试用例,通常用于探索性测试或自动化难以实现的测试场景。
自动化测试可以提高测试效率,减少重复性劳动,而手动测试则更灵活,能够适应复杂多变的测试需求。
7. 描述自动化测试在软件开发生命周期中的一般应用流程。
答案:自动化测试通常在软件开发生命周期的早期阶段开始规划,包括测试策略的制定、测试环境的搭建和测试框架的选择。
在开发过程中,随着功能模块的完成,相应的自动化测试脚本也会被开发和执行。
在持续集成过程中,自动化测试会定期运行,以确保新代码的集成不会引入缺陷。
在软件发布前,自动化测试可以帮助快速验证软件的质量。
四、论述题8. 论述为什么自动化测试不能完全取代手动测试,并提出在实际工作中如何平衡两者的使用。
答案:尽管自动化测试具有高效率和可重复性的优点,但它并不能完全取代手动测试。
自动化测试通常适用于回归测试和大量重复性测试,但对于探索性测试、用户界面测试和一些需要创造性思维的测试场景,手动测试更为合适。
此外,自动化测试可能无法覆盖所有的测试场景,特别是在面对复杂逻辑和动态内容时。
QTP自动化测试—考核题目
自动化测试考核一、多项选择题(共30分,每题5分)1.QTP的对象库的原理顺序(ACE)A.封装被测对象到对象库B.录制对象为脚本,对象库存在对象C.运行QTP脚本时,会启用对象库里对象属性和运行中的被测属性进行对比D.脚本的描述与对象匹配E.对比成功之后找到需要运行的对象2.下面关于描述对象库正确的是()A.QTP封装的一层接口属性,控件自身并没有此属性B.对象库能够识别对象是依赖于BHO机制的C.对象库简称是ORP,能够识别任何一种对象(对象库简称OR,object Repository)D.对象库里面的对象可以进行添加、复制、剪切、高亮灯操作E.可轻易的修改对象库中对象的描述属性,并能够更好的管理对象。
F.对象库录制好的对象,另存为后的文件格式是.txr(后缀名是.trs)3.录制的3种模式分别是(BDF)A.高级录制模式B.低级录制模式C.捕捉录制模式D.模拟录制模式E.动作录制模式F.正常录制模式4.Flie->Setting->Run,进入Run设置页面,在When eror occurs during run session(当在运行期间发生错误时)提供了多少个处理选择(A E F G)A.pop up message boxB.Proceed to run step actionC.Stop ationD.Proceed to next action iterationE.Stop runF.Proceed next action iterationG.Proceed to next step5.以下的选项为正确的是(ACDEF)A.QTP的两种运行模式包括:快速运行模式和正常运行模式B.当QTP正在回放时,使用快捷键Ctrl+Alt+F5能够退出回放(Ctrl+Alt+F5是停止运行的快捷键)C.回放类型包括事件模拟类型和鼠标模拟类型D.进入QTP使用快捷键Ctrl+R就能直接打开对象库E.回放机制:封转对象与虚拟对象的匹配F.公共对象库能够对比、合并、拆分对象6.以下的选项为错误的是(BDF)A.Setting.WebPackage("ReplayType")=2,这个代码是把回放模式改成鼠标模拟模式B.在进行录制的时候应该关闭不需要的浏览器C.开启模拟录制模式前的必要条件是开启正常录制模式D.QC调用的方式执行脚本,运行模式是Normal(应该是fast模式)E.在Normal运行模式中上设置间隔事件,单位是毫秒F.脚本运行时,左侧有黄色箭头,则代表这种运行模式是Fast(有黄色箭头的是Normal模式)二、解答题(共20分,每题10分)a.根据以下素材编写自动化测试用例,素材如下:1)系统名称《自动化测试用例设计系统》,B/S架构;2)整个登录功能的验证只涉及2个页面《登录页面》、《内容页面》3)“登录页面”具备4个控件[用户名输入]、[密码输入]、[登录]、[重置];4)“内容页面”中存在文字<欢迎回来,xx>,具备1个控件[退出系统];5)该系统是不用手工清除IE缓存,不点击[退出系统],直接关闭网页,下次访问无须重新登录,直接以已登录状态访问<内容页面>,非常方便;6)在“素材4”中,内容页面里的文字专门用作检查登录系统是否成功;步骤序列业务操作描述预期结果测试所用数据1 进入“自动化测试用例设计系统”登录页面。
自动化测试工程师招聘笔试题与参考答案(某世界500强集团)2024年
2024年招聘自动化测试工程师笔试题与参考答案(某世界500强集团)(答案在后面)一、单项选择题(本大题有10小题,每小题2分,共20分)1、以下哪种技术不属于自动化测试工具的核心技术?A、脚本语言编程B、数据库操作C、界面自动化D、人工智能2、在进行自动化测试时,以下哪个阶段不是自动化测试的典型阶段?A、测试需求分析B、测试用例设计C、测试脚本开发D、测试执行与结果分析3、下列哪种语言不常用于编写自动化测试脚本?A、JavaB、PythonC、C++D、HTML4、在自动化测试中,下列哪个工具主要用于性能测试?A、SeleniumB、JUnitC、LoadRunnerD、Appium5、以下哪种自动化测试工具主要用于Web应用程序的测试?A. Selenium WebDriverB. AppiumC. JMeterD. QTP6、在自动化测试过程中,以下哪个阶段通常不是必须的?A. 测试用例设计B. 测试环境搭建C. 测试执行D. 测试报告撰写7、在自动化测试中,哪一个工具常被用来进行Web应用的UI测试?A. JUnitB. SeleniumC. PostmanD. LoadRunner8、下列哪一项不是持续集成(CI)实践的一部分?A. 自动化构建B. 手动代码审查C. 自动化测试D. 版本控制9、在自动化测试中,以下哪种技术用于模拟用户在应用程序中的操作?A. 数据库脚本B. 消息队列C. 模拟器(Simulator)D. 自动化测试工具 10、以下哪个指标通常用于衡量自动化测试效率?A. 测试覆盖率B. 执行速度C. bug发现率D. 测试用例数量二、多项选择题(本大题有10小题,每小题4分,共40分)1、下列哪些工具可以用于Web应用的自动化测试?A. SeleniumB. JMeterC. AppiumD. PostmanE. Jenkins2、在自动化测试中,下列哪些是构建持续集成环境的重要组成部分?A. 版本控制系统如GitB. 持续集成服务器如JenkinsC. 自动化测试框架如Selenium GridD. 缺陷跟踪系统如JIRAE. 应用程序性能管理工具如New Relic3、以下哪些工具或技术是自动化测试工程师在测试过程中常用的?()A. SeleniumB. AppiumC. JMeterD. JUnitE. SoapUI4、以下哪些是软件测试的生命周期阶段?()A. 需求分析B. 设计C. 开发D. 测试E. 维护5、以下哪些工具或技术是自动化测试工程师在测试过程中常用的?()A. SeleniumB. JMeterC. AppiumD. LoadRunnerE. Postman6、以下关于软件测试的生命周期模型的描述,正确的是哪些?()A. 灰盒测试是黑盒测试和白盒测试的混合B. 静态测试通常在软件开发的早期阶段进行C. 软件测试的生命周期模型包括需求分析、设计、编码和测试等阶段D. 验收测试通常由最终用户进行E. 软件测试的生命周期模型不包括测试计划阶段7、以下哪些工具或技术通常用于自动化测试?()A. Selenium WebDriverB. JMeterC. AppiumD. LoadRunnerE. SoapUI8、以下哪些说法关于单元测试和集成测试是正确的?()A. 单元测试通常关注于代码模块的测试,而集成测试关注于模块间的交互。
TCL自动化测试脚本语言编程试题(附答案) - 副本
一填空题(每题2分,共10分)1.以下对自动化测试描述不正确的是?A.自动化测试可替代手工测试B.自动化测试发现的故障数不及手工测试C.自动化测试对测试质量的依赖性大D.自动化测试应在周期长的项目中引入2.自动化测试分析时,不该做的分析是下面哪一个?A.可行性分析B.测试需求分析C.抽样demo分析D.软件成本分析3.下列对自动化测试用例设计原则描述中,不正确的是?A.自动化测试用例的选择一般以“反向”为主B.自动化测试用例的范围往往是核心业务流程C.不是所有的手工测试用例都可以使用自动化测试来实现D.自动化测试用例不需要每个步骤都输出预期结果4.自动化测试工具QTP支持的语言是下面哪一种?A.JavaB.RubyC.PythonD.VBScript5.QTP工具中用于实现QTP说明书功能的是哪个键?A.F1B.F2C.F3D.F5二简答题(每题5分,共50分)注:为区分特殊符号,本次考试需要打印输出的内容在卷面中以粗斜体显示!1.自动化测试中,测试脚本可分为哪5种?1)线性脚本2)结构化脚本3)可共享脚本4)数据驱动脚本5)关键字驱动脚本2.自动化测试优势1)回归测试更方便、可靠;2)可运行更多、繁琐的测试,且高校、快速;3)可执行一些对于手工测试来说相当困难或根本做不到的测试;4)更好的利用资源,使资源的使用更有价值;5)具有一致性和可重复性;6)自动化测试脚本完全具有服用性;7)使软件更有信任度;8)多环境下测试;3.画出自动化测试流程图:4.打印输出“Hello Tcl!”;% puts "Hello Tcl!"5.定义变量a=10、b=20、c=a*b,输出变量c;% set a 10% set b 20% set c [expr $a * $b]6.计算字符串“My name is TCL”的长度;% puts stdout "The length of \"$a\" is: [string length $a]"7.已知本地E:\TCL\TCL_setup目录下存在脚本文件exec.tcl,请给出调用该脚本的方法;% cd E:\\TCL\\TCL_setup% source exec.tcl8.对数字5进行左移2位运算,并将计算结果赋值给变量n;% set n [expr 5<<2]9.计算2^16,并将结果取整显示;% expr int(pow(2,16))10.取5-10之间的随机数;% set min 5% set max 10% expr int(rand()*($max-$min+1)+$min)11.将字符串“again”追加至变量a尾部,输出追加后的字符串“see u again”;% set a "see u"% set b again% append a \ $bsee u again12.重新排列字符串"love" "game" "i" "this" "!";% set var1 [format "%3\$s %1\$s %4\$s %2\$s %5\$s" "love" "game" "i" "this" "!"]13.提取数字1-20中的质数,并按照升序排列输出;% set res [format "%1\$s %3\$s %5\$s %7\$s %11\$s %13\$s %17\$s %19\$s" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]14.用科学计数法表示数字80000,并记录在由ascii码转换后的符号()内;% set c [format %c%e%c 40 80000 41](8.000000e+004)15.获得字符串“hello”中字符e的整数值;% binary scan "hello" "cc" var1 var2% puts $var216.将字符串“sorry”中的字符o替换为字符@;% string replace sorry 1 1 @17.已知列表a [my name is tom],输出列表中的tom字符串;% set a "my name is tom"% puts [lindex $a 3]18.使用列表遍历指令输出下面内容:我喜欢吃: 苹果我喜欢吃: 梨子我喜欢吃: 香蕉我喜欢吃: 西瓜set fruit {苹果梨子香蕉西瓜}foreach f $fruit {puts "我喜欢吃: $f"}19.遍历列表输出下面内容:学号=1 姓名=tom 年龄=23 班级=C1学号=2 姓名=jack 年龄=22 班级=C2学号=3 姓名=nacy 年龄=21 班级=C3学号=4 姓名=peter 年龄=22 班级=C4set id {1 2 3 4}set name {tom jack nacy peter}set age {23 22 21 22}set classes {C1 C2 C3 C4}foreach a $id b $name c $age d $classes {puts [format "学号=%-s 姓名=%-s 年龄=%-s 班级=%-s" $a $b $c $d] }20.已知整数123,分别取出个位数,十位数和百位数;% set i 123% set a [expr $i/100]% set b [expr $i%100/10]% set c [expr $i%10]% puts $a,$b,$c21.将下列代码未完成的地方补充完整;set ids(a) 192set ids(b) 168set ids(c) 5set ids(d) 100set lst [ array get ids ]puts $lstforeach { x y } $lst {puts "x:$x y:$y"}提示:以上代码输出结果为:x:4 y:100x:2 y:168x:3 y:522.使用if语句实现功能:变量a为10,变量b为20,若a+b>20,输出结果,反之给出错误提示信息“Error”;set i 10set j 20if {[expr $j+$i]>20} {set x [expr $i+$j]puts $x} else {puts "Error"}三代码编程题(每题10分,共40分)1.求水仙花数(水仙花数是个三位数,比如153,这个数具有个特点,153=1^3+5^3+3^3) set i 100while {$i<1000} {set a [expr $i/100]set b [expr $i%100/10]set c [expr $i%10]set d [expr int(pow($a,3)+pow($b,3)+pow($c,3))]if {$i==$d} {puts $i}incr i}2.青蛙在一口77米深的井底往上爬,白天爬7米,夜里下落5米,问第几天能爬出井口?set cn 7set day 1while {$cn<=77} {incr cn -5incr day 1incr cn +7}puts $day3.求出1-100之间所有正整数之和,包含1和100;set i 1set sum 0while {$i<=100} {set sum [expr $i+$sum]#set i [expr $i+1]}puts $sum4.输出1-100之间能被5整除的数;set i 1while {$i<=100} {set result [expr $i%5]if {$result==0} {puts $i}incr i}5.打印9行9列左上直角三角形;proc leftup {b} {for {set y 0} {$y<$b} {incr y} {set line ""for {set x 0} {$x+$y<9} {incr x} { append line *}puts $line}}puts [leftup 9]6.编写代码输出十进制转二进制的函数;proc d2b {d} {set bs ""while {$d!=0} {set y [expr $d%2]set d [expr $d/2]set bs $y$bs}return $bs}puts [d2b 77]7.编写代码判断某个1993年是否为闰年;set i 1993set a [expr $i%4]set b [expr $i%100]set c [expr $i%400]if { $a==0 | $b==0 & $c==0 } {puts "\"$i\"年是闰年"} else {puts "\"$i\"年不是闰年"}8.打印9行9列右下直角三角形。
TSD1405_QTP_阶段考试_答案
一、简答题(30分=3分X10)1.QTP有几种视图,是哪几种(要求:中英文两种写法)?2种关键字视图(KeyWord View)专家视图(Expert View)Item,Opration, Value张三吃饭张三跑2.简述QTP的对象仓库机制如何实现自动化测试?a. 封装被测对象到对象库(1)获得操作的对象的属性(2)用唯一的一个对象名称把操作对象存储在对象仓库(3)存储操作的对象全部属性(4)标识关键属性(5)在脚本代码中记录操作对象和操作以及操作数据b. 对比对象库里的对象属性和运行时的真实被测对象的属性(1)取得脚本代码中操作对象(2)到对象仓库中使用脚本中的对象名称查找该对象(3)从对象仓库中获取操作对象的关键属性,和实际运行对象的关键属性对比TO Test ObjectRO Run-time ObjectFile\Settings\Run\Object synchronization timeout xxsecondsc. 对比一致后找到相应的对象,按照脚本驱动对象3.如果两行代码之间存在延时,有几种方法解决?分别写出每种解决办法的用法。
a.WaitWait time(s)b.设置步骤之间延时时间Tools Options->Run->Normalc.添加同步点Object.WaitProperty “属性名”,“属性值”,timeout(ms) 4.如下代码:脚本循环几次?输出内容是?Print DataT able(1,1)Print DataT able(1,2)DataTable中数据如下:循环开关设置如下:脚本反复4次c1c2c3d1d2d3e1e2e3f1f2f3(实际运行:字符竖向输出)5.以下代码,输出的内容为?Function myfun(num1,num2)Dim mynummynum=100myfun=mynum+num1*num2End FunctionMsgbox myfun(4,5)+mynum输出1206.Action的类型有几种,分别是?a. reusable action:可以被其它测试调用b. non-reusable action: 不可以被其它测试调用7.输入数据参数化的类型有哪些?DataTableEnvironmentRandomNumber8.对输入数据使用DataTable参数化之后,Global 和Action反复的次数在什么位置设置?Global:File->Settings->RunAction:Test Flow下右击Action→Action call Properties→Run 9.Insert—>Output建立的输出值可以存放在什么位置?DataTableEnvironment10.写出下列正则表达式中元字符的意义。
QTP面试题_0
QTP面试题1. 准备录制在录制测试前,请确认应用程序和QuickTest 已按测试要求设置。
请确保应用程序显示要录制的元素,例如,工具栏或特殊窗口窗格;还要确保应用程序选项已按测试目标设置。
为了确保QuickTest 可以正确地录制和存储信息,您还应该查看“测试设置”Window Id对应Windows应用程序的控件ID(Control ID),是指Windows指定给每个控件的数值型标识符,用来标识一种控件类型。
不同类型的控件id就会不一样,同样类型的控件id是一样的。
例如windows资源管理器的control id和打开文件对话框中的资源管理器属于同样在调试脚本的时候,通常会用采用很多msgbox函数,但是这些提示框必须要手动关闭,否则脚本不会继续往下执行,你可以设计一个函数,在几秒钟之后自动关闭提示框吗?答案:Set WshShell = CreateObject(“Wscript.Shell”) WshShell.Popup “请等待5秒钟,5秒可以按照如下步骤:1. 在QC的Tool > Options > Run in QTP下选中Allow other Mercury products to run tests and components 2. 如果你是在同一个有QC 客户端的机器上跑测试,你需要:1. QTP Connectivity Add-In 2. QTP Add-in 3. 如果你是在另外一个没有Q代码如下例所示,假设要创建的文件夹是在C:\drive. 如何用QTP脚本创建一个文件夹:Dim strDrive, strfoldername,objFSO, objFolder, strPath strDrive = “c:\”‘你要创建的文件夹所在的盘符strfoldername=”test”‘你要创建的文件夹名strPath= strDri1. What are the Features is it possible to do it in QTP, if so explain? –Batch Testing in WR is nothing but running the whole test set by selecting Run Test set from the Execution Grid. The same is possible with QTP also. If our test case。
QTP练习
∙ 1. (单选)以下选项中,除了哪一项以外,都可以将目标对象添加到对象仓库()o A. 录制代码时,对目标对象做操作;o B. 在显示目标对象的Active Screen中,做添加对象操作;o C. 录制代码时,对目标对象插入检查点;o D. 设置Record and Run Settings;正确答案:D∙ 2. (单选)下列关于QTP中插入检查点的叙述中,不正确的是() o A. 可以在录制过程中插入检查点;o B. 可以从Active Screen中插入检查点;o C. 可以从菜单中插入检查点;o D. 可以在专家视图中自己写脚本语句插入检查点;正确答案:D∙ 3. (单选)VBScript是一种面向对象的可视化程序设计语言,下面不属于对象的三要素的是()o A. 变量;o B. 事件;o C. 属性;o D. 方法;正确答案:A∙ 4. (单选)下列属于VBScript数据类型的是()o A. Varchar;o B. Char;o C. Number;o D. Variant;正确答案:D∙ 5. (单选)QTP默认使用_____语言编写程序来加强代码的功能()o A. Java语言;o B. C语言;o C. VBScript脚本语言;o D. 以上均可;正确答案:C∙ 6. (单选)下列哪个语句可以为变量 str 赋值为字符串“abc123”()o A. Str=”abc” + “123”;o B. Str=”abc” + 123;o C. Str=”abc” * 123;o D. Str=”abc” * ”123”;正确答案:A∙7. (单选)QTP创建测试代码时,什么情况下需要添加Synchronization Point()o A. 为了检查测试的实际结果与预期结果是否一致;o B. 为了使Test运行的速度慢些;o C. 为了自定义验证内容;o D. 一条语句的输入是前一条语句的输出,为了等待前一条语句执行完毕;正确答案:D∙8. (单选)以下哪种检查点一般用于做界面UI的检查()o A. 标准检查点o B. 位图检查点o C. 文本检查点o D. 文本区域检查点正确答案:B∙9. (单选)下列VBS代码中,变量counter的值是() Dim counter, myNum counter = 0 myNum = 9 Do myNum = myNum + 1 counter = counter + 1 Loop Until myNum > 10 MsgBox "循环重复了" & counter & "次。
QTP经典面试题
介绍几个qtp常用函数1.对于DataTable:a.指定取哪行;DataTable.GetSheet(“Action Sheet”).SetCurrentRow rowb.指定取那列;DataTable(“cloum Name”,”Action Sheet”)2.调用Action功能RunAction ActionName, [IterationMode, iterationRang,Parameter]a. IterationMode是可选的,表示运行模式,如果是0,表示运行一次,如果为1,需要与第三个参数关联起来用,共同决定运行几次;b. iterationRang是可选的,如果第二个参数IterationMode为1,这个参数必选。
有两种方式,第一,指定循环区间,如“1-7”,表示循环7次,参数去DataTable中1-7行的记录数,第二种,rngAll表示调用DataTable中所有参数;c. Parameter是可选,表示Action之间参数的传递;qtp之excel操作函数都有哪些?******************************************************‘Function:读Excel中的某个值‘Input parameter:‘strFilePath:保存Excel的文件路径‘strExcelSheetName:要读取的Excel中Sheet的名称‘intRow:读取哪一行的数据‘intCol:读取哪一列的数据‘For example:”E:\a.xls”,”Sheet1″,2,3‘Return:取到的值‘******************************************************function getOneValue(strFilePath,strSheetName,intRow,intCol)‘定义变量Dim ExcelApp,ExcelBook,ExcelSheet‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘获取excel中值, 并返回getOneValue = ExcelSheet.Cells(intRow,intCol)‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetend function‘******************************************************‘Sub:给excel中写入一条数据‘Input parameter:‘strExcelShee tName:要写入的Excel中Sheet的名称‘intRow:往哪一行的写数据‘intCol:往哪一列的写数据‘strValue:写入的值‘For example:”E:\a.xls”,”Sheet1″,2,3,”111″‘Return:‘******************************************************sub setOneValue(strFilePath,strSheetName,intRow,intCol,strValue) ‘定义变量Dim ExcelApp,ExcelBook,ExcelSheet‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘设置值ExcelSheet.cells(intRow,intCol).value =strValue‘写入完成后,保存EXCELExcelApp.DisplayAlerts=FalseExcelApp.Save‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetend sub‘******************************************************‘Function:读Excel中某一列的值‘Input parameter:‘strFilePath:保存Excel的文件路径‘strExcelSheetName:要读取的Excel中Sheet的名称‘intCol:读取哪一个列的数据‘For example:”E:\a.xls”,”Sheet1″,2‘Return:取到的值‘******************************************************function getColValues(strFilePath,strSheetName,intCol)‘定义变量Dim ExcelApp,ExcelBook,ExcelSheet,intRowscount,arrValues()‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘得到excel中共有几行intRowscount =edRange.Rows.Count‘获取excel中值Redim Preserve arrValues (intRowscount-1)For i=1 to intRowscountarrValues(i-1) = ExcelSheet.Cells(i,intCol)Next‘返回值getColValues=arrValues‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetend Function‘******************************************************‘Sub:写入Excel中某一列的值‘Input parameter:‘strFilePath:保存Excel的文件路径‘strExcelSheetName:要写入Sheet的名称‘intCol:写入哪一个列的数据‘intFromrow:从哪里行开始写‘arrValue:写入值(数组)‘For example:”E:\a.xls”,”Sheet1″,2,2,arrRes‘Retu rn:‘******************************************************Sub setColValues(strFilePath,strSheetName,intCol,intFromRow,arrValue) ‘定义变量Dim ExcelApp,ExcelBook,ExcelSheet,intRowscountDim intArrColumnsCount,intColumnsCount‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet E xcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘ExcelSheet.activate‘得到数组的大小intArrColumnsCount=UBound(arrValue)‘最后写到哪一行intRowCount=intFromRow+intArrColumnsCount‘设置值For i=intFromRow To intRowCountExcelSheet.cells(i,intCol).value =arrValue(i-intFromRow)Next‘写入完成后,保存EXCELExcelApp.DisplayAlerts=FalseExcelApp.Save‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetEnd Sub‘******************************************************‘Function:读Excel中某一行的值‘Input parameter:‘strFilePath:保存Excel的文件路径‘strExcelSheetName:要读取的Excel中Sheet的名称‘intRow:读取哪一行的数据‘For example:”E:\a.xls”,”Sheet1″,1‘Return:取到的值‘****************************************************** function getRowValues(strFilePath,strSheetName,intRow)‘定义变量Dim ExcelApp,ExcelBook,ExcelSheet,intColumnsCount,arrValues()‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘得到excel中共有几列intColumnsCount =edRange.Columns.count‘获取excel中值Redim Preserve arrValues(intColumnsCount -1)For i=1 to intColumnsCountarrValues(i-1) = ExcelSheet.Cells(intRow,i)Next‘返回值getRowValues=arrValues‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetend Function‘******************************************************‘Sub:写入Excel中某一行的值‘Input parameter:‘strFilePath:保存Excel的文件路径‘strExcelSheetName:要写入Sheet的名称‘i ntRow:写入哪一个行的数据‘intFromCol:从哪里列开始写‘arrValue:写入值(数组)‘For example:”E:\a.xls”,”Sheet1″,5,2‘Return:‘******************************************************Sub setRowValues(strFilePath,strSheetName,intRow,intFromCol,arrValue) ‘定义变量Dim ExcelApp,ExcelBook,ExcelSheet,intColcountDim intArrColumnsCount,intColumnsCount‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘得到数组的大小intArrColumnsCount=UBound(arrValue)‘最后写到哪一列intColcount=intFromCol+intArrColumnsCount‘设置值For i=intFromCol To intColcountExcelSheet.cells(intRow,i).value =arrValue(i-intFromCol)Next‘写入完成后,保存EXCELExcelApp.DisplayAlerts=FalseExcelApp.Save‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetEnd Sub‘******************************************************‘Function:读Excel中所有的值‘Input parameter:‘strFilePath:保存Excel的文件路径‘strExcelSheetName:要读取的Excel中Sheet的名称‘For example:”E:\a.xls”,”Sheet1″‘Return:取到的值‘******************************************************function getAllValues(strFilePath,strSheetName)‘定义变量DimExcelApp,ExcelBook,ExcelSheet,intRowscount,intColumnsCount,arrGetCell Value()‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘得到excel中共有几列intRowscount =edRange.Rows.Count intColumnsCount =edRange.Columns.count‘获取excel中值Redim Preserve arrGetCellValue (intRowscount-1,intColumnsCount-1) For i=1 To intRowscountFor j=1 to intColumnsCountarrGetCellValue(i-1,j-1) = ExcelSheet.Cells(i,j)NextNext‘返回值getAllValues=arrGetCellValue‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetend Function‘******************************************************‘Function:读取某值第一次出现的行号‘Input parameter:‘strFilePath:Excel文件保存的路径‘strSheetName:要读取的Excel中Sheet的名称‘Value:第一次出现的值‘For example:”E:\a.xls”,”Sheet1″,”root”‘Return:行号‘****************************************************** Function getRowByValue(strFilePath,strSheetName,Value) ‘定义变量Dim ExcelApp,ExcelBook,ExcelSheetDim rowcount,colcount‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘取得EXCEL表共有几行、几列rowcount =edRange.Rows.Count colcount=edRange.Columns.Count‘从行开始循环For i=1 To rowcountFor j=1 To colcount‘判断是否找到需要的值If ExcelSheet.cells(i,j)= Value Then‘返回值getRowByValue=i‘如果找到了此值,退出循环Exit forEnd IfNext‘如果找到了此值,退出循环If getRowByValue <>“” ThenExit ForEnd IfNext‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetEnd Function‘******************************************************‘Function:读取某值第一次出现的列号‘Input parameter:‘strFilePath:Excel文件保存的路径‘strSheetName:要读取的Excel中Sheet的名称‘Value:第一次出现的值‘For example:”E:\a.xls”,”Sheet1″,”root”‘Return:行号‘****************************************************** Function getColByValue(strFilePath,strSheetName,Value) ‘定义变量Dim ExcelApp,ExcelBook,ExcelSheetDim rowcount,colcount‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘取得EXCEL表共有几行、几列rowcount =edRange.Rows.Count colcount=edRange.Columns.Count‘从行开始循环For i=1 To rowcountFor j=1 To colcount‘判断是否找到需要的值If ExcelSheet.cells(i,j)= Value Then‘返回值getColByValue=j‘如果找到了此值,退出循环Exit forEnd IfNext‘如果找到了此值,退出循环If getColByValue <>“” ThenExit ForEnd IfNext‘关闭ExcelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetEnd Function‘******************************************************‘Function:初始化数据,获取测试数据‘Input parameter:‘strFilePath: 测试数据Excel的文件路径‘strSheetName:要读取的Excel中Sheet的名称‘colNumber:标示符所在列‘flag:是否执行的标示符‘parmNumbers:测试参数的个数‘For example:”D:\test.xls”,”login”,1,”x”,4‘Return:测试数据(二维数组)‘第一列为每条测试数据在excel中的行号,以便于结果的写回‘******************************************************FunctiongetTestdata( strFilePath,strSheetName,colNumber,flag,parmNumbers)‘定义变量Dim ExcelApp,ExcelBook,ExcelSheet,rowcount,colcount,array(),arra(),k‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet Ex celApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘取得EXCEL表共有几行、几列rowcount=edRange.Rows.Countcolcount=edRange.Columns.Count‘确定哪些行的数据需要执行,存在一维数组中m=0For i=1 To rowcountIf ExcelSheet.cells(i,colNumber)= flag ThenReDim PreServe arra(m)arra(m)=im=m+1End IfNext‘重定义二纬数组,第一列存放每条测试数据行号,及测试数据的参数ReDim PreServe array(m-1,parmNumbers)For i=0 To m-1array(i,0)=arra(i)For j=1 To parmNumbersarray(i,j)=ExcelSheet.cells(arra(i),j+colNumber)NextNext‘返回值getTestdata=array‘关闭EcxelcloseExcelSheet ExcelBook,ExcelApp,ExcelSheetEnd Function‘******************************************************‘Sub:根据过滤的测试数据写入结果‘Input parameter:‘strFilePath: 测试数据Excel的文件路径‘strSheetName:要读取的Excel中Sheet的名称‘arrData: 存放测试数据的数组‘strColName: 结果的列名‘arrResult: 存放测试结果的数组‘Forexample:”D:\1.xls”,”sheet1″,arrData,”actualResult”,arrResult ‘Return:‘******************************************************SubsetResultByArrdata(strFilePath,strSheetName,arrData,resultColname,arr Result)Dim ExcelApp,ExcelBook,ExcelSheet,notNullNumber,intCol‘创建EXCEL程序,打开工作簿,设置当前活动sheetSet ExcelApp = CreateObject(“Excel.Application”)Set ExcelBook = ExcelApp.WorkBooks.Open(strFilePath)Set ExcelSheet = ExcelBook.WorkSheets(strSheetName)‘取得EXCEL表共有几行、几列rowcount =edRange.Rows.Countcolcount=edRange.Columns.CountintCol =getColByValue(strFilePath,strSheetName,resultColname)‘统计结果所在的列有多少行不为空notNullNumber=0For i=1 To rowcountIf ExcelSheet.cells(i,intCol)<>“” ThennotNullNumber=notNullNumber+1End IfNextIf notNullNumber=1 ThenFor i=0 To UBound(arrResult)ExcelSheet.cells(arrData(i,0),intCol).value = arrResult(i)NextElseFor i=0 To UBound(arrResult)ExcelSheet.cells(arrData(i,0),colcount+1).value = arrResult(i) NextEnd IfExcelApp.DisplayAlerts = falseExcelApp.SavecloseExcelSheet ExcelBook,ExcelApp,ExcelSheetEnd Sub‘******************************************************‘Sub:关闭Excel‘Input parameter:‘ExcelBook:打开的Excel‘ExcelApp:创建的Excel对象‘ExcelSheet:当前活动的表单‘For example:ExcelBook,ExcelApp,ExcelSheet‘Return:‘******************************************************Sub closeExcelSheet(ExcelBook,ExcelApp,ExcelSheet)ExcelBook.CloseExcelApp.QuitSet ExcelApp = NothingSet ExcelBook = NothingSet ExcelSheet = NothingEnd Subqtp对象库的建立及调用Set brows=description.Create()Set pages=description.Create()Set newobj=description.Create()OpenURL “” ‘调用方法,打开IE,并进入百度首页getobjs(22) ‘调用getobjs方法,设置对象newobjnewobj.set “bbbb” ‘操作对象,输入框中输入 bbbbgetobjs(11) ‘调用getobjs方法,设置对象newobjnewobj.click ‘点击webbutton进行查询。
QTP面试题目
1.1 QTP自动化测试的基本过程使用QTP进行自动化测试的基本过程与使用其他自动化测试工具进行自动化功能测试的过程基本是一致的,一般包括以下5个步骤:(1)录制测试脚本.利用QTP先进的对象识别、鼠标和键盘监控机制来录制测试脚本,测试人员只需要模拟用户的操作,像执行手工测试的测试步骤一样操作被测试应用程序的界面即可.(2)编辑测试脚本.主要包括调整测试步骤、编辑测试逻辑、插入检查点(CheckPoint)、添加测试输出信息、添加注释等.(3)调试测试脚本.利用“Check Syntax”功能检查测试脚本的语法错误,利用QTP脚本编辑界面的调试功能检查测试脚本逻辑的正确性.(4)运行测试脚本.可运行单个“Action”,也可批量运行测试脚本.(5)分析测试结果.使用QTP的测试结果查看工具查看测试结果,检查测试运行过程的正确性.2:你怎么用QTP我们一般用QTP的录制功能来识别对象(会将对象的属性添加到对象库),在专家视图用VBS 根据测试需要加强脚本功能和实现测试结果的输出,(当无法正常识别对象或运行中对象属性有变化是由描述性编程定义对象或在对象库中添加对象到本地对象)3:录制的方式有三种:标准模式:能识别对象的属性和方法模拟模式:主要关注于鼠标移动和键盘的操作(类似于按键精灵的作用)低级模式:所有windows对象被识别为winobject,4:QTP对象识别机制QTP里的对象有两个概念,一个是Test Object(简称TO),一个是Runtime Object(简称RO)TO就是仓库文件里定义的仓库对象,RO是被测试软件的实际对象QTP识别对象,一般是要求先在对象仓库文件里定义仓库对象,里面存有对象的特征属性的值.然后在运行的时候,QTP会根据脚本里的对象名字,对象仓库里找到对应的仓库对象,接着根据仓库对象的特征属性描述,在被测试软件里搜索相匹配的实际对象,最后就可以对实际对象进行操作了5:什么是参数化将一个固定值用变值用代替,主要有三种数据来源:数据表,环境变量,随机数当然我们在专家视图中用变量实现6:检查点实际上是指对对象的属性进行校验分为:标准检查点网页检查点图片检查点图像检查点文本检查点数据库检查XML检查点(Extensive Makeup Language)—可扩展标示语言7:正则表达式(用于匹配,常用test方法)'定义一个正则表达式[RegularExpressions]对象用于匹配,常用test方法Set myReg= New RegExpmyReg.Pattern ="/\d*"myReg.IgnoreCase = True'运用'如果str中是/加数字则返回truestr="/2343424"msgbox myReg.test(str)'如果str中是/加数字则返回true8:定义描述性对象Set oDesc = Description.Create()oDesc("micclass").Value = "Link"此句是定义了一种link对象set all_link=Browser("Browser").Page("Page").Frame("Frame").ChildObjects(oDesc)这样得到一个link对象的集合中,再利用.count属性遍历每个元素,得到每个link的URL 地址For i=0 to all_link.count -1str=all_link(i).GetROProperty("url")Next9:一个对话框高度或宽度或者两者都改变,运行时对象还能不能识别?一般能识别,因为我们运行时,QT P只利用了几个重要属性(text,nativeclass)去寻求对象,所以不会去匹配高度和宽度,但当我们修改对象库,将对象的高度或宽度添加进去,且为一个定值时(因为也可以用正则表达式匹配数字),运行时就不能识别对象了实例验证10:场景恢复11:库函数(什么是函数,就是一段代码,我们取一个名字)1:先写好一个库函数文件,保存2:其它测试中要使用这些函数时,点击setting-->resoures-->添加,选择保存的库文件11:共享对象库12:QTP---功能测试LR----性能测试。
QTP必考题
QTP必考题第一章重点1.自动化测试的定义:自动化测试是借助于测试工具、测试规范,从局部或全部代替人工进行测试及提高测试效率的过程。
2.特征:(1)自动测试过程就是通过模拟人工操作,完成对被测试系统的输入,并且对输出进行检验的过程;(2)自动测试是由软件代替人工操作,对被测系统的GUI发出指令,模拟操作,完成自动测试过程。
3.自动化测试过程:自动化测试过程就是一个软件开发过程,需要经历各类分析、测试计划、框架及测试用例设计、脚本开发、测试执行、提交报告、脚本维护、版本控制等一系列过程。
4.QTP操作步骤:录制脚本-->编辑脚本-->调试脚本-->运行脚本-->分析测试脚本5.自动测试适用的场合:回归测试、更多更频繁的测试、手工测试无法实现的工作、重复性很强的操作、跨平台产品的测试。
6.手工测试:手工测试比自动测试发现的缺陷更多、对测试质量的依赖性极大、测试自动化可能会制约软件开发、工具本身并不具有想象力、人工测试比测试工具优越可以处理意外事件。
7.自动化测试工具的分类:功能测试工具、性能测试工具、测试管理工具、其他测试工具。
8.QTP的安装插件:默认提供Web,ActiveX和VB 。
(QTP及其插件安装仅支持英文路径。
)9.QTP工作原理:QTP-->录制-->QTP记录-->回放-->对比-->结果。
10.3种录制模式(1)正常录制模式:QTP默认的录制模式,直接对对象的操作;(2)模拟录制模式:录制了所有键盘和鼠标的精确操作;优点:录制正常录制模式不能录制到的动作;缺点:录制脚本比较大,不可以由QTP编辑;(3)低级录制模式:录制QTP不能识别的环境或对象;优点:记录坐标的位置,可以对QTP不支持的对象进行坐标记录。
11.QTP回放机制回放机制是封装对象与真实对象的匹配;QTP根据脚本中记录下来的对象操作的顺序进行回放。
12.QTP的两种视图Keyword View(关键字视图)、Expert View(专家视图)13.对象库定义:QuickT est测试对象库是类或对象属性的集合,QuickTest用对象库中对象的属性来标示应用程序中的对象。
软件开发中的软件测试自动化工具考核试卷
B. TestComplete
C. JMeter
D. LoadRunner
12.在自动化测试中,以下哪个概念表示对软件整体功能的测试?()
A.单元测试
B.集成测试
C.系统测试
D.回归测试
13.以下哪个工具主要用于API自动化测试?()
A. Postman
B. JMeter
C. Robot Framework
A. Cucumber
B. JBehave
C. TestNG
D. JUnit
13.以下哪些工具可以集成到持续集成/持续部署(CI/CD)流程中?()
A. Jenkins
B. Git
C. Maven
D. Docker
14.以下哪些工具提供了丰富的测试报告功能?()
A. TestNG
B. JUnit
C. Selenium
3. BDD是一种以行为为中心的开发方法,强调业务价值和然语言描述,开发团队参与更多。
4.选择因素:项目需求、测试类型、团队技能、工具成本和维护性。例:对于Web应用,可能选择Selenium;对于移动应用,可能选择Appium。
A. Selenium
B. TestComplete
C. QTP
D. Appium
17.在自动化测试中,以下哪个工具主要用于持续集成?(")
A. Jenkins
B. Git
C. Maven
D. Docker
18.以下哪个工具主要用于iOS移动应用自动化测试?()
A. Selenium
B. Appium
A. Selenium
B. Appium
C. JMeter
Qtp实验
实验四QTP功能自动化测试一、QTP实验环境配置1)C:\下QTPDVD文件夹下装有QTP安装程序的压缩文件和mgn-mqt82.rar。
2)将QTP安装程序的压缩文件解压后在DVD文件夹的最外层有一个可执行的自动安装文件,运行它按照安装提示一步步安装QTP直至安装注册码信息。
3)选择单机版进行注册直至输入注册码。
(注册码获取见第四步)4)首先在C:\Program Files\Common Files\Mercury Interactive下创建License Manager文件夹。
将mgn-mqt82.rar解压后获得的mgn-mqt82.exe复制到C:\Program Files\HP\QuickTest Professional\bin下,双击运行。
运行后在LicenseManager文件夹下生成lservrc文件,用记事本打开后第一个#号前的字符就是注册码。
5)将第四步的注册码输入,完成安装。
二、QTP测试流程示例1)QTP认识QuickTest Professional:是一款功能测试自动化工具,主要应用在回归测试中。
QuickTest 针对的是GUI应用程序,包括传统的Windows应用程序,以及现在越来越流行的Web应用。
它可以覆盖绝大多数的软件开发技术,简单高效,并具备测试用例可重用的特点。
QTP界面元素如图3-1所示。
图3-1 QTP主要界面元素2)QTP测试流程QTP测试流程主要分为5个步骤:[制定测试计划]—>[创建测试脚本]—>[增强测试脚本功能]—>[运行测试]—>[分析测试结果] 。
(1)测试计划自动测试的测试计划是根据被测项目的具体需求,以及所使用的测试工具而制定的,用于指导测试全过程。
QTP是一个功能测试工具,主要帮助测试人员完成软件的功能测试,与其他测试工具一样,QTP不能完全取代测试人员的手工操作,但是在某个功能点上,使用QTP的确能够帮助测试人员做很多工作。
QTP 25个面试题 含答案
QTP Interview subject1. 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 Test’s 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,, 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 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 repositories. You can choose which type of object repository you want to use as the default type for new tests, and you can change the default as necessary for each new test. The object repository per-action mode is the default setting. In this mode, Quick Test automatically creates an object repository file for each action in your test so that you can create and run tests without creating, choosing, or modifying object repository files. However, if you do modify values in an action object repository, your changes do not have any effect on other actions. Therefore, if the same test object exists in more than one action and you modify an object.s property values in one action, you may need to make the same change in every action (and any test) containing the object.14. Explain the check points in QTP–A checkpoint verifies that expected information is displayed in an Application while the test is running. You can add eight types of checkpoints to your test for standard web objects using QTP. A page checkpoint checks the characteristics of an Application. A text checkpoint checks that a text string is displayed in the appropriate place on an Application. An object checkpoint (Standard) checks the values of an object on an Application. An image checkpoint checks the values of an image on an Application. A table checkpoint checks information within a table on a Application. An Accessibilityy checkpoint checks the web page for Section 508 compliance. An XML checkpoint checks the contents of individual XML data files or XML documents that are part of your Web application. A database checkpoint checks the contents of databases accessed by your web site.15. In how many ways we can add check points to an application using QTP?–We can add checkpoints while recording the application or we can add after recording is completed using Active screen (Note : To perform the second one The Active screen must be enabled while recording).16. How does QTP identify objects in the application?–QTP identifies the object in the application by Logical Name and Class.17. What is Parameterizing Tests?–When you test your application, you may want to check how it performs the same operations with multiple sets of data. For example, suppose you want to check how your application responds to ten separate sets of data. You could record ten separate tests, each with its own set of data. Alternatively, you can create a parameterized test that runs ten times: each time the test runs, it uses a different set of data.18. What is test object model in QTP?–The test object model is a large set of object types or classes that Quick Test uses to represent the objects in your application. Each test object class has a list of properties that can uniquely identify objects of that class and a set of relevant methods that Quick Test can record for it. A test object is an object that Quick Test creates in the test or component to represent the actual object in your application. Quick Test stores information about the object that will help it identify and check the object duringthe run session.19. What is Object Spy in QTP?–Using the Object Spy, you can view the properties of any object in an open application. You use the Object Spy pointer to point to an object. The Object Spy displays the selected object.s hierarchy tree and its properties and values in the Properties tab of the Object Spy dialog box.20. What is the Diff between Image check-point and Bit map Check point? –Image checkpoints enable you to check the properties of a Web image. You can check an area of a Web page or application as a bitmap. While creating a test or component, you specify the area you want to check by selecting an object. You can check an entire object or any area within an object. Quick Test captures the specified object as a bitmap, and inserts a checkpoint in the test or component. You can also choose to save only the selected area of the object with your test or component in order to save disk Space. For example, suppose you have a Web site that can display a map of a city the user specifies. The map has control keys for zooming. You can record the new map that is displayed after one click on the control key that zooms in the map. Using the bitmap checkpoint, you can check that the map zooms in correctly. You can create bitmap checkpoints for all supported testing environments (as long as the appropriate add-ins are loaded). Note: The results of bitmap checkpoints may be affected by factors such as operating system, screen resolution, and color settings.21. How many ways we can parameterize data in QTP?–There are four types of parameters: Test, action or component parameters enable you to use values passed from your test or component, or values from other actions in your test. Data Table parameters enable you to create a data-driven test (or action) that runs several times using the data you supply. In each repetition, or iteration, Quick Test uses a different value from the Data Table. Environment variable parameters enable you to use variable values from other sources during the run session. These may be values you supply, or values that Quick Test generates for you based on conditions and options you choose. Random number parameters enable you to insert random numbers as values in your test or component. For example, to check how your application handles small and large ticket orders, you can have Quick Test generate a random number and insert it in a number of tickets edit field.22. How do you do batch testing in WR & is it possible to do it in QTP, if so explain?–Batch Testing in WR is nothing but running the whole test set by selecting Run Test set from the Execution Grid. The same is possible with QTP also. If our test cases are automated then by selecting Run Test set all the test scripts can be executed. In this process the Scripts get executed one by one by keeping all the remaining scripts in Waiting mode.23. If you are given a test to execute some thousand tests in 2 days, what do you do?–Adhoc testing is done. It covers basic functionality to verify that the system is working fine.24. What is Object Spy in QTP?–Using the Object Spy, you can view the properties of any object in an open application. You use the Object Spy pointer to point to an object. The Object Spy displays the selected object.s hierarchy tree and its properties and values in the Properties tab of the Object Spy dialog box.25. What is the file extension of the code files & object repository files in QTP?–Code file extension is .vbs and object repository is .tsr26. Explain the concept of object repository & how QTP recognizes objects–Object Repository: displays a tree of all objects in the current component or in the current action or entire test (depending on the object repository mode you selected). We can view or modify the test object description of any test object in the repository or to add new objects to the repository. Quicktest learns the default property values and determines in which test object class it fits. If it is not enough it adds assistive properties, one by one to the description until it has compiled the unique description. If no assistive properties are available, then it adds a special Ordinal identifier such as objects location on the page or in the sourcecode.27. Give me an example where you have used a COM interface in your QTP project?–com interface appears in the scenario of front end and back end. for eg:if you r using oracle as back end and front end as VB or any language then for better compatibility we will go for an interface. of which COM will be one among those interfaces. Create object creates handle to the instance of the specified object so that we program can use the methods on the specified object. It is used for implementing Automation(as defined by Microsoft).28. Explain in brief about the QTP Automation Object Model.–Essentially all configuration and run functionality provided via the Quick Test interface is in some way represented in the Quick Test automation object model via objects, methods, and properties. Although a one-on-one comparison cannot always be made, most dialog boxes in Quick Test have a corresponding automation object, most options in dialog boxes can be set and/or retrieved using the corresponding object property, and most menu commands and other operations have corresponding automation methods. You can use the objects, methods, and properties exposed by the Quick Test automation object model, along with standard programming elements such as loops and conditional statements to design your program.。
QTP部分模拟笔试题
Quick Test Professional模拟笔试题一、简答题:1、QTP有哪几种录制模式?答案:正常录制模式、模拟录制模式(Analog Recording)和低级录制模式(Low Level Recording)。
2、LoadRunner和QTP的工作原理有何不同?答案:●LR: 基于协议的性能测试;QTP: 基于UI对象的功能测试。
●LR录制原理:捕获数据包。
录制的前提是能识别协议报文;QTP 录制原理:消息机制,截获消息。
录制的前提是能识别控件。
●LR是性能测试工具,侧重的是压力,负载,容量,并发等测试;QTP是功能测试工具,针对功能的测试。
●录制的协议不同。
QTP是基于GUI的功能测试.QTP的录制和回放都是真实的操作客户端程序的各种GUI控件,回放的时候会真实启动客户端程序. 而LR只是录制了客户端和服务器之间的通信数据,回放自然也是这些通信的数据,而且只有在录制的时候跟客户端程序有关系,回放的时候就跟客户端没有任何关系了,不会启动客户端程序.就无法对客户端界面控件进行验证,失去GUI测试功能。
●比如,注册一个论坛,QTP在回放脚本的时候会输入每个基本信息的动作,然后发送这个表单到服务器,而LR录制的是通信协议,就不会回放输入每个基本信息的动作了,而是直接把已经保存的表单信息直接打包发送到服务器。
[附:LoadRunner和QTP的工作原理]QTP里的对象有两个概念,一个是Test Object(简称TO),一个是Runtime Object(简称RO)。
TO就是是仓库文件里定义的仓库对象,RO是被测试软件的实际对象。
QTP识别对象,一般是要求先在对象仓库文件里定义仓库对象,里面存有实际对象的特征属性的值。
然后在运行的时候,QTP会根据脚本里的对象名字,在对象仓库里找到对应的仓库对象,接着根据仓库对象的特征属性描述,在被测试软件里搜索找到相匹配的实际对象,最后就可以对实际对象进行操作了。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
自动化测试考核
一、多项选择题(共30分,每题5分)
1.QTP的对象库的原理顺序(ACE)
A.封装被测对象到对象库
B.录制对象为脚本,对象库存在对象
C.运行QTP脚本时,会启用对象库里对象属性和运行中的被测属性进行对比
D.脚本的描述与对象匹配
E.对比成功之后找到需要运行的对象
2.下面关于描述对象库正确的是()
A.QTP封装的一层接口属性,控件自身并没有此属性
B.对象库能够识别对象是依赖于BHO机制的
C.对象库简称是ORP,能够识别任何一种对象(对象库简称OR,object Repository)
D.对象库里面的对象可以进行添加、复制、剪切、高亮灯操作
E.可轻易的修改对象库中对象的描述属性,并能够更好的管理对象。
F.对象库录制好的对象,另存为后的文件格式是.txr(后缀名是.trs)
3.录制的3种模式分别是(BDF)
A.高级录制模式
B.低级录制模式
C.捕捉录制模式
D.模拟录制模式
E.动作录制模式
F.正常录制模式
4.Flie->Setting->Run,进入Run设置页面,在When eror occurs during run session(当在运行期间发生错误时)提供了多少个处理选择(A E F G)
A.pop up message box
B.Proceed to run step action
C.Stop ation
D.Proceed to next action iteration
E.Stop run
F.Proceed next action iteration
G.Proceed to next step
5.以下的选项为正确的是(ACDEF)
A.QTP的两种运行模式包括:快速运行模式和正常运行模式
B.当QTP正在回放时,使用快捷键Ctrl+Alt+F5能够退出回放(Ctrl+Alt+F5是
停止运行的快捷键)
C.回放类型包括事件模拟类型和鼠标模拟类型
D.进入QTP使用快捷键Ctrl+R就能直接打开对象库
E.回放机制:封转对象与虚拟对象的匹配
F.公共对象库能够对比、合并、拆分对象
6.以下的选项为错误的是(BDF)
A.Setting.WebPackage("ReplayType")=2,这个代码是把回放模式改成鼠标模
拟模式
B.在进行录制的时候应该关闭不需要的浏览器
C.开启模拟录制模式前的必要条件是开启正常录制模式
D.QC调用的方式执行脚本,运行模式是Normal(应该是fast模式)
E.在Normal运行模式中上设置间隔事件,单位是毫秒
F.脚本运行时,左侧有黄色箭头,则代表这种运行模式是Fast(有黄色箭头的是
Normal模式)
二、解答题(共20分,每题10分)
a.根据以下素材编写自动化测试用例,素材如下:
1)系统名称《自动化测试用例设计系统》,B/S架构;
2)整个登录功能的验证只涉及2个页面《登录页面》、《内容页面》
3)“登录页面”具备4个控件[用户名输入]、[密码输入]、[登录]、[重置];
4)“内容页面”中存在文字<欢迎回来,xx>,具备1个控件[退出系统];
5)该系统是不用手工清除IE缓存,不点击[退出系统],直接关闭网页,下次访
问无须重新登录,直接以已登录状态访问<内容页面>,非常方便;
6)在“素材4”中,内容页面里的文字专门用作检查登录系统是否成功;
步骤序列业务操作描述预期结果测试所用
数据
1 进入“自动化测试用例
设计系统”登录页面。
进入<登录页面>(校验URL)
2 输入[用户名] 、[密
码],点击[登录] 进入<内容页面>,该页
面存在文字<欢迎回
来,xx>和[退出系统]
控件(检查是否登录系
统成功)
Admin
888888
3 输入[用户名] 、[密
码],点击[重置]
清空[用户名]、[密码]
4 在<内容页面>直接关闭
网页下次访问无须重新登录,直接以已登录状态访问<内容页面>
5 点击<内容页面>的[退
出系统] 下次访问须重新登录才能访问<内容页面>
b.把关键字视图的步骤转换成专家视图的代码形式:
转换的代码请在这里填写:
SystemUtil.Run ""
Browser("Welcome:MercuryTours").Page("Welcome:MercuryTours").WebEdit("userName" ).Set "admin"
Browser("Welcome:MercuryTours").Page("Welcome:MercuryTours").WebEdit("password" ).SetSecure "4f32924459b8a1b5a7fbf3c8bc1cdd68 "
Browser("Welcome:MercuryTours").Page("Welcome:MercuryTours").Image("Sign-In").C lick 22,14
Browser("Welcome:MercuryTours").Page("Finda Flight: Mercury").Link("Home").Click Browser("Welcome:MercuryTours").Page("Welcome:MercuryTours_2").Link("SIGN-OFF") .Click
Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").Sync
Browser("Welcome: Mercury Tours").Close
三、操作题(共50分)
题号知识点考题得分
1 对象库、
验证点
使用对象库,在订票系统登录后,在订票页面插入验证
“Flight Details”是否存在。
(10分)
2 对象库、
参数化
使用对象库,录制登录页面在登录做两个账号的手工参
数化。
(10分)
3 对象库、
FireEve
nt
使用对象库,在百度系统页面,在登录按钮点击右键。
(15分)
4 对象库、
公共对
象库
使用对象库,录制“百度”页面的搜索框并另存为
Eidt.tsr为一个.tsr文件,再录制"百度"按钮并另存
为Button.tsr为一个文件,使用公共对象库将两个对
象合并,生成新脚本另存为Merge.tsr.(15分)
注意:操作题4小题(每道小题完成后另存为一个文件,文件命名格式例如:操作题1;本卷和这四道题完成后放在一个文件夹进行压缩,该压缩文件名例如:QTP自动化测试考核题目_陈威洋_2012.3.22)。