Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When I click on a link in web page.Link should open in new window.can anyone please let me know the script for this ---Koti

2980


How to use actions in qtp ?

1103


In the Hybrid framework, data can access the database, excel file, XML etc. Is it true?

1134


hi i am working with vbwindow on qtp.first i am openning qtp whenever open qtp my application not open that time generated error like "Runtime error 0" and fatal error:automation error how to solve this problem pls tell me

2435


Define object spy ?

1067


whare exactly we have to use functions and sub routain

2364


Explain about the quicktest professional (qtp) automation object model?

1040


How to modify object property in qtp ?

1048


Can anyone share/send me QTP 8.2 Crack as I had it before but now it's virus affected. Pls send me on Sawale.vijay@gmail.com Thanks, ~Vijay

3108


What are the major/ important methods, functions in QTP we use realtime testing

2849


If u r using library files (Instead of Check Points) , How do u do bitmap check ?

2091


Explain the difference between check point and output value?

1056


Explain the types of object repositorys in qtp?

1154


In qtp, explain what is keyword driven automation framework?

1104


Whether qtp 9.0 supports Test director8.0

2633