How to connect Oracle using QTP scripts

How to connect Oracle using QTP scripts.

Dim connectionMS, recordsetMS
Set connectionMS = createobject(“adodb.connection”)
Set recordsetMS =createobject(“adodb.recordset”)
connectionMS.open “Driver={Microsoft ODBC for Oracle};Server=QTPWorld; Uid=your_username;Pwd=your_password;”
recordsetMS.open “select * from yourtablename”,connectionMS
databaseValue = recordsetMS.fields.item(0)
msgbox databaseValue
Set connectionMS = nothing
Set recordsetMS = nothing

How to connect sqlserver using QTP scripts

How to connect sqlserver using QTP scripts?

Dim connectionMS, recordsetMS

Set connectionMS = createobject(“adodb.connection”)
Set recordsetMS =createobject(“adodb.recordset”)

connectionMS.open”Driver={SQL Server};server=YourSqlServer;uid=YourUserName;pwd=YourPassword;database=dbname”
recordsetMS.open “select * from tablename”,connectionMS
databaseValue = recordsetMS.fields.item(0)
msgbox databaseValue
Set connectionMS = nothing
Set recordsetMS = nothing

How to connect MS Access using QTP scripts

How to connect MS Access using QTP scripts and display results

Dim connectionMS, recordsetMS

Set connectionMS = createobject(“adodb.connection”)
Set recordsetMS =createobject(“adodb.recordset”)

connectionMS.provider= “microsoft.jet.oledb.4.0”

connectionMS.open “C:\yourdatabase.mdb”
recordsetMS.open “select * from YourtableName”,connectionMS

databaseValue = recordsetMS.fields.item(0)
msgbox databaseValue

Set connectionMS = nothing
Set recordsetMS = nothing

Headless web browsers

Headless web browsers

headless web browsers or programs are used to stimulate the browsers where there is no GUI is used for browser actions,

If you want to do browser operations or collect data from UI, there programming concepts will be used.

headless web browsers are listed as below,

HtmlUnit – No GUI browser for Java programmers and its pure java implementation, Open source programs. JavaScript support/DOM emulated. mainly used for used for testing purposes or to retrieve information from web sites.

Spynner – Programmatic web browsing module having AJAX support for Python

Ghost – it is a webkit web client written in python. it is WebKit-based. JavaScript supported and Open source.

Watir-webdriver- it an open source Ruby library for automating tests. Complete JAva script Support via Browsers

Twill – Allows users to browse the Web using command-line interface . Supports automated testing on web applications and Open source.

Awesomium –  is Chromium-based. and supports JavaScript and provides HTML-powered interfaces.

ZombieJS – Open source headless testing using Node.js. JavaScript support/emulated DOM.

SimpleBrowser – Open source web browser engine designed for automation tasks. It is built for .Net framework and No JavaScript support.

QTP program to display odd and even numbers

QTP program to display odd and even numbers

‘ program to display odd numbers 

Dim OddNum,  o

o = Inputbox(“enter any value to check list of odd numbers in it”)

For OddNum = 1 To o Step 2

print OddNum

Next

‘ program to display even numbers 

Dim  EvenNum,  e

e = Inputbox(“enter any value to check list of even numbers in it”)

For EvenNum = 2 To e Step 2

print EvenNum

Next

How to do string reverse in qtp

How to do string reverse in qtp

How to do string reverse in qtp

Dim String1, String2, StringLength, i

String1 = “Happy Valentine’s Day”
StringLength = len(String1)

For i = StringLength To 1 step -1

String2 = String2 & mid(String1, i, 1)

Next

Msgbox String2

String reverse in qtp

Dim String1, String2, StringLength, i

String1 = “Shalima Prakash”
StringLength = len(String1)

For i = StringLength To 1 step -1

String2 = String2 & mid(String1, i, 1)

Next

Msgbox String2

Highest number in array

How to find the Highest number in array

Highest number in array

Dim Num, i, ArrayLength

Num = Array(1,3,4,2)

ArrayLength = Ubound(Num)

For i = 1 To ArrayLength

If (Num(i) > Num(0)) Then

Num(0) = Num(i)

End If

Next

Msgbox Num(0)

Jmeter tutorial on Jmeter components, terminologies etc

Jmeter tutorial on Jmeter components, terminologies etc…

1.       Thread group – refers the virtual users count applied while performance testing using Jmeter.

How we design the user transactions or thread group?

1)      The requirement is given that 60 user transactions needs to be made. And requested for 3 sec interval between transactions

2)      Then Ram up time should be set 180 sec.  This will fulfill the requirement of 3 sec delay between transactions

3)      This will also ensure that the 60th thread or user will be starting the action at 180th sec.  ( i.e Ramp up time / number of users – will give you the time interval for each uses to kick off. Total ramp up time will be the total time to start all transactions including the 60th one. Based on the transaction scenario length probably first set of 1 to 50th ones may be finished by this time) – similar articles on Jmeter , script Recording

2.       Samplers

Samplers are transaction makers which will let you send transactions.

For e.g HTTP Request sampler is used, it will send HTTP/HTTPS request to the web server. This requests can be manually added or recorded using HTTP(S) Test Script Recorder.

Web embedded resources like CSS, images, java applets, scripts, background images are retrieved by HTTP requests.

similar article on Jmeter

3.  Test plan

Test plan is the container of all the performance test scenarios and components of the particular test in Jmeter. Test plan consists of Thread group , temporary work bench, Samplers, etc.