Does QTP support Java Script also. Which is one is
preferrable for QTP, VB script or Java script

Answers were Sorted based on User's Feedback



Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / priya

QTP supports JAVA script also.....
It suports both VB n JAVA script.
Even in the help u can find both the java n VB script. We
can execute both to get the output.

Is This Answer Correct ?    14 Yes 0 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / govardhan palla

Framework which we are going to use in our project is
Hybrid Driven Framework and the application is in Oracle
Apps HRMS technology. But here you should have to know that
the framework which we are going to use is depends on our
Project. Some projects are we suite for Keyword driven
framework and some of the projects are for Hybrid Driven
Framework (some times we can call it as Function Library
Framework). Keyword Driven is Very easy to use and
implement, but when our test script is under more
maintenance mode then the Keyword Driven FW is more
difficult for Automation Developer, since we don't have
full control on the test script, if more than one
Automation Developers are means we will get conficts like
which part of the script is going to modify. Hence to
reduce the complexicity and to get Test script fully under
our control we can use Hybrid Driven Framework but it is
very complex to understand and develop.

In your case what type of error you are getting while
executing your test?
1.first make sure that your test script is going to
identifing the objects (in the application). If it is not,
add repository and Script accordingly.
2.Store the Object rep. in your local Drive with shared
mode (if you are using QTP 9.0 or later version it will
automatically in shared mode)

3.take the script scrap and devide logical functions
according to your wish and store them in .vbs file (here
you can devide all functions in individual .vbs files or
you can combine all together in one .vbs file)
4. Prepare Test Data in internal or external files.
5.Create Driver Script according to your requirement in
mine Test.
5. Add above created functions with the help of File-
>Settings->Resources->add library file
and add the same functions in Add Function Library list
6.Associate Object Rep. to your test. or you can create
some functions like Add Object Rep.dynamically and Add
Excel sheets Dynamically to your Test

Like above you can prepare test environment.
Please get back to me if you've any doubts on the same.

Cheers,
Govardhan

Is This Answer Correct ?    2 Yes 0 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / govardhan palla



Well We can use VB Script and Java Script and Shell Script
in QTP Tool. But don’t go for other than VB Script. Why is
it so means please go through below..

Please run this script in QTP Tool which is in Java Script
------------------------------------------------------------
---
Setting.Item('DefaultTimeOut') = 100;
Print ('Dummy Text');

try{
Print('Trying to click on a non-existent window');
//try to click on a window which never exists
Window('hwnd:=-1').Click;
}
catch(err)
{
Print('Some error occurred while clicking the window
object - ' + err.description);
}
finally
{
Print('Phew! Finally we are here');
}

Print(Testing is Great :) Isn\'t it?');

------------------------------------------------------------
---
The above I’ve written some piece of code is on JScipt.

But prior to this we need to get idea about why we are
going to use VBScirpt in QTP and why don’t we use other
than that like C#, HTML, C, C++, SQL and so on..

Here the thing is like QTP tool itself having some library
supporting files which call it as a DLL files. Those DLL
files will provide some methods/classes to the tool to get
connection and interface to the object. Hence by taking the
help from those DLL files (Methods/functions/Classes) QTP
will perform any action.

We no need to bother about those DLL files until we are
doing normal testing on VB/Web applications by selecting
addins VB,Web, Active-X. If suppose if we want to testing
on Oracle Applications HRMS/Finance or Sieble or Delphi or
some other application then we make sure to Addins are
available or not in QTP Tool at the time of testing. Hence
if we’ve add-ins in QTP Tool, those addins will provide
methods/functions/classes to QTP tool to perform any action
on the above said applications.

Let us take a simple example like we need to post a Bug in
to Quality Center by running QTP Script(without recording
the script like open the Quality Center and post the bug
manually). For that we need to first create a object by
using “Set tdc = CreateObject("TDApiOle80.TDConnection")”
method.
Once object get created then it will get interface to that
application and based object methods we can write our
script to our own way. You can see rest of things in below
written code..

'###########################################################
############
'#Function ID/Name :Adding_Bugs_To_QC
'#Function Description : This function is used to Add a
new Bug in to Quality Center
'#Function Logic :The function will get
connection witth Quality Center for respective domain,
project with appropriate user id and pwd and
it will enter for particular project bugfactory and add a
new bug in to QC

'#Author :
Govardhan Palla
'#Date : 15-Jan-
2009
'#Version : 1.0
'#Version History : None
'###########################################################
############

Function Add_Bugs_To_QC ( )
Dim tdc
Dim attachFact, attachObj
Dim server, Domain, Project, UName, PWD
Dim FileName, CPath
Set tdc = CreateObject
("TDApiOle80.TDConnection")
server = "http://10.42.63.34:8080/qcbin"
tdc.InitConnectionEx server

'QCConnection.login “<username>”, “<password>”
UName = "admin"
PWD = "admin"
tdc.login UName, PWD
' DEFAULT = Domain, QualityCenter_Demo =
Project
Domain = "Migration"
Project = "Migration_Project2"
tdc.Connect Domain, Project
If tdc.Connected Then
MsgBox "Connected to: " + Server + chr (10)+ "ServerName:"
+ tdc.ServerName + chr (10) + "Domain Name:" + Domain +
chr (10)+ "Project:" + Project
Else
MsgBox("Not
Connected")
End If
'Add a new, empty defect
Set bug = tdc.BugFactory.AddItem (Nothing)
bug.field("BG_SUMMARY") = defect_summary '"test adding a
new defect from QTP as well as automatic e-mail
functionality"
bug.field ("BG_STATUS") = "New" '--Default
bug.field ("BG_DETECTED_BY") = detected_by
bug.field ("BG_DETECTION_DATE") = date() 'Default to
current date
bug.field ("BG_DESCRIPTION") = "Requirement = '"&req&"' -
"&defect_desc'"This is a test entry from automation,
QuickTest Pro. The actual result did not meet the expected
result. The Analyst, Developer (Assigned To person) and
Tester (Deteted By person) should get an email of this
defect automatically."
bug.field ("BG_RESPONSIBLE") =
assign_to '"GovardhanPalla" 'Assigned To field
'These are user defined fields
bug.field ("BG_USER_02") = analyst'Analyst field
bug.field ("BG_USER_04") = "Testing" 'Introduced By field --
DEFAULT
bug.field ("BG_USER_05") = req'Requirements field
bug.field ("BG_USER_03") ="Automation" 'Found In field -
'Default
'install_date = DateAdd("d",30,date())
bug.field ("BG_USER_06") = install_date 'Install Date field
bug.Post 'commit to creating defect
'Clean and and release resources
Set BugFactory = Nothing
Set bug = Nothing
'###########################################################
############

The above written code is typically in VB Script. To post a
bug in QC J Script or Shell Script or than VB Script won’t
support with QTP environment. We can post the QC bug by
using Visual Studio environment by using VB or C# or rest
of languages and that is beyond our boundaries as well.

Is This Answer Correct ?    2 Yes 1 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / govardhan palla

Please leave your mail id here. I'll surely drop a Zip file
to you which contains small demo Frame work on Flight
Reservation Application.

Anyhow some part of the demo I am keeping here, Please have
a look at below

QTP Framework Demo VIII

Changes for VIII

All the objects except for the Browser and Page are handled
by Descriptive Programming.

Files:

QTP Script BookFlightDemo.

This script will now only run in QTP 9.1 or later versrions
of QTP like 9.2,9.5 or 10.0 you should be able to backward
engineer the script. You need to convert it to full DP
objects and create a new script in your version QTP and
include all the files below.

Excel.vbs (Data Reading Functions)

GlobalVars.vbs (Holds Global values)
DP_Objects.vbs (Basic Descriptive Programming subs)
Navigation.vbs (Common Navigation subs)
Flights_Demo.xls (Data file (Datatable
replacement))

Instructions

Copy the folder Data to the root directory of you C drive.
Start QTP and open the script BookFlightDemoII.

There will be one Keyword in the QTP script “BookFlights”

This demo uses the Mercury Tours web site which you should
have a link to in your sample applications.

http://newtours.mercury.com/

The start condition is at the login screen.

Make sure all the vbs files are referenced in the resource
panel
QTP > Resources > Associated Function Libraries

When you run the script you will be asked to select a data
file select Flights_Demo.xls.

I have made a few changes from the first version of the
demo. The long lines of code created by QTP when recoding
have been replaced by simple short lines. For example

strBrowser = "Welcome: Mercury Tours"
strPage = "Find a Flight: Mercury"

'Departing From:
Call DPWebList ("fromPort", strFromPort)

The browser and page are set before the fields and are re-
set when required. Descriptive Programming is also used in
this demo now as shown in the example below.

'billAddress1
Call DPWebEdit ("billAddress1", strbillAddress1)


The script will run for 2 iterations it will report 1 pass
and 1 fail.

This is not a full solution for a framework if you want
that give me a job. I have provided examples of putting
common actions into subs that can be called this allows for
easy maintenance of common reusable actions, Again these
may not be ideal candidates for this but its an example of
what you can do.


Govardhan Palla

Is This Answer Correct ?    1 Yes 0 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / govardhan palla

Yes I am. And working in Pune based MNC.
Well Radhika, if you compare the functionality of the
file .vbs and .qfl file functions or more or less same.

.vbs function files are not under control our QTP Tool
environment and .qfl functions are typically under control
in QTP Tool environment, you can predict the mean by seeing
the file extension name itself.
Vbs files generic funtions we can use in any environment
until Object Rep is not helpful for that file. For that
file.
And .qfl files are specific to our QTP environment
functions.
For clear idea create one .vbs file with msgbox “testing
the vbs file” on your desktop
and create the .qfl file with same content
and run the both files with out using QTP Tool (that is you
need to double click on the file).
I think now you got the Idea....

For in your error message case..
how you are going to call the function. I mean are you
using any driver script or any scripting to call the
function. First make sure that both names are one and same.

Is This Answer Correct ?    1 Yes 0 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / hp

Hi Radhika,
Send me the entire content of files qfl/vbs/driver script
file in a zip format. I can tell you the resolution.

Is This Answer Correct ?    1 Yes 0 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / radhika

how qtp supports java script.can u gve reply to me. r u
there?

Is This Answer Correct ?    0 Yes 0 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / radhika

r u real time person?

Is This Answer Correct ?    1 Yes 1 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / radhika

thnaks.but i did"t get thst examples.i"ll send script to
u.then u"ll check it.
Function Login()
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "radhi"
Dialog("Login").WinEdit("Password:").Set "mercury"
Dialog("Login").WinButton("OK").Click
End Function
Function Open_Order()
Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu
("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open
Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit
("Edit").Set "3"
Window("Flight Reservation").Dialog("Open Order").WinButton
("OK").Click
End Function

all these are copy and go to File-new-functionlibrary.in
these function library paste that files extension as .qfl.
later for we have to add it references(resources)go to
resources menu-objectrepository-file-export local
objects.in this save functions resources with .tsr.up to
here functions creations over.later if we want to call that
fun.go to resources-associative repository. in that add
that functions.
but am phasing error while calling the functions.
is it right?pls send script like this way and i real time
how to add functions?

Thanks&Regards
**************

Is This Answer Correct ?    0 Yes 0 No

Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script..

Answer / radhika

Thanks. r u real time?i dont know so much about qtp.but i
want to learn qtp real time script wat are use in comp.
Is it my process is right r wrong in creating functios.
can we use .qfl insted of .vbs?
i added all objects in objectrepository.i created functions
same as above manner.but getting mistake while calling that
functions. like that mistake as "type mismatch login".
we use only keyword driven fun. and hybrid fun?
hybrid and function driven framework both r same in all
situation? or different?

Thanks
******

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

Find the 'String' from excel sheet and save to another sheet.But we don't know the string column number and row number?

4 Answers  


I am using descriptive programming for my project.when QTP deosn't identity or recognize a object by record and playback method,is it possible to make QTP identify that object using descriptive programming? Note: The object doesn't have unique properties and same properties used in Record and playback are only available, no extra properties are defined.

3 Answers  


how to download mercury qtp9.2 ny internet ?

0 Answers  


What is the Maximum syncronization timeout in seconds in QTP 9.5

5 Answers   Polaris,


How will you enchance the script?

1 Answers  






What is the difference between local and shared object repository in qtp?

0 Answers  


what type of framework u r using in ur organization

0 Answers   Wipro,


Diff. between keyword driven Data driven testing?

8 Answers   CTS, IBM,


Hi every body, I am new to QTP.pls help me if anybody knows the solution. Here is my doubt: I have 3 excel sheets in my local drive out of which one is password protected and i want to get the data of all these xL's either by importing or by reading the data finally i have to update this data in the website.(and the site is secured site) I tried by importing all XL"s one by one but couldn't do so. plss send me the code or atleast suggest me the approach. Thanks in Advance Padmaja

3 Answers   Symphony,


how can we compare descriptive programing with a regular expression

0 Answers  


How is recording done when a application is over lapping the QTP application it gives a message object not recorded

0 Answers  


What is the difference between a Function and Procedure in QTP?

0 Answers   Wells Fargo,


Categories