Call us Today ! 214-504-6299 | info@qatestingtraining.com
QA Training | Selenium Training

QTP Descriptive Programming scripts – Examples for Realtime project

 

Script – Verify user is able to login successfully.

‘1. Launch Browser with actiTime url.

SystemUtil.Run “iexplore.exe”, “http://127.0.0.1/login.do”

‘2. Check Browser is opened with actiTime application.

If Browser( “title:=actiTIME – Login” ).Exist( 15 ) Then

Reporter.ReportEvent micPass, “TS 1- Launch”, “Browser launched successfully.”

Else

Reporter.ReportEvent micFail, “TS 1- Launch”, “Browser failed to launch.”

ExitTest

End If

‘3. Verify Username, Password edits and the Login link exist.

If Browser(“title:=actiTIME – Login”).Page(“title:=actiTIME –

Login”).WebEdit(“name:=username”).Exist(0) Then

Reporter.ReportEvent micPass, “Username Field”, “User name edit field is exist.”

If Browser(“title:=actiTIME – Login”).Page(“title:=actiTIME – Login”).WebEdit(“name:=pwd”).Exist(0)

Then

Reporter.ReportEvent micPass, “Password Field”, “Password edit field is exist.”

If Browser(“title:=actiTIME – Login”).Page(“title:=actiTIME – Login”).Link(“name:=Login” ).Exist(0)

Then

Reporter.ReportEvent micPass, “Login Link”, “Login link exist.”

Else

Reporter.ReportEvent micPass, “Login Link”, “Login link does not exist”

End If

Else

Reporter.ReportEvent micPass, “Password Field”, “Password edit field does not

exist.”

End If

Else

Reporter.ReportEvent micPass, “Username Field”, “User name edit field does not exist.”

End If

‘4. Set the userName and password and Click Login.

With Browser(“title:=actiTIME – Login”).Page(“title:=actiTIME – Login”)

If .WebEdit(“name:=username”).Exist(0) Then

.WebEdit(“name:=username”).Set “admin”

If .WebEdit(“name:=pwd”).Exist(0) Then

.WebEdit(“name:=pwd”).Set “manager”

If .Link(“name:=Login” ).Exist(0) Then

.Link(“name:=Login” ).Click

Else

Reporter.ReportEvent micFail, “Login Link Error”, “Link not found.”

End If

Else

Reporter.ReportEvent micFail, “Password Edit Error”, “EditBox not found.”

End If

Else

Reporter.ReportEvent micFail, “UserName Edit Error”, “EditBox not found.”

End If

End With

‘5. Validate system logged in and navigated to correct page.

If Browser( “title:=actiTIME – Open Tasks” ).Exist( 1 ) Then

Reporter.ReportEvent micPass, “Login”, “Login successful”

Else

Reporter.ReportEvent micFail, “Login”, “Login failed”

End If

April 4, 2014

0 responses on "QTP Descriptive Programming scripts - Examples for Realtime project"

Leave a Message

Copy Rights © All rights reserved.