Thursday, October 9, 2008
Yahoo Login Automation
Steps to create Script for yahoo login :
1) Main script --> calls function(s) in file loginscript.vbs.
2) loginscript.vbs --> contains two public functions login() and validateLogin().
3) Data for login name and password is being fetched from Global data sheet.
1. Contents of Main script :
username = datatable.Value("Username", dtGlobalSheet)
password = datatable.Value("Password", dtGlobalSheet)
call login(username, password)
call validateLogin()
2. Content of loginscript.vbs :
public function login(uName, uPwd)
SystemUtil.Run"iexplore","http://www.yahoomail.com"
set objUserName = description.create
objUserName("name").value = "login"
set objUserPwd = description.create
objUserPwd("name").value = "passwd"
set objSignIn = description.create
objSignIn("name").value = "Sign In"
Set g=Browser("name:=Yahoo.*").Page("title:=Yahoo.*")
g.WebEdit(objUserName).Set uName
g.WebEdit(objUserPwd).SetSecure uPwd
g.WebButton(objSignIn).Click
End Function
public function validateLogin()
If Browser("name:=Yahoo! Mail.*").Exist Then
reporter.ReportEvent micPass, "Found Yahoo! Mail'", "Logged in successfully, Test Case Passed"
else
reporter.ReportEvent micFail, " Not Found yahoo! Mail" , "Unsucessfull Login, Test Case Failed"
End if
End Function
3. Contents of Global Data sheet :
Username Password
Username-> Enter your yahoo username in data sheet
Password-> Enter your yahoo password in data sheet
Monday, October 6, 2008
Sample Test Project
1)Open the excel sheet ..Enter the following values in excel sheet
| No.1 | No.2 | Production | Substraction | Division | Addition |
| 5 | 3 | ||||
| 2 | 1 | ||||
| 3 | 7 | ||||
| 2 | 8 |
2)Open calculator application using QTP.
3)Then we have to read this no1 and no2 values from the excel sheet.
4)Using this values we need to click the appropriate buttons in calculator application.
5)Then do the calculation for addition, substraction, production and division
6)Result will be save in same excel sheet.
Use the below code for this project..
Save below code as your test script..
'****************************************
On error resume next
Dim i,y
exlPath="D:\Test Project\Test_Input\sample.xls"
DataTable.ImportSheet exlPath,"Sheet1","Global"
rowCount=datatable.GetSheet("Global").GetRowCount
msgbox "The Row count is "&rowCount
SystemUtil.Run "D:\Test Project\AUT_Build\calc.exe", "","",""
For i =1 to rowCount
num1=trim(datatable.GetSheet("Global").GetParameter("No.1").ValuebyRow(i))
msgbox num1
num2=trim(datatable.GetSheet("Global").GetParameter("No.2").ValuebyRow(i))
msgbox num2
Call addition(num1,num2,rAdd)
Call substraction(num1,num2,rSub)
Call production(num1,num2,rMul)
Call division(num1,num2,rDiv)
rw=i+1
Set oFso = createObject("Excel.Application")
Set oFil= oFso.Workbooks.open(exlPath)
Set oWs=oFil.worksheets("Sheet1")
oWs.cells(rw,3).Value =rMul
oWs.cells(rw,4).Value =rSub
oWs.cells(rw,5).Value =rDiv
oWs.cells(rw,6).Value =rAdd
oFil.save
oFil.close
Next
'****************************************
save this code as function library
'*****************************************
Function addition(num1,num2,rAdd)
Window("text:=Calculator").Activate
Window("text:=Calculator").WinButton("text:="&num1).Click
Window("text:=Calculator").WinButton("text:=\+").Click
Window("text:=Calculator").WinButton("text:="&num2).Click
Window("text:=Calculator").WinButton("text:=\=").Click
rAdd=Window("text:=Calculator").WinEdit("nativeclass:=Edit").GetRoProperty("text")
msgbox "Result"&rAdd
End Function
Function substraction(num1,num2,rSub)
Window("text:=Calculator").Activate
Window("text:=Calculator").WinButton("text:="&num1).Click
Window("text:=Calculator").WinButton("text:=\-").Click
Window("text:=Calculator").WinButton("text:="&num2).Click
Window("text:=Calculator").WinButton("text:=\=").Click
rSub=Window("text:=Calculator").WinEdit("nativeclass:=Edit").GetRoProperty("text")
msgbox "Result"&rSub
End Function
Function production(num1,num2,rMul)
Window("text:=Calculator").Activate
Window("text:=Calculator").WinButton("text:="&num1).Click
Window("text:=Calculator").WinButton("text:=\*").Click
Window("text:=Calculator").WinButton("text:="&num2).Click
Window("text:=Calculator").WinButton("text:=\=").Click
rMul=Window("text:=Calculator").WinEdit("nativeclass:=Edit").GetRoProperty("text")
msgbox "Result"&rMul
End Function
Function division(num1,num2,rDiv)
Window("text:=Calculator").Activate
Window("text:=Calculator").WinButton("text:="&num1).Click
Window("text:=Calculator").WinButton("text:=\/").Click
Window("text:=Calculator").WinButton("text:="&num2).Click
Window("text:=Calculator").WinButton("text:=\=").Click
rDiv=Window("text:=Calculator").WinEdit("nativeclass:=Edit").GetRoProperty("text")
msgbox "Result : "&rDiv
End Function
'*********************************
Wednesday, September 17, 2008
Parameterizing Your Test Script
Parametrization can be done in this way:
1. In the sheet "Action 1", write some parameters under column A(change column name"Name") and then enter 10 names like name1, name2....name10
Browser("browser_name").Page("page_name).WebEdit("textbox_name").Set
Datatable("Name","Action 1").
2. In the sheet "Global", write some parameters under column A(change column name"Name") and then enter 10 names like name1, name2....name10
Browser("browser_name").Page("page_name).WebEdit("textbox_name").Set
Datatable("Name","Global").
In default sheet the data will be stored and the script we can modify code like this.
Browser("browser_name").Page("page_name).Webedit("textbox_name").Set Datatable(Name,dtGlobalSheet).
OR
Dialog("Login").WinEdit("User_Name").Set Datatable(Name,dtGlobalSheet).
Tuesday, April 8, 2008
How to import excel sheet data
Dim First Name, Last Name, Address, Phone, Zip, City, State,DOB
Data Table.ImportSheet "C:\Test Repositaory\input data.xls","inputdata",dtLocalSheet
First Name=DataTable("First Name", dtLocalSheet)
Last Name=DataTable("Last Name", dtLocalSheet)
Address=DataTable("Address", dtLocalSheet)
Phone=DataTable("Phone", dtLocalSheet)
Zip=DataTable("Zip", dtLocalSheet)
City=DataTable("City", dtLocalSheet)
State=DataTable("State", dtLocalSheet)
DOB=DataTable("DOB", dtLocalSheet)
'Get sheet method will get the sheet and add parameter will add the column whose name is
given in column name.
DataTable.GetSheet (”input data.xls”).AddParameter “First Name”,"Last Name","Address","Phone","Zip","City","State","DOB"
Thursday, March 6, 2008
Verfication and Validation
| | Verification | Validation |
| 1. | Verification is a static testing procedure. | Validation is dynamic testing procedure. |
| 2. | It involves verifying the requirements, detailed design documents, test plans, walkthroughs and inspections of various documents produced
| Validation involves actual testing of the product as per the test
|
| 3. | It is a preventive procedure. | It is a corrective procedure. |
| 4. | Are we building the product RIGHT? | Are we building the RIGHT product? |
| 5. | It involves more then two to three persons and is a group activity. | It involves the testers and sometimes user. |
| 6. | It is also called Human testing, since it involves finding the errors by persons participating in a review or walk through. | It is also called Computer testing, since errors are found out by testing the software on a computer. |
| 7. | Verification occurs on Requirements, Design and code. | Validation occurs only on code and the executable application. |
| 8. | Verification is made both in the Executable and Non Executable forms of a work product | Validation is done only on Executable forms of a work product. |
| 9. | Verification finds errors early in the requirement & design phase and hence reduces the cost of errors. | Validation finds errors only during the testing stage and hence cost of errors reduced is less than Verification. |
| 10. | An effective tool for verification tool is a Checklist. | Various manual and automated test tools are available for Validation. |
| 11. | It requires cooperation and scheduling of meetings and discussions. | It is to check that the product satisfies the requirements and is accepted by the user. |
| 12. | Verification tasks include: 1) Planning 2) Execution | Validation tasks include: 1) Planning 2) Test ware Development 3) Test Execution 4) Test ware Maintenance |
| 13. | Verification activities include: 1) Requirements Verification 2) Functional design verification 3) Internal Design Verification 4) Code Verification | Validation activities include: 1) Unit testing 2) Usability testing 3) Function testing 4) System testing 5) Acceptance testing |
| 14. | Verification deliverables (work products) are: 1) Verification test plan 2) Inspection report 3) Verification test report | Validation deliverables are: 1) Test plan 2) Test Design Specification 3) Test Case Specification 4) Test Procedure Specification 5) Test log 6) Test incident report |