new microsoft office word document

85
Re: I have 2 Environment variable which holds int. I called into my test and addedup. but output is concatenating the values instead of Sum. Ex. Envi("a")= 10, Envi("b") = 20, c= Envi("a")+ Envi("b"). msgbox c ( Ans.1020). How to overcome this pblm? Environment.Value("MyVariable")=10 A=Environment.Value("MyVariable") Reporter.ReportEvent micPass, "The value of A: ", A Environment.Value("MyVariable1")=20 B=Environment.Value("MyVariable1") Reporter.ReportEvent micPass, "The value of B: ", B C=A+B msgbox C Re: In one of the scripts the pwd in the DT was encrypted. Can any one tell me how to I decrypt or undo the same? Answer There is a tool called password encoder. It gets installed when you install QTP. Go to Start -> Programs -> Quick Test Professional -> Tools -> Password Encoder. Re: I want to open a Google page without recording a test and i do not want to use system.Util.run command as well how do i do this? Answer function as a generic function. So when ever required we will call them with differnt url"s. function navbr(url) Set IE = CreateObject("InternetExplorer.Application") IE.Visible = true IE.Navigate (url) Set IE = Nothing end function or Set IE = CreateObject("InternetExplorer.Application") IE.Visible = true IE.Navigate "http://www.yahoo.com" Re: What is deference between normal QTP testing and descriptive programming? when u r writing script in QTP u should store all the objects in Object Repository. for example: Browser("XXX").Page("XXX").WebEdit("XXX").Set "XXX" here the browser, page, WebEdit objects should be stored in Object repository. then only it works, else it wil throw an error. when u store objects in OR, some of the properties of that object will store in OR to identify that object. but in descriptive programming no need to store objects in OR. it means writing and executing ur scripts without using OR. for example: Browser("Name:=XXX").Page("Title:=XXX").WebEdit("name:=XXX").Set "sss" here the properties of objects are throwed in to script. So no need to store those object OR. Or

Upload: mihirhota

Post on 23-Nov-2014

306 views

Category:

Documents


1 download

TRANSCRIPT

Re: I have 2 Environment variable which holds int. I called into my test and addedup. but output is concatenating the values instead of Sum. Ex. Envi("a")= 10, Envi("b") = 20, c= Envi("a")+ Envi("b"). msgbox c ( Ans.1020). How to overcome this pblm? Environment.Value("MyVariable")=10 A=Environment.Value("MyVariable") Reporter.ReportEvent micPass, "The value of A: ", A Environment.Value("MyVariable1")=20 B=Environment.Value("MyVariable1") Reporter.ReportEvent micPass, "The value of B: ", B C=A+B msgbox C Re: In one of the scripts the pwd in the DT was encrypted. Can any one tell me how to I decrypt or undo the same? Answer There is a tool called password encoder. It gets installed when you install QTP. Go to Start -> Programs -> Quick Test Professional -> Tools -> Password Encoder. Re: I want to open a Google page without recording a test and i do not want to use system.Util.run command as well how do i do this? Answer function as a generic function. So when ever required we will call them with differnt url"s. function navbr(url) Set IE = CreateObject("InternetExplorer.Application") IE.Visible = true IE.Navigate (url) Set IE = Nothing end function or Set IE = CreateObject("InternetExplorer.Application") IE.Visible = true IE.Navigate "http://www.yahoo.com" Re: What is deference between normal QTP testing and descriptive programming? when u r writing script in QTP u should store all the objects in Object Repository. for example: Browser("XXX").Page("XXX").WebEdit("XXX").Set "XXX" here the browser, page, WebEdit objects should be stored in Object repository. then only it works, else it wil throw an error. when u store objects in OR, some of the properties of that object will store in OR to identify that object. but in descriptive programming no need to store objects in OR. it means writing and executing ur scripts without using OR. for example: Browser("Name:=XXX").Page("Title:=XXX").WebEdit("name:=XXX").Set "sss" here the properties of objects are throwed in to script. So no need to store those object OR. Or Descriptive Programing is nothing but We define the Description about an object and create an object and we perform the action over the object. the basic syntax of the Descriptive Programming is -Create Object- Dim oDesc Set oDesc = Description.Create -Set ID properties & values oDesc("property1).Value = "value1

oDesc("property2).Value = "value2 -Use and reuse the description object VBWindow(oDesc).Type "Something" VBWindow(oDesc).Close -Release description object Set oDesc = Nothing One More syntax is for an object Button Set Obj = Brower("title:=Y").Page("html tag:=x").Button ("Name:=h") if obj.exist obj.Click else endif Here the Advantage is that : we skip the OR cocept so we save more space Remove machine dependency Increase clarity of the script In any case we can go to the Descriptive Programming provided we know the object Properties with\without Application. Mainly people will go for Desc Prog only if it is a Product where the Reusability of the script is high with minimal change in the script Re: According to use, how virtual object is different from object spy? If Qtp is not learning a sub-menues. What should we done? how would we manage on the expert view too? virtual objects are something like which look like standard windows widgets but are not actually. For example in MSPaint there are widgets like buttons like eraser, brush.. but actually they are not buttons. U can find that from objet spy. You can add virtual object by Tools -> Virtual Objet -> New Virtual Object. Re: How to get data line by line from web element Answer? 1. Get the value from that webelement using getroproperty 2. split that value using space " " as delimeter and move it to a array 3. use that array elements to get each line Re: How to send the qtp results file by email (Lotus notes). Answer? Function SendMail(SendTo, Subject, Body, Attachment) Set ol=CreateObject("Outlook.Application") Set Mail=ol.CreateItem(0) Mail.to=SendTo Mail.Subject=Subject Mail.Body=Body If (Attachment "") Then Mail.Attachments.Add(Attachment) End If Mail.Send ol.Quit Set Mail = Nothing Set ol = Nothing End Function Re: When you are running a batch test of 5 scripts and in 2nd script appln crashed, what hpns If you are executing as batch in your framework you should execute 1 function/Script before each script execution. The use of this function is If Application Home Link is Exist it will just click on home link(Continue your Next Script)Else Close all browser, Lunch Application and Login and Continue your Next Script.

Re: What is the dis advantage of check points in QTP, if any? Answer The disadvantage is: Screen resolution is very important. Sometimes these checkpoints will also check the system configuration. When you record the checkpoint, that may work in one machine and may not work in another machine and the entire script will fail. One more important thing is that we will not be able to know on what property the checkpoint holds until the execution of the script. Re: What is an other way of "Wait" statement in QTP I dont want to use wait("Some number"). Excluding Wait 2 other methods are there. 1.Browser("micclass:=Browser").page("micclass:=Page").Sync 2.Wait Property Ex:Browser("micclass:=Browser").Page("micclass:=Page").Image ("name:=Pic).WaitProperty "Property Name","Property Value",30000 It will wait till in next page That Property Match Re: What is the disadvantage of smart identification? Answer If u enable smart identification when particular object description is mismatched it will take much time to recognize that object. And for identifying which object description is mismatched we have to verify the qtp results. If disable smart identification qtp will through error in that particular statement. e: how to open Excel sheet & write in it & save it? Answer Set excel = CreateObject ("EXCEL.Application") excel.Caption = "Test Caption" excel.Visible = True Set doc = excel.Workbooks.Add() Set selection = excel.Selection With selection .Cells(1,1).Value = "Test value" End With doc.SaveAs("E:\Excel.xls") excel.Quit Re: what are the advantages of merging of object repositories in Qtp9.0 Answer 1 .Suppose you are working on 2 different modules of a project using QTP. We design scripts for each module individually or 2 different persons work on 2 modules. finally if all the modules have to be integrated, then merging object repositories is pretty much useful and definitely needed. 2. If there are duplicate objects in 2 different repositories and if we merge them, then duplication can be avoided. 3. we can transfer entire repository if both are merged, we can easily move it in to another machine if needed. Re: What is the function of Filter in QC . give with a real time example. Answer Function of Filter in QC is to retrive the data from as per your requirement. Like : 1. If you want any particular defect from 1000 logged defect list. 2. You can filter Defect entered by some person. 3. You can filter Defect Assigned to some person. 4. You can filter Status of defect. etc

Re: Suppose there are 10 browsers opened on desktop. I want to close all browsers except one browser in QTP. Can any one give the code for this? Answer Set browserDesc = Description.Create() browserDesc(application version).Value = internet explorer 6" Set Allbrowsers = DeskTop.ChildObjects(browserDesc) BrowserCnt = Allbrowsers.Count For i = 0 To (browserCnt -2) Allbrowsers(i).Close Next Set browserColl = Nothing Set browserDesc = Nothing Re: Can a function return a dictionary object? Answer Yes. Functions can return a dictonary object. Dim dicObj Set dicObj = CreateObject("Scripting.Dictionary") Set obj=getname MsgBox(obj.item("name")) Public Function getname() dicObj.add "name","Uday Kumar" Set getname=dicObj End function Re: how many scripts r there in QTP? pls any answer this question? Answer If we develop a Test Script in QTP irrespective of Actions... are called as "Test Script" it means only one Script available in one Test. until unless create new Test, any no. of Actions or Functions or procedures.... etc in one Test called Test Script. Only One Script in QTP Test. Re: Hi, How to invoke QTP or any application through Command Prompt without using Vb script and batch file. ************openqtp.vbs************ Save this in a vbscript:Set App = CreateObject("QuickTest.Application") App.Launch App.Visible=True ************** and in command prompt Run this csript openqtp.vbs **************** It is possible to invoke QTP or any Application without using VBscript by simply Run it's complete path Ex: Start -> Run -> "C:\Program Files\Mercury Interactive\QuickTest Professional\bin\QTPro.exe" Re: examples of user definied functions? how to write user defined functions in qtp9.2? see..u can write user defined function in many ways. Public Function Func_Login(strUser,strPassWord) Browser().Page().WebEdit("Name:=UserID").set strUser Browser().Page().WebEdit("Name:=Password").setSecure crypt.encrypt(strPassword) Browser().Page().WebButton("Name:=Log In").Click

End Function When ever u want to login to application u can call this function with parameter values for User and Password. Example: sUser = DataTable.Value("UserName") sPassword = DataTable.value("Password") ' Call the Login function for loggin in to application.. Func_Login sUser,sPassword Note : the function can not contain Object repository. So before calling or executing this function u have to associate Object repository to the Current Action where this function is called. And also should associate the function library file where this function is stored. Re: How to load object properties to object repository through scripting. repositoriescollection.add (path of the object repository.tsr) or This concept will be called as dynamic handling of OR.Here we can add the repositories in runtime through script.And we can remove OR at runtime. Re: What is absolute path and relative path in QTP..? How to access them and what are the differences between them. Absolute path means we have to mention full path in script. Example: executefile "E:\project name\libraries\main.vbs" Relative path means no need to give full path just mention file name Example: executefile "main.vbs" But here if you want to convert this Absolute file path as relative path. you should do following steps Tools menu-->options-->folders tab here you have to add this path example "E:\project name\libraries" then you can use direct filename as above mentioned in the relative path example instead of absolute path example. Re: How do we edit the script in QTP. Anybody can explain in detail. We can edit the scripts in expert view. editing checkpoint properties. Inserting if conditions, loops,error handling, comments, etc., Re: How do we Access, retrieve and edit the runtime objects in Automation Testing using QTP We cannot edit runtime objects in Automation Testing, bcoz Runtime objects means the Objects available in AUT, we can only use the properties available for objects and we can change the property/properties available in OR during runtime by using SETTOPROPERTY We can retrieve the property and its value by using GetRoProperty eg: dialog("Login").Activate dialog("Login").WinButton("OK").SetTOProperty "text","Cance" print dialog("Login").WinButton("OK").GetROProperty("text") it returns "Cance" it is changing the property value during runtime. Re: where the log files stored when using QTP? plz send answer to me ; After clicking on run button , we will get one screen with named as 'Run', in that if we want we can use the default location otherwise we can select any folder to save the log files.

Re: how can we call an external library file in QTP apart from using the Executefile statement..?? is there any other way we can call the external library file in QTP? Yes we can associate the library files with out using "Executefile" statement. But you should use AOM method Example: Dim qApp Dim qLibs Set qApp = CreateObject("QuickTest.Application") qApp.Launch qApp.Visible = True qApp.Open "E:\Test1", False, False ' Open a test Set qLibs = qtApp.Test.Settings.Resources.Libraries ' Get the libraries collection object qLibs.Add "C:\Utilities.vbs", 1 ' Add the library to the collection qApp.Test.Save qApp.Quit Set qLibs = Nothing Set qApp = Nothing First of all you have to create Quick Test object after that open the test with the help of Quick Test Object and also create Libraries object after that you can add ".vbs" files. Re: Can you give me the code to calculate the total number of Links using the child object in the web page..? is there any other way to calculate number of links with out using the Child objects? Set fileSysObject=createobject("Scripting.FileSystemObject") Set linksFileName=fileSysObject.opentextfile("D:\samplelinkfile.txt",2,true) Set linkDescObj=description.Create linkDescObj("micclass").value="Link" Set noOfLinks=browser("Browser").Page("Yahoo! India").ChildObjects(linkDescObj) For i=0 to noOfLinks.count-1 linkName=noOfLinks(i).getROProperty("name") linksFileName.writeline(linkName) Next linksFileName.close Set fileSysObject=nothing Here i am retrieving all the links in Yahoo home page and writing the link names in a text files. If you wish to verify the number of links a web page, you can use "Standard Checkpoint". Click on Record button ->Insert Menu -> Check point ->Standard Checkpoint -> Click on any place in the page and select the page in the Hierarchy and observe the number of links property/value. If the total numbers of links are increased or decreased, then it will show the differences. Re: When we use 'ERR' object to handle the exceptions in the script, do we need to include any statement in the beginning of the script..?? Answer Generally, when QTP encounters a run time error during running the scripts, it shows the error message in a pop up window and the script execution will stops.

If you wish to display your own error message and you wish to continue with the script, then we will use Err object.We have to use "On Error Resume Next" statement before the runtime error is returned. The general usage of the Err object is like: On Error Resume Next dim fileSysObj fileSysObj=createobject("Scripting.FileSystemObject") fileSysObj.folderexists("c:\uday") 'assume this folder doesnt exist 'QTP shows the error message here itself and stops execution, if "On Error Resume Next" statement doesnt exists If Err.Number 0 then msgbox("Here it prints") 'Because of Err object we can give our own error message end if Re: How can we change(increase or decrease)the size of a array variable with out loosing the previous values Answer Dim a(10) is array declared if we want to change the size of array it should be declared with redin as below ReDim A(10) to preserve the contents of array we need to use preserve keyword as below ReDim Preserve A(10) above line is Answer ,,,, by declaring array as above it will preserve the values Re: can a Function return more than one value..??? if so please give me the code for that. Answer Function doesn't return more than one value. if you want to get more than one result, we can write function for that. After u will get the value u have to split the value. Example: Function AddSub(a, b) som = a + b subt = a - b AddSub = som&"/"&subt End Function this function returns only one value. But it's having two results(i.e Addition and subtraction of two no.s). After u will get this value. u have to split that one for two results by using split function here delimeter is "/". like this we can add more than one result to the return variable(in this example AddSub is the return variable). Re: When there is descriptive programming, why do we go for Object repository for designing scripts.?? why cant we use descriptive programming instead of using the Object repository In descriptive programming the objects information should be available, desc. prog takes less time to execute bcz the object's information is available in the script, but it is very difficult to maintain(update).but through object repository we can easily write the script bcz the object's info is available in that OR. Or writing the script will take more time when writing in DP. maintance of the script will be difficult. if some of the object properties are changing from build to build u have to update same in script also. but if u are using Object Repository u can update those property values in Object Repository. its one time

change. or u can handle this in object repository with regular expression. like this we can say many examples. Re: What is the difference between Action and Function.? when both has the same functionality, when do we choose Action and when do we choose Function? Actions are more specific to tool Example QTP Functions are generic and part of programming language. Actions in QTP are used to divide the test into different logical units . Within actions we can write functions .but within functions we cant use actions we call functions in actions . Major Differences: Functions: Function returns only one value. it doesn't has Object repository. Actions: Actions has Object repository. It returns more than one value (i.e Output parameters). We can declare more than one Output parameter. we can call Function in any Actions in QTP test. But Action is not like that we have to mention that as reusable action in Action Properties. we can store Functions in .VBS file. but Action we cann't store like this way. Re: how can we return a value from userdefined function for eg 2 functions in func1 iam getting 2 values(a,b) and storing in var(C). now i want to pass that var(c) to another func2 give me the script Answer Function returns only one value. when we assign the final value with variable that name should be the same name of the function name. In the given example, som is the function it returns the sum of two values when we assign that value to variable[i.e same as function name(example: som = c)] if you don't assign, function doesn't return any value (example: z = c) Example: Function som(a, b) c=a+b som = c '(instead of these two step we can write in single step like som = a + b) End Function x = 10 + som(10, 20) msgbox x you can pass this value in any other function. Example: y = som(som(10, 20), x) msgbox y Re: what is the difference between Reusable action and external action? Answer Reusable Action: we can call this action in between Actions in Test and also in between Tests. we can call this action in two ways 1. Call copy of Action 2. call to Existing Action.

External Action(if it is not reusable action in test): this action we cant call in another Tests by using Call to Existing Action. But we can call this external Action to another tests by using Call to Copy Action. Re: How to load a object repository in QTP during runtime? Answer we can add object repository at runtime Two ways are there u can add 1. when u write below syntax in Action1 Syntax: RepositoriesCollection.Add(Path) Ex: RepositoriesCollection.Add(E:\OR\ObjRes.tsr) if write in Action1 it will automatically add the Object Respository to the Action1 (i.e Edit Menu-->Action-->Action Properties-->Associate Repository tab) at runtime.no need to add the object repository before running. 2. Add the object repository at runtime by using AOM(Automated Object Model) Ex: Dim qtAppn Dim qtObjRes Set qtAppn = CreateObject("QuickTest.Application") qtAppn.Launch qtAppn.Visible = True qtApp.Open "E:\Test\Test2", False, False Set qtObjRes = qtApp.Test.Actions ("Login").ObjectRepositories qtObjRes.Add "E:\OR\ObjRes.tsr", 1 The above example Add the Object Repository (ObjRes.tsr) to the "Login" action in Test2. Here also no need to add the object repository in Test2. Re: how can u find the syntax errors or other script errors in your test during the execution of your QTP Test - (i.e., not after the execution/test run finished, but before finishing the test run) Answer we can find out errors before finishing the test run by using Err Object. Example: On Error Resume Next Err.Raise 6 ' Raise an overflow error. MsgBox ("Error # " & CStr(Err.Number) & " " & Err.Description) Err.Clear ' Clear the error. Re: Suppose there are 100 links in a web page and the number of links will be changing dynamically from time to time. I need code such that every time i had to click on the last link of the web page. Answer Below code will work for your case. ' Set a description object to identify links. Set oDesc = Description.Create() oDesc("html tag").Value = "A" ' Get a collection of links

Set oLinkCollection = Browser("test").Page ("test").ChildObjects(oDesc) Set obj=oLinkCollection.Item(oLinkCollection.Count-1) obj.Click or set odesc = decription.create odesc("micclass").value = "Link" set n = browser("xxx").page("xxx").childobjects(odesc) objcount = n.count browser("xxxx").page("xxxx").link("index:="&objcount).click Re: What are the Mandatory Properties of WebTable Object and Link Object in Web testing using QTP Answer For the Web table object, the mandatory fields are: "html tag". For a link object, the mandatory fields are: "html tag" and"text". For all most of the web objects(ex: web edit, web link etc..), the mandatory field is "html tag". But we can change these properties, but make sure that QTP identifies the object in the application uniquely. Re: How do we run a test from the 3rd row of the datatable in QTP? Leaving the first two rows we need to test AUT from 3rd row to n'th row. Directly use setcurrentrow function. use the below statement for i=3 to n datatable.setcurrentrow(i) ' do some operations next The above loop starts from the 3rd row and performs your actions and continues up to 'n' iterations. Or go to file->file settings->run tab and there u can specify the rows form where to start..... Re: What is difference between Global variables and Environment variables...Anybody can give me answer.. the environment variables are two types system defined and user defined system defined are qtp displays by default in environment tab where user defined is two types Local:we r creating these are in environment tab only for that test we cant use it to other test Global: creating in notepad and saving with extension.ini what are the environments you need like user name, password, server name, database these are we can use in any test Re: how to capture the run time values of web table. Answer A web table will contains number of field with it,by using getroproperty("field name")we can retrieve values from web table. Re: What is the command used to add an object(properties) to an object repository? Answer PropertiesColl.Add PropColl(Position) Example The following example adds the first item from the OtherCollection Properties object to the MyDesc Properties object.

MyDesc.Add OtherCollection(0) Re: What is difference b/w AOM,DOM,COM Have u ever is used ny of the models.If so why? Answer AOM: Automated Object Model with this model we can create QTP object. without opening QTP, we can do open Test, add repositories, recovery scenarios, .vbs files, Datatable(excels) etc. DOM: Document Object Model this is come under HTML like that. i have n't worked on this. COM: Component Object Model with this model we can create Excel, MS-Word, OutLook objects etc.with this object we can do with out opening Excel application, we can add sheet and count the rows and columns etc. Re: Anybody can tell me what are the common roles and responsibilities of a Automation Test engineer Answer 1)Check out the feasibility of the application that needs to be automated 2) Create an automation test plan 3) 4) 5) 6) 7) 8) Create the Automation test cases Choose the correct framework that needs to be used Create the scripts Execute the scripts Analyze the results Report the issues to the concerned person

Re: Can we add the function library directly from scripting in qtp instead of adding from resource tab? Answer Set qtApp = CreateObject("QuickTest.Application") qtApp.Launch qtApp.Visible = True qtApp.Open "C:\Tests\Test1", False, False qtApp.Test.Settings.Resources.Libraries.Add "e:\Utils.vbs" Re: The interviewer asked me when u recorded one application. object repository properties are saved with .tsr extension. in qtp expert view wherever mouse is there that snapshot displayed in active screen but some recorded script lines are not displayed in actives screen It means those line are written manually or those lines are not user actions. they might be If, For, While loops & check points which we wrote manually. Re: Which function is used to accesses the Properties from Repository Pls anybody can give You can retrieve object property values using GetROProperty method at runtime. E.g: retrieves the textbox value into var_Value variable var_Value = Browser("test").Page("test").WebEdit ("test1").GetROProperty("value") Re: Function to convert lowercase to uppercase in QTP Pls anybody can give the answer.. txt="have a nice day" t1=ucase(txt) msgbox(t1) o/p: HAVE A NICE DAY Re: How to set the function parameters as optional. Pls anybody can give the answer. In function parameter you can't use optional option. But you can mark the statements inside the function as optional by putting keyword "OptionalStep" before the statement.

ex: Function login(name,passwd) OptionalStep.Brw("login").Webedit("name").set name Brw("login").Webedit("passwd").set passwd Brw("login").Webbutton("ok").click End Function Re: How to check the value for variables during run time. You can achieve this only when you debug the scripts. Put some break points in your script. By default the runtime evaluates the variable values upto that breakpoint, and from there on to know var. values use step in, step out short cut keys. Re: If a object property is changed in the application. where it should be updated in QTP? we can do in two ways first changing the property in the object repository and by using SetToProperty we can handle during runtime. and if u changed any property in object repository after writing the script, it is better to run in update mode. Re: How to send QTP scripts to our colleagues? while u send QTP scripts to ur colleagues send them along with the object repositories(SAVE THE OBJECT repository and then send them) Re: How vl i prioritize the actions when i have 10 actions A1, A2, A3......A10. I want to run action as follows A1,A5,A6 and A10. How i can do it. Thanks in Advance to u. Answer Open the test from folder, go to action folder 0, open script in note pad, change the action sequence and insert comments if you dont want to execute. Like as below. Original actions Action 1 Action 2 Action 3 Action 4 Action 5 After Modified ( Like below, we need to modify) Action 1 Action 5 Action 2 'Action 3 // I dont want to execute this action. Action 4 Features of QTP : Operates stand-alone, or integrated into Mercury Business Process Testing and Mercury Quality Center. 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 Re: How can I find out whether a word in a string is existed or not for example "QTP IS A POWERFULL TOOL FOR AUTOMATION" How can i find out whether "powerfull" is existed in

the above string or not Could anyone answer it? Answer Create a filesystem object . Read the file till the letter "P" comes . After that Read till the length of the word which you want to Check (In this case it is 9). then compare the word with the word which you want to check which should have been stored already . If the stringcompare is true means, the word exists. Please go through the following code for this example Set objFSO = CreateObject("Scripting.FileSystemObject") Set objReadFile = objFSO.OpenTextFile("FILENAME" ,1) Str="Powerfull" Str1=objReadFile.ReadAll() Set objReadFile_new = objFSO.OpenTextFile("FILENAME" ,1) For i = 1 to len(Str1) Str2=objReadFile_new.Read(i) if Str2=Left(Str,1) then Str3=ObjReadFile_new.Read(len(Str)) if Str3=Str then Msgbox "FileExist" Exit For End if Next Re: can u write Script to do Data Driven Testing throuh Externel & internel XL Sheet Answer Following are the commands you can use to add, import,export sheet to QTP. datatable.AddSheet(sheet) datatable.ExportSheet(filename, sourcesheet) datatable.ImportSheet(filename, sourcesheet, destinationsheet) Re: can u Give Procedure to Handle Pop Window & write Code for that Answer? you can use pop up recovery scenario to recover from problem assume a popup window contains yes ,no ,cancel buttons Function Name: Popup_Recover() public function Popup_Recover() if Browser("title:=*").Dialog("name:=.*").Link ("name:=Yes").Exist Then Browser("title:=*").Dialog("name:=.*").Link ("name:=Yes").Click End If End Function Re: How exactly you start scripting in QTP? In the interview he was not satisfied with my In my company, we follow the below process while writing scripts First, our Quality Leader will analyze the application and identify the scenarios for automation. These scenarios are divided among Automation Engineers for implementation. This is the point where we(automation engineers) start our automation process. First we create automation folder structure(i.e., we create separate folders for storing object repository files,scripts, test data, test results, user defined functions , recovery scenarios). After creating the folder structure, we start recognizing the objects using object repository manager and store the object repository file in the specified folder. We then attach the repository file to our test by using Resources->Associate Repositories. Now, we start writing the script for the scenarios.

We follow modular driven framework, and we also use data driven framework where ever necessary to test the application with multiple sets of data. Re: how open two urls in one browser? plz urgent Answer dim ie1, ie2 set ie1=createobject("Internet Explorer.Application") ie1.visible=true ie1.navigate"http:\\localhoast\enquiry\index" set ie2=createobject("Internet Explorer.Application") ie2.visible=true ie2.navigate"http:\\localhoast\registration\index" Re: What is the vb script when the url enter into the browser Answer Browser Object.navigate "URL" Ex: Browser("browser").navigate "www.yahoomail.com" Re: what is the difference between Automation object model(AOM) and test object model(TOM) Answer By using QTP automation object model, we can automate QTP Operations .By using object, methods and properties provided by QTP, we can write programs that can configure QTP operations and settings. For example, you can create and run an automation program from Microsoft Visual Basic that loads the required add-ins or a test or component, starts Quick Test in visible mode, opens the test, configures settings that correspond to those in the Options, Test Settings, and Record and Run Settings dialog boxes, runs the test, and saves the test. Test Object Model, is nothing but how QTP identifies the objects in the application. How to get the class of an object, what mandatory and assistive properties are used during recording the application, how it identifies the objects during run session etc... Re: using descriptive programming how to close all opened browsers? Answer Set b=Description.Create b("micclass").value="Browser" Set obj=Desktop.ChildObjects(b) For i=0 to obj.count-1 c=obj(i).GetROProperty("title") msgbox " Closing.. " & c obj(i).Close Next Re: How can i count "spaces" in any sentence or a string if suppose " It is a Testing question" Here we have 4 gaps(spaces) Is there any function to find out spaces between words Answer Test: str="it is a testing question" Call spacecount(str,d) /*Function Call*/ msgbox "Number of spaces:" & d User Defined Function : Public function spacecount(a,b) str=a p=split(str) coun=0 For i=1 to ubound(p) coun=coun+1 Next msgbox coun b=coun /*Returns Number of spaces to the calling Function / End Function

Re: how do find current links in webpage for ex: in yahoowebsite today mainpage is having 50 links and next day same page is having 60 links. if i run same programe it should display total links in webpage ? Answer Above script for weblists To count No of Links in webpage: Set chobj=description.Create chobj("micclass").value="Link" Set obj=Browser(" ").Page(" ").ChildObjects(chobj) 'Count the no of objects n=obj.count msgbox "No of Links: "&n Re: I have a string "Redfort is in Delhi" how do u write vbscript for " Delhi in is Redfort" Answer str= "Redfort is in Delhi" arr= split(str," ") For i =ubound(arr) to lbound(arr) step -1 res = res&" " &arr(i) Next msgbox res Re: There is a name "AJAY" how do u count no.of. "A" in that name ? Answer Dim txt, cnt txt="ajay" p=split(txt,"a") cnt=0 for i=1 to ubound(p) cnt=cnt+1 next b=cnt msgbox cnt Re: How to capture screen shots when an error occurs? Answer Hi use RecoveryFunction to capture the image when error occurs. Step1: Create a VBS file using following founction Function RecoveryFunction1(Object, Method, Arguments, retVal) 'Find the Test Folder Path Set qtApp = CreateObject("QuickTest.Application") testpath = qtApp.Folders.item(1) 'stores the image inside the test folder image_name= testpath &"\imagename.png" Desktop.CaptureBitmap image_name End Function Step2: Go to Recovery manager step3: select "On Any error" or select u r own option Step4: select function to call step5: call the above mentioned file Rest QTP will do it for you Or In QTP 9.2, follow the below navigation: Tools -> Options -> Run tab -> In the drop down list box "On

Error"(default) is selected for "Save step screen capture to results" And even we can also configure, whether we have to proceed to next step or stop the test execution by following below navigation: File Menu -> Settings -> Run Tab -> Choose the required action from the "Whenever an error occurs during run session" drop down list box. Re: How to use custom checkpoints in QuickTest Professional? Answer Custom check points are user specific Check points, if we want to check particular object/or its any property then we make custom check points Example Function VerifyObjectExists(AppObject ) If AppObject.Exist Then 'Print "Object Exist" VerifyObjectExists= "True" Else ;Print "Object does not exist" VerifyObjectExists="False" End If End Function set Obj=dialog("Login").WinButton("OK") VerifyObjectExists(Obj) Re: How will u test content of an web application with out using checkpoints in QTP 9.2? Answer var= browser(".....").page("....").getroproperty("innetext") Re: How can you Open a Notepad and How can you write the test Results in Notepad by Using QTP? Answer Set a=createobject("Scripting.filesystemobject") Set b=a.opentextfile("E:\raju\1.txt",2) {1-reading mode, 2writing mode, 8- appending mode } While b.atendoflinetrue y=b.readline ---- Read the line on particular mentioned fine b.writeline "I Love QTP" --- write the line on particular mentioned file Wend Re: In a web site, Protocal has been changed http: to https: what is your approach? Answer We can disable the security alert from \\https to \\http. Please follow the below mentioned steps on the particular machine where the web script is to be run: The registry entry WarnOnHTTPSToHTTPRedirect takes the following two values: 1: Display the Security Alert message. 0: Do not display the Security Alert message. To add the registry entry WarnOnHTTPSToHTTPRedirect for an individual user, follow these steps: Follow these steps, and then quit Registry Editor: Click Start, click Run, type regedit, and then click OK. 2.

Locate and then click the following key in the registry: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings On the Edit menu, point to New, and then click DWORD Value. Type WarnOnHTTPSToHTTPRedirect, and then press ENTER. On the Edit menu, click Modify. Type 0, and then click OK. Re: what is Business Process Testing plz explain? Answer Business Process Testing is a web-based test design solution that bridges the quality chasm between subject matter experts and quality engineers. This role-based system enables subject matter experts to build, data-drive and execute manual and automated tests without any programming knowledge. It reduces the overhead required to test maintenance and combines test automation and documentation into a single effort. Or Business Process Testing is a role-based testing model. It enables Automation Engineers and Subject Matter Experts to work together to test an application's business processes during the application's development life cycle. Automation Engineers are experts in automated testing. They use Quick Test to define the resources and settings needed to create components, which are the building blocks of business process tests. Subject Matter Experts understand the various parts of the application being tested, as well as the business processes that need to be tested, however they may not necessarily have the programming knowledge needed to create automated tests. They use the Business Components and Test Plan modules in Quality Center to create keyword-driven business process tests. Integration between Quick Test and Quality Center enables the Automation Engineer to effectively create and maintain the required resources and settings, while enabling Subject Matter Experts to create and implement business process tests in a script-free environment, without the need for programming knowledge. Re: .qfl extension for which file? where vl use it Answer write all functions in a single for Reusable purpose. We can store this file as ".vbs (VB Script File)" file or ".txt (Text File)" or ".qfl (QuickTest Function Library)". we can store these functions any one of the above Extension. Or qfl is the function library file. If create function library from QTP and when u save it directly from QTP, it will save with .qfl extenstion. if u want to see that or edit the u can open that with notepad or u can open with QTP Re: Can explain me Send keys concept Answer? Send Keys: Sends one or more keystrokes to the active window. There are two types of Sendkeys are available in QTP. 1. Sendkeys Method(CustomServerBase) 2. Sendkeys Method(IMICDeviceReplay) Re: can we call a test in another test? Answer By default all the script will be recorded in the action itself. So there will be one action for each test(action1).We can call this action form that test

Re: How can we perform Action and Component parameter.? Answer Resources-> map repository parameters. There u can select for action or entire test Re: when we enter url,one page should open.write a vb script ,that page is open or not Answer SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","","C:\Program Files\Internet Explorer","open" Browser("title:=about:blank").Page("url:=about:blank").Sync Browser ("title:=about:blank").Navigate "http://www.google.com/" If Browser("title:=Google").Page("title:=Google").Exist then msgbox "Page Exists" else msgbox "Page does not Exist" end if Re: How can we encrypt the username using recording mode in login window? There is 2 encrypted types what are it Answer Methods for Encryption in QTP are as follows 1)SetSecure method -used only for TextBox object like WinEdit/WebEdit etc... E.g:Browser("test").Page("test").WebEdit ("test1").SetSecure "1HG76BHGJ89sd8Jkl9hjs988dsnjsk" 'encryp tedtext 2)Crypt.Encrypt(valueToBeEncripted) E.g: var_Value = Crypt.Encrypt("Tester") Methods usage in Test Script E.g: pwd = "GetPasswordfromSomewhere" e_pwd = Crypt.Encrypt(pwd) Browser("dfgd").Dialog("pass").WinEdit("pwd").SetSecure e_pwd Re: I learned all the objects of my application in object repository thru English Language. now i want to use same object repository for other languages(French,Dutuch and Chinese) Answer First I tried to use a non language specific way of identifying the object, like the Window ID ( a unique number , it is also only 1 primary identifier). This means that each object is usable irrespective of language. This of cause does not work for a window or a dialog so here I create a Environment file for each language ( including one for English, xml but simple) and then map the window O.R. item to that environment variable ( a little complicated ) and then on execution I find out the current language and use that as part of the Environment file to load like EVF_English.xml so if it finds French then it loads the EVF_French.xml environment file. Since its only windows I have to worry about since you can not have a window ID for a window then there are fewer vairables I have to have in the Environment files. Oh and one more thing the Environment variable can not have spaces in it so you can use Environment("MainWindow") but not ("Main Window"). Re: This is Ajay i have few douts if anybody know pls give me reply. 1. i have opend 2 gmails i am working with 1 gmail i want to close other gmail by usig script. 2.i have 10 links in a page all of them have same properties& names i want to click on 5link by using script. 3.i have one combobox in that i want to see all the citynames in the combobox and i have to check weather hyderabad is present or not. 4. size of objectrepository. 5.what r problems we get during writing the script. 6.is it possible to compare to excel sheets in qtp if possible wht is the script. 7.example for lowlevelrecording Answer 1) i have opend 2 gmails i am working with 1 gmail i want to close other gmail by usig script.

Ans: Use index property to uniquely indentify the Browser. In QTP, for any object, Index starts from Zero. If only one browser opened, Index value is Zero. For the second browser, index value will be 1 and so on.The below code will close the second Gmail brower if it two or more Gmail Pages are opened. Otherwise It won't close. If (Browser("title:=Gmail: Email from Google","index:=1").Exist) Then Browser("index:=1").Close End If If u want to close any broswer, use only index property in Browser object 2) i have 10 links in a page all of them have same properties& names i want to click on 5link by using script. Ans: Use index property in descriptive programming so that u can perform click action on 5th link. i.e For example, ABCD is the name of the link and page contains 10 links with the same name ABCD and you want to click on 5th, this case the below code work. Index starts from Zero. So fifth link contains the index value 4. Browser("title:=Gmail: Email from Google").Page ("name:=Gmail: Email from Google").Link ("name:=ABCD", "index:=4").Click 3).i have one combobox in that i want to see all the citynames in the combobox and i have to check weather hyderabad is present or not. Ans: The below code that will verify whether the Item exist in the combobox or not. i.e. the given city Hyderabad exist in the CityList combobox or not. CityName = "Hyderabad" Result = 0 all_items = Browser("Cities").Page("Cities").WebList ("CityList").GetROProperty("all items") For Each aitem In all_items If aitem = CityName Then Reporter.ReportEvent micPass "City is Found in the List", "Passed" Result = 1 Exit For End If Next If Result = 0 Then Reporter.ReportEvent micPass "City is Found in the List", "Passed" End If 4) size of objectrepository Ans: The Size of the Object Repository might be the size of the .tsr file in your script. 5) what r problems we get during writing the script Ans: In general, you can get the following probles while preparing the script 1. Sometimes you may not able to find/recognize the unique property value of the object. 2. Synchromnization: this is one of the major issue while preparing and executing the script. 3. If you have good Automation framework, then only it is easier to prepare the scripts 4. It depends on your logic where you are going to implement in the script 6) is it possible to compare to excel sheets in qtp if possible wht is the script. Ans: It is possible to verify two Excel sheets in QTP. I can explain the Steps to prepare the script.Step1: Import the first Excel sheet to Gloalsheet, Second excel sheet into Local sheet Step2: Get the rowcount of two Globalsheet and localsheet Step3: Compare the rowcounts and columncounts of two sheets if those are equal, verify each value of the cell. If any one combination failed(verifying cell value, Mention that two excel sheets are different else

Two excel sheets are equal. Else Mention that two excel sheets are different Re: What are the advantages of QTP over WinRunner? Answer WIN-RUNNER VS QTP : 1.Winrunner doesn't support web applications QTP supports all kinds of web application 2.Winrunner only supports IE and Netscape Navigator QTP supports all types of browsers 3.The default time setting of Win runner is 10000 ms The default time setting of QTP is 20000 ms 4.The logical name of true and false in Winrunner is 1 & 0 The logical name of true and false in QTP is True and False 5.Winrunner doesn't provide the snapshot of output QTP provides the snapshot of output. 6.Winrunner doesn't support Uni-code compatability QTP supports Uni-code compatability 7.Winrunner has Four kinds of Add-Ins QTP have Four kinds of Add-Ins 8.Winrunner has 3 kinds of Checkpoints,2 kinds of Recordings, and 3 kinds of Exception Handling mechanisms. QTP has 7 kinds of Checkpoints,3 kinds of Recordings, and 4 kinds of Exception Handling mechanisms. 9.In Winrunner GUI Spy is available In QTP Object Spy is available 10.Winrunner uses TSL script(Test Script Language) QTP use VB Script. Re: If you entered into yahoo mail with your valid user name and password , then you will get " welcome , username " (for example you will see , welcome, Krishna ) text on the top of the Inbox page , how can you test the user name is correct or not using QTP? Answer you can use the getROProperty method to get that value. later on compare that value with ur parameter. for example: GetAppval = Browser("XXX").Page("XXX").WebElement("html tag:=TD","index:=3").GetROProperty("innertext") getparam = Datatable.Value("name",dtGlobalSheet) If GetAppval = getparam then msgbox "pass" Else msgbox "fail" End If guys here i just given the logic to use. instead message box use a reporter statement or if u r writing to exeternal log use it. and i used data table for example, but many people (including me) will use separate excel file for parameterization. but this is the logic to check values. Re: 3. How to handle the exceptions using recovery secnario manager in Qtp? Answer 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-Run see recovery scenario manager is used to handle unexpected events or errors that occur during test run. so for this in order to over this problem., we have a recovery scenario wizard which is available in QTP tool. where the main objective is to 1) if any event or error occurs--"how to handle them?" i mean v can define easy steps when a pop window is displayed in between a test run then we instruct QTP how to identify that particular popup 2) As soon as identifying what to do next? suppressing that particular popup window is the next step. so we ill define some steps to suppress that particular pop up window. 3) and now the third level,.. ie, post recovery when an error or a popup window is identified, and suppressed successfully the next steps are nothing but post recovery steps, in other words instructing QTP whether to stop the test run or to move on to next step, or to move on to next iteration etc,... save the recovery scenario with ".qrs" extension and associate the recovery scenario to the QTP tool (file->Test settings-->recovery tab---> add the recovery what ever we have saved and run the test. any doubts regarding recovery u can raise Re: How many types of Parameters are available in QTP? and Pls Explain with example. Answer You can use the parameter feature in Quick Test to enhance your test or component by parameterizing the values that it uses. A parameter is a variable that is assigned a value from an external data source or generator. You can parameterize values in steps and checkpoints in your test or component. You can also parameterize the values of action parameters. If you wish to parameterize the same value in several steps in your test or component, you may want to consider using the Data Driver rather than adding parameters manually. 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. In order to use a value within a specific action, you must pass the value down through the action hierarchy of your test to the required action. You can then use that parameter value to parameterize a step in your test or component. For example, suppose that you want to parameterize a step in Action3 using a value that is passed into your test from the external application that runs (calls) your test. You can pass the value from the test level to Action1 (a top-level action) to Action3 (a child action of Action1), and then parameterize the required step using this Action input parameter value (that was passed through from the external application). 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, QuickTest uses a different value from the Data Table. For example, suppose your application or Web site includes a feature that enables users to search for contact information from a membership database. When the user enters a member's name, the member's contact information is displayed, together with a button labeled View 's Picture, where is the name of the member. You can parameterize the name property of the button so that during each iteration of the run session, QuickTest can identify the different picture buttons. 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 QuickTest generates for you based on conditions and options you choose. For example, you can have QuickTest read all the values for filling in a Web form from an external file, or you can use one of QuickTest's built-in environment variables to insert current information about the machine running the test or component.

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 QuickTest generate a random number and insert it in a number of tickets edit field. Re: how can you select random value for every iteration from a weblist Answer First get the Items count from the List and Use the RandomNumber() function to get the random Index value. The below code will work ItemsCount = Browser("Browsername").Page("PageTile").WebList ("WebListName").GetROProperty("items count") Browser("Browsername").Page("PageTile").WebList ("WebListName").Select ("#" & RandomNumber(0,ItemsCount)) Re: Could some one explain me how to create folder on the desktop from QTP?? This is an interview question Answer set a=createobject("scripting.filesystemobject") set b=a.createfolder(Path of the folder) Re: How to create a run time propertyfor an object? Answer for ex, suppose that we want to know what is the data in the text box while the application is running? FName = Browser("Browser").Page("Page").Webedit ("FirstName").GetROProperty("text") msgbox FName the runtime text which is present in FirstName field will be stored in FName variable and can be seen using msgbox. Re: how to get font size of a "WebEdit" Answer 'We will use OUTERHTML Property and use split concept we will get font size Example Outerhtml= dim a,i a= Window("yahoo").page("yahoo").Webedit ("name").getroproperty("outerhtml") i=split(a,"=") msgbox i(0) Re: What is the difference between Dim And Redim Answer Dim Statement Declares variables and allocates storage space. Dim varname[([subscripts])][, varname[([subscripts])]] . . . Variables declared with Dim at the script level are available to all procedures within the script. At the procedure level, variables are available only within the procedure. You can also use the Dim statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Dim statement, an error occurs.

ReDim Statement

Declares dynamic-array variables, and allocates or reallocates storage space at procedure level. ReDim [Preserve] varname(subscripts) [, varname(subscripts)] . . . The ReDim statement is used to size or resize a dynamic array that has already been formally declared using a Private, Public, or Dim statement with empty parentheses (without dimension subscripts). You can use the ReDim statement repeatedly to change the number of elements and dimensions in an array. If you use the Preserve keyword, you can resize only the last array dimension, and you can't change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array. The following example shows how you can increase the size of the last dimension of a dynamic array without erasing any existing data contained in the array. ReDim X(10, 10, 10) ... ReDim Preserve X(10, 10, 15) Caution If you make an array smaller than it was originally, data in the eliminated elements is lost. Re: How do you done Data-Driven Testing using MS-Word. What is the script for that Answer option explicit dim fso,f,n set fso=createobject("Scripting.filesystemobject") set f=fso.opentextfile("path of the word document",1,false) while(f.atendoflentrue)'reading the word doc. n=f.readline 'retrive the data from doc.line by line wend. add What is the script above is absolutely correct. in script, in 4th line 1--> Read mode of file 2--> Write mode of file 8--> Append mode of file True--> New file creation when specified file doesnot exist False--> QTP is not responsible when specified file doesnot exist in 6th line f.atendofline--> the end of file content this script not only for MS.Word also for Notepad ie for Flat files. Re: What is test fusion report? Answer 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 QuickTest Professional, you can share reports across an entire QA and development team. Re: what is debugging testing? Answer debugging testing means line by line testing.Advantage of this testing to defect the problems during testing time.And identify the defect of statements of programming. Or debugging nothing but one example: u have written 100 lines of code but ur script is not executed properly .so then use the debugging and check out the each and every line then u can find the problem .

Re: Plz someone tell me about user interface testing and backend testing and hw did u use it in ur project.plz give a detail answer i need to explain it to the interviewer. User interface means: Which provides interface for the user to interact with back end functions, Database...etc For example if u take : Yahoo mail. after entering the Yahoo URL in browser address bar and pressing on enter key the yahoo login page will be displayed on the browser screen. using this u can enter user id and password to loin into the system. if yahoo mail application is not providing login page, where can u enter the User Id and Password. so user interface is used to interact with the system. in yahoo mail login page user id, Password Text fields are user interface elements, which allows user to enter User ID and Password. If we come to backend testing: Back end means the business logic(functions)server and Data base. Testing back end testing means testing the code which produces the output for the user input. In Web based systems Browser acts as user agent and talks with the server ,submits the user requests and displays the server response. In Client-Server systems a client tool which is prepared to communicate with server acts as User agent to communicate with server. Re: what do u mean by test harnesses in qtp? Answer In software testing, a test harness or automated test framework is a collection of software and test data configured to test a program unit by running it under varying conditions and monitor its behavior and outputs. It has two main parts: the test execution engine and the test script repository. Test harnesses allow for the automation of tests. They can call functions with supplied parameters and print out and compare the results to the desired value. The test harness is a hook to the developed code, which can be tested using an automation framework. A test harness should allow specific tests to run (this helps in optimising), orchestrate a runtime environment, and provide a capability to analyse results. The typical objectives of a test harness are to: Automate the testing process. Execute test suites of test cases. Generate associated test reports. A test harness typically provides the following benefits: Increased productivity due to automation of the testing process. Increased probability that regression testing will occur. Increased quality of software components and application Re: If requirments changed then how we can teach the QTP this is the new requirment Answer if you are asking new requirement is added to existing functionalities if you are using record and play back then we are going to record the new functionality by using action object repository after that by merging it with shared object repository using objectrepository merger qtp going to identify the new functionalities otherwise by using descriptive programming we are going to add the properties of new functionalities that is the advantage of QTP Re: what's the difference in between function and sub and give some code as well Answer A Function procedure is a series of VBScript statements enclosed by the Function and End Function statements. A Function procedure is similar to a Sub procedure, but can also return a value. A Function procedure can take arguments a Function procedure has no arguments, its Function statement must include an empty set of parentheses.

Function Celsius(fDegrees) Celsius = (fDegrees - 32) * 5 / 9 End Function A Sub procedure is a series of VBScript statements (enclosed by Sub and End Sub statements) that perform actions but don't return a value. A Sub procedure can take arguments (constants, variables, or expressions that are passed by a calling procedure). If a Sub procedure has no arguments, its Sub statement must include an empty set of parentheses (). Sub ConvertTemp() temp = InputBox("Please enter the temperature in degrees F.", 1) MsgBox "The temperature is " & Celsius(temp) & " degrees C." End Sub Re: what are the 5 types of objects in qtp Answer QTP supports 6 types of objects: Standard Windows Object Methods and Properties within this object can be used for testing standard windows objects ActiveX Objects Methods and Properties within this object can be used for testing ActiveX objects Visual Basic Objects Methods and Properties within this object can be used for testing Visual Basic objects Web Objects Methods and Properties within this object can be used for testing Web Objects Utility Objects Methods and Properties within this object can be used for testing Utility Objects Supplemental Objects - Methods and Properties within this object can be used for testing Supplemental objects Re: QTP identifying the child tabs in a maintab like tab_1,tab_2,tab_3,tab_4 while using a for loop for these tabs.its not proceeding from _1 to _2. How can i use "for loop " Answer For example, If the Tabs are recogized in QTP as Webelements, and the Tab name starts with "Tab_" and the number changes then, the following loop may helpful for you. for var_i = 1 to 4 Browsr("BrowserName").Page("Page").WebElement ("innertext:=tab_" & var_i).Click) Wait 10 Next Re: i have .xls,.txt,.doc files are there (together). i want find only .xls file among them? how can we write function? Answer using the extention (.xls) in code..see below code Here i open the file from mentioned path and read and write the values on that. Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("c:\DIM.txt", 1, True) ' open to empty file and also use for open the file which is already created WriteLineToFile = f.ReadAll 'Read all the file line to line msgbox WriteLineToFile Set MyFile1 = fso.CreateTextFile ("c:\kamesh.txt",True) 'create new empty file

MyFile1.WriteLine WriteLineToFile ' Write all the stuf in created file MyFile1.Close Re: what is option explicit? what is the use of it? Answer You can declare variables with the Dim, Public or the Private statement. Like this: Dim myname myname = "ritesh" However, this method is not a good practice, because you can misspell the variable name later in your script, and that can cause strange results when your script is running. If you misspell for example the "myname" variable to "mynime", the script will automatically create a new variable called "mynime". To prevent your script from doing this, you can use the 'Option Explicit' statement. This statement forces you to declare all your variables with the dim, public or private statement. Put the Option Explicit statement on the top of your script. Like this: Option Explicit Dim myname myname = "ritesh" Re: What is difference between function and procedure? Answer 1.Function is mainly used in the case where it must return a value. Where as a procedure may or may not return a value or may return more than one value using the OUT parameter. 2.Function can be called from sql statements where as procedure cannot be called from the sql statements. 3.Functions are normally used for computations where as procedures are normally used for executing business logic. 4.You can have DML (insert, update, delete) statements in a function. But, you cannot call such a function in a SQL Query. 5.A Function returns 1 value only. Procedure can return multiple values (max 1024). 6.Stored Procedure: supports deferred name resolution. Example while writing a stored procedure that uses table named tabl1 and tabl2 etc...But actually not exists in database is allowed only in during creation but runtime throws error Function wont support deferred name resolution. 7.Stored procedure returns always integer value by default zero. whereas function return type could be scalar or table or table values 8.Stored procedure is precompiled execution plan where as functions are not. 9.A procedure may modify an object where a function can only return a value The RETURN statement immediately completes the execution of a subprogram and returns control to the caller. Re: What is the difference between property and method? Answer Property is nothing like a variable and Method is like a function. You cannot pass parameters to a property and you can directly assign value to it. for a Method, set of lines of code and when it is called that executes set of lines written in it and generates the results. you can pass parameters to the method and you can retrieve the result from the method. You cannot directly assign any value to it but you can pass it by Parameterizing it. Ex: Reporter.Filter - Here Filter is a property Reporter.ReportEvent - Here ReoprtEvent is a mothod.

Reporter.Filter = 0 'this enable the results for the test results. Here you can directly assig value to it Reporter.ReportEvent micPass, "Msg1","Msg2". Here we are passing three parameters to the methos ReportEvent that send the results to Test Results. Reporter is either a predefined Abstract class/interface in QTP that has so many Properties and Methods Re: In QTP what is the difference between Step-in, Step-out, Step-over ? Answer DEBUGGING MODES step in : it can be used to execute the current line of the script. If the current line is function or method than it call the function or method but it vl not run the function.If we want to run the function line by line we can use "step in" (step out*) else if U want to run the complete function once can use the "step over". step out: it can be used to execute the function or method which is called step into mode. note:If the control is at function or method call "step out" complete function will rune at one . If the the control is already in function or method "step out" acts like "step in",that is execution will happen step by step step over: it can be used to execute the current line of the script. If the current line is function or method than it call the function or method and execute that function note: initially in design time step in only enable, remaining 2 modes r disable. when ever vl select step in mode than automatically remaining modes r enabled. Re: what is functions in qtp?i know the userdefind &bulit funation or i know that Private public function ?plz tell me what is funations in qtp?how to create a funation in qtp Answer Function: Function is a block of statements which is used to perform a particular task and we can call from any test and pass parameters from calling function and get the result from called function. Function returns Single value, we can pass no.of input parameters and get no.of output parameters and use that output parameters in tests, But returned value would be on function name, i.e. the return value at calling function We can declare function in function No need to explain about public and private functions in interviews until unless they ask about the differences. many interviews they ask differences between sub procedures and function procedures. Re: Can anybody send me the code to get the RO property of the active screen in QTP while running? Answer A=Browser("brname").page("pgname").wededit ("buname").getRoproperty("Text") msgbox a Re: How to retrieve XML file data in QTP ? using Script(Chandana) Answer We can load environment variables from an xml file. File --> Settings and click the "Environment" tab You can see a check box "Load environment variables " check it and give the path of the xml file. when u run QTP , the variables in XML file will be available. And you can retrieve those values using Environment.value("variable_name") from any actions.

Or eg: giving input in the google search dialog box thro xml data. googlesearchfor bike add the above xml file in Test -> setting -> environment -> user defined. go to keyword view of your recorded script (already recorded). click the drop down button in the 'value' column and select the environment parameter from the list. Re: How can I replace all the text from the QTP script with some other text. Is there any replace all function in QTP Any one can help me Answer I could not find any function for this. We can do by this script. Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("C:\ais\Totally Data.doc", ForWriting, True) f.Write "Hello world!" f.Close this will replace everything in the given file and write the text ta u hav given. Re: how to invoke the web application through script in qtp Answer we have 2 ways in QTP to open a web application through the script, 1) systemutil.run("URL") or systemutil.run "iexplore.exe","URL" 2) systemutil.run("iexplore") set vbrowser=createobject("creationtome:=0") vbrowser.navigate"URL" Re: how qtp identify two objects having same name, suppose objects are in same page also with same name, specify spl feature. Answer This is the SPL feature for this problem. QuickTest can use the following types of ordinal identifiers to identify an object: Index. Indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description. For more information, see Identifying an Object Using the Index Property. Location. Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description. For more information, see Identifying an Object Using the Location Property. CreationTime. (Browser object only.) Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. For more information, see Identifying an Object Using the CreationTime Property. Re: how can i replace any text from the qtp script with some another text Answer

'Replace(expression, find, replacewith) reptext=replace("Good Morning", "Morning", "Evening") msgbox reptext Re: Hoe we can export TEST RESUALT IN to XL-sheet? Answer To Save a copy of the run-time Data Table in a specified location. Syntax DataTable.Export(FileName) Example DataTable.Export ("C:\flights.xls") Re: suppose im having a string wipro123xyz i need to get the value 123 only from the string today 123 will be in the middle from tommorow it will be changing to front or back how to get the no if it changes continously? Answer txt="123wiproxyz" mypos=instr (1,txt,"123") msgbox mypos k=mid ( txt,mypos,3) msgbox k Re: suppose i have one datatable in my datatable in 2 nd row 3rd column one link is ther i need to validate that link how do u do this?(wipro) Answer var = "" n = datatable.rowcount for i = 0 to n g= datatable.parametercount(i) for j = 0 to g k = datatable.value(j) if k = var then reporter.reportevent micpass, "validating link", "Link is validated" else reporter.reportevent micfail, "validating link", "link is noy found" end if Re: how can i pass parameters into function? Answer We will definitely pass the parameters to Function Try with this Example First parameterize the Agent name with invalid data like sun Dialog("Login").Einedit("AgentName").Set datatable.Value ("Agent") Call the function Function Login(Sunny) Dialog("Login").Einedit("AgentName").Set datatable.Value

("Agent1") End Function next next Re: How can we add regular expression for date field (dd/mon/yyyy)? Answer Open Object Repository and selsct value , click on constant value, it displays on edit box with Regular Expression checkbox, select check point and enter values For example: for data field(DD/MM/YYYY) RE:[0-3][0-9]/[0-1][0-2]/[0-2][0-9][0-9][0-9] Re: What is SQL injection? Answer to break a system database,some specific sql query is sendthrough input. or we can say that it is injected in the system for testing the database. it is related to the security of database... Or SQL injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another. SQL injection attacks are also known as SQL insertion attacks.[1] Re: What is vulnerability? Answer In computer security, the word vulnerability refers to a weakness in a system allowing an attacker to violate the confidentiality, integrity, availability [i.e (C.I.A) NSTISSC's triangle], access control, consistency or audit mechanisms of the system or the data and applications it hosts. Vulnerabilities may result from bugs or design flaws in the system. A vulnerability can exist either only in theory, or could have a known exploit. Vulnerabilities are of significant interest when the program containing the vulnerability operates with special privileges, performs authentication or provides easy access to user data or facilities (such as a network server or RDBMS). Re: What is the concept of firewalls? Answer A firewall ensures that all communications attempting to cross from one network to the other meet an organizations security policy. A firewall tracks and controls communications, deciding whether to allow, reject or encrypt communications. A firewall is increasingly being deployed to protect sensitive portions of local area networks and individual PCs 8) How to use environment variable? A simple defintion could be... it is a variable which can be used across the reusable actions and is not limited to one reusable action. There are two types of environment variables: 1. User-defined 2. Built-in We can retrieve the value of any environment variable. But we can set the value of only user-defined environment variables. To set the value of a user-defined environment variable: Environment (VariableName) = NewValue To retrieve the value of a loaded environment variable: CurrValue = Environment (VariableName) Example The following example creates a new internal user-defined variable named MyVariable with a value of

10, and then retrieves the variable value and stores it in the MyValue variable. Environment.Value("MyVariable")=10 MyValue=Environment.Value("MyVariable") 10) How to rename a checkpoint (QTP 9.0)? Example: Window("Notepad").WinEditor("Edit").Check CheckPoint("Edit") In the above example, the user would like to change the name of the CheckPoint object from "Edit" to something more meaningful. 11) Does QuickTest Professional support Internet Explorer 7.0? QuickTest Professional 9.1 QuickTest Professional 9.1 supports Microsoft Internet Explorer 7.0 Beta 3. Internet Explorer version 7.0 is now certified to work and to be tested with QuickTest Professional version 9.1. QuickTest Professional 9.0 QuickTest Professional 9.0 supports Internet Explorer 7.0 Beta 2. QuickTest Professional 8.2 and below QuickTest Professional 8.2 and below do not include support for Internet Explorer 7.0. Does QuickTest Professional support Firefox? QuickTest Professional 9.1 and 9.2 QuickTest Professional 9.1 provides replay support for Mozilla Firefox 1.5 and Mozilla Firefox 2.0 Alpha 3 (Alpha-level support for Bon Echo 2.0a3). Notes: QuickTest Professional 9.1 will not record on FireFox. You can record a test on Microsoft Internet Explorer and run it on any other supported browser, such as FireFox. The .Object property for web objects is not supported in FireFox. QuickTest Professional 9.0:QuickTest Professional 9.0 provides replay support for Mozilla FireFox 1.5. Notes: QuickTest Professional 9.0 will not record on FireFox. You can record a test on Microsoft Internet Explorer and run it on any other supported browser, such as FireFox. The .Object property for web objects is not supported in FireFox. QuickTest Professional 8.2 and below: QuickTest Professional 8.2 and below do not have support for Firefox. After Quick Test Professional is started, Windows Media will not start. It returns the error message "wmplayer.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being created."If you start Window's Media Player first, it will continue to work normally after starting QuickTest Professional. Include the Windows Media Player's executable in the NoBBTApps section of the mic.ini file 1. Close QuickTest Professional. 2. Go to \bin\mic.ini. 3. Include wmplayer.exe in the NoBBTApps section of mic.ini file. Example: [NoBBTApps] wmplayer.exe=rek 4. Save the mic.ini file and restart QuickTest Professional. 13) What is the lservrc file in QTP? The lservrc file contains the license codes that have been installed. Whenever a new license is created, the license code is automatically added to this file. The lservrc file is a text file, with no extension.

File Location: 1) For a Concurrent (Floating) license installation: "#server installation directory#\#language#" Example: C:\Program Files\XYZ Technologies\ABC Server\English\lservrc 2) For a Seat (Stand-alone) license installation: #AQT/QTP installation directory#\bin" Example: C:\Program Files\Mercury Interactive\QuickTest Professional\Bin\lservrc 14) What to do if you are not able to run QTP from quality center? This is for especially for newbies with QTP. Check that you have selected Allow other mercury products to run tests and components from Tools--> Options--> Run Tab. Q ) U n de r s t an d i n g e n i g m a t i c T O a n d R O p r o pe r t y ? The TO and RO property must have confused(or might be still confusing) you at some point of time.This is my attempt to demystify the two with the inputs from various resources. Test objects are the objects in your test that represent the objects in your website or application. Runtime objects are the objects in your application during the test run. The Test object properties set is created and maintained by QuickTest. The Runtime object property set is created and maintained by the object creator (Microsoft for Internet Explorer objects, Netscape for Netscape objects, the product developer for ActiveX objects, etc.). Similarly, Test object methods are methods that QuickTest recognizes and records when they are performed on an object while you are recording a test, and that QuickTest performs when your test runs. Runtime object methods are the methods of the object in your application as defined by the object creator(the developer!). You can access and perform runtime object methods using the Object property. 1.How to programmatically minimize/maximize the QTP window? A.Use QuickTest Professional's Automation Object Model (AOM) to set the WindowState property from within the script object.WindowState [= value] object A QuickTest Professional application object value A string value representing the window state with the following possible values: Maximized - QuickTest Professional is displayed at full screen size. Minimized - QuickTest Professional is open, but minimized. Normal - QuickTest Professional is displayed at the size it was prior to the last minimize or maximize operation Example: Dim qtApp Set qtApp = CreateObject("QuickTest.Application") qtApp.WindowState = "Minimized" ' Minimize QTP wait 2 qtApp.WindowState = "Normal" ' Restore QTP wait 2 qtApp.WindowState = "Maximized" ' Maximize QTP Set qtApp = Nothing

2.QTP hangs during startup when attempting to log into Quality Center? QuickTest Professional (QTP) is set to automatically connect to and log into Quality Center on startup. The user's login credentials changed and now when he attempts to launch QTP, it hangs while trying to log into Quality Center. He cannot launch QTP to make the needed changes for his credentials. How can he launch QTP so he can correct the login information? A. Modify the mic.ini file to set QTP to launch without connecting to Quality Center You can deactivate the automatic connection to Quality Center by modifying the mic.ini file. 1. Open the mic.ini file (\bin\mic.ini). 2. Locate the [TestDirector_] section. Example: [TestDirector_admin] 3. Change the following values from 1 to 0: QuickTest Professional 9.0: LoginAutomatically=0 ReconnectToDB=0 ReconnectToServer=0 For QuickTest Professional 8.2: ReconnectOnStart=0 ReconnectToDB=0 ReconnectToServer=0 4. Save the mic.ini file. Now when you launch QuickTest Professional, it will not try to connect to Quality Center. You can launch QuickTest Professional and make the necessary modifications to log into Quality Center automatically. 3.Can existing licenses be used with later versions of QuickTest Professional? A.The same license that was used for QTP 6.0 can be used with QTP 6.5 and 8.x. This applies to concurrent (floating) and seat (local) licenses. If you have a 6.x add-in license, you will need to request a new license for the 8.x versions of the add-ins. With the 8.x releases, the licenses were separated for the individual add-ins. 4.How to use regular expressions (or wildcards)? A.Regular expressions enable Quick Test Professional (AQT/QTP) to identify objects and text strings with varying values. You can use regular expressions when defining the properties of an object, when parameterizing a step, and when creating checkpoints with varying values. A regular expression is a string that specifies a complex search phrase. By using special characters such as a period (.), asterisk (*), caret (^), and brackets ([ ]), you define the conditions of the search. When one of these special characters is preceded by a backslash (\), AQT/QTP searches for the literal character. Regular expression syntax: AQT/QTP searches for all characters in a regular expression literally, except for the regular expression characters, such as a period (.), brackets ([ ]), and a asterisk (*) as described below. When one of these special characters is preceded by a backslash (\), AQT/QTP searches for the literal character. The following options can be used to create regular expressions (this is not an all-inclusive list): backslash (\) - Instructs AQT/QTP to treat the next character as either a special character if it is otherwise an ordinary character, or a literal character, if it is otherwise a special character. period (.) - Instructs AQT/QTP to search for any single character. brackets ([]) - Instructs AQT/QTP to search for any single character within a list of characters, not in a list (when used with the caret), or within a range (when used with a hyphen "-"). caret (^) - Instructs AQT/QTP to match the expression only at the start of a line, or after a newline character. When used with brackets, instructs QuickTest to search for a character not in the specified list. asterisk (*) - Instructs AQT/QTP to match zero or more occurrences of the preceding character. plus sign (+) - Instructs AQT/QTP to match one or more occurrences of the preceding character. question mark (?) - Instructs AQT/QTP to match zero or one occurrences of the preceding character. parentheses (()) - Instructs AQT/QTP to treat the contained sequence as a unit, just as in mathematics and programming languages. dollar sign ($) - Instructs AQT/QTP to match the expression only at the end of a line, or before a

newline character. vertical line (|) - Instructs AQT/QTP to match one of a choice of expressions. For additional regular expression options and a more detailed explanation of the above options, please refer to the User's Guide. 5.Unable to use demo license on machines whose previous demo license expired? A.From the QTP 8.0 Readme file: "You cannot install QuickTest Professional 8.0 with a demo license over a previous version of QuickTest Professional whose demo license has expired and a regular license was never installed for it." Submit a temporary License Request. Make sure you specify you are requesting a 14-day temporary license since the demo license of a previous version of QTP has expired. You can also submit the request by sending an email to [email protected]. In the "Subject" line insert "License Request". In the body of the email include the locking code, maintenance number, and the type of license you are requesting. In the case of a demo license it can only be a Seat license. Also, include that you are requesting a 14-day temporary license since the demo license of a previous version of QTP has expired. 6.How to delete objects from the object repository (QTP 9.0) A. Removing objects from a local object repository: 1. Go to Resources -> Object Repository. 2. In the Filter combobox, select "Local Objects." 3. In the object tree, select the object to be removed. 4. Click the delete toolbar button. 5. Click to confirm the deletion. 6. Save the test to save the updated local repository. The object, and any children it may have, will be removed. Removing objects from a shared object repository: 1. Go to Resources -> Object Repository Manager. 2. Go to File -> Open. Navigate to the desired Shared Object Repository file. 3. By default, the repository will open in read-only mode. Go to File -> Enable Editing. 4. In the object tree, select the object to be removed. 5. Click the delete toolbar button. 6. Click to confirm the deletion. 7. Save the updated shared repository. The object, and any children it may have, will be removed 7.What happens if multiple associated repositories have objects with the same name (QTP 9.0)? A.If an object with the same name and description is located in both the local object repository and in a shared object repository associated with the same action, the action uses the local object definition. If an object with the same name and description is located in more than one shared object repository associated with the same action, the object definition is used from the first occurrence of the object, according to the order in which the shared object repositories are associated with the action. Note: QuickTest Professional will not generate an error when multiple repositories containing objects with the same name are associated with the action. Example: You have the following webpage: Google

Google Google 1. Learn the first link into one shared repository, shared1.tsr. 2. Learn the second link into a different shared repository, shared2.tsr. 3. Learn the third link into the action's local repository. Each repository should now contain a Google object. The object hierarchy and name for each link will be the same (the objects are uniquely identified by the index identifier property). 4. Associate the shared1.tsr repository, then the shared2.tsr repository to the action. The associated repository list should look like the following: shared1.tsr shared2.tsr 5. In your script, enter the following line: Browser("Browser").Page("Page").Link("Google").Highlight 6. Run the script. The third Google link will highlight. This is the link in the Local repository. 7. Remove the Google link from the local repository. For information on removing objects from the repository 8. Run the script. The first Google link will highlight. This is the link in the shared1.tsr repository. 9. In the Keyword View, right-click on the Action and select "Action Properties". 10. Select the Associated Repositories tab. 11. Select the shared1.tsr file in the list, then click the down arrow button. The associated repository list should now look like the following: shared2.tsr shared1.tsr 12. Click to close the Action Properties window. 13. Run the script. The second Google link will highlight. This is the link in the shared2.tsr repository. 8.Is there a tool that will automatically convert QTP 8.2 scripts to QTP 9.0 A.There is no utility, use the AOM to convert the scripts There is no tool or utility that will automatically convert QTP 8.2 or earlier scripts for use with QTP 9.0. You can use QuickTest Professional's Automation Object Model (AOM) to convert the tests. For more information on the AOM To convert the scripts, all the AOM needs to do is open the test in write mode, then save it. These statements need to be in a .vbs file; they cannot be run from within QuickTest Professional. Note: The following code is an example. It is not part of QuickTest Professional. It is not guaranteed to work and is not supported by Mercury Customer Support. You are responsible for any and all modifications that may be required. Example: Dim qtApp Dim tests(3) Set qtApp = CreateObject("QuickTest.Application")

qtApp.Launch qtApp.Visible = True ' Tests to convert tests(0) = "C:\Program Files\Mercury Interactive\Tests\addinproptest" tests(1) = "C:\Program Files\Mercury Interactive\Tests\checkpoint" tests(2) = "C:\Program Files\Mercury Interactive\Tests\checkpoint2" For i = 0 to Ubound(tests) - 1 ' Convert test qtApp.Open tests(i), False, False ' wscript.sleep 2000 ' Save converted test qtApp.Test.Save Next qtApp.Quit Set qtApp = Nothing 10.How to set the size and position of the QuickTest Professional window for replay? A.The size/position which is set for the QTP window during replay will be used for the next test run The Astra QuickTest/QuickTest Professional (AQT/QTP) window will resize itself to its previous size when it was last used when replaying a test. In other words, if you resize the AQT/QTP window while replaying a test, AQT/QTP will resize itself on the next test run to the same size that you set previously. To set the size and position for replay: 1. Insert a wait(10) statement at the beginning of the test. 2. Replay the test. 3. While AQT/QTP is executing the wait statement, resize and position the AQT/QTP window. 4. Stop the test and remove the wait statement. 5. Replay the test. AQT/QTP will adjust itself to the same size and position that you set it to in step 3. 11.What is the WLMadmin application and how is it used? A.Using the WLMadmin application Please see t