QTP Script for comparing Actual Result with Expected Result.
Below Script is used to compare actual and expected values in calculator application.
We are supplying values to value1 and value2 textboxes from datatable.Column A of datatable to value 1 and column B to value 2.
In datatable we have columns A,B,E.V,Res
E.V is Expected value column in which we enter values.These values are compared with Actual values.
Res is empty column which is filled at run time by QTP.We can see result as Pass or Fail in Res column in Run Time Datatable.
VbWindow("Form1").VbEdit("val1").Set DataTable("A",1)
VbWindow("Form1").VbEdit("val2").Set DataTable("B",1)
VbWindow("Form1").VbButton("ADD").Click
Expval=DataTable.Value("E.V",1)
Actval=VbWindow("Form1").VbEdit("res").Getroproperty("text")
If (Expval=Actval) Then
DataTable("Res",1)="Pass"
else
DataTable("Res",1)="Fail"
End If
We are getting value from datatable(E.V Column) to Expval variable,Capturing Actval from application(result textbox) and comparing them and assigning value to Res column as Pass or Fail.
Output will be
A B E.V Res
1 1 2 Pass
2 2 3 Fail
3 3 6 Pass
4 4 8 Pass
5 5 11 Fail
QTP Script for Comparing Actual Values with Expected Values and to Set Result as Pass or Fail
Subscribe to:
Post Comments (Atom)
3 comments:
Posted this link in www.surfurls.com
Thanx jack
Nice one.
www.qualitypoint.blogspot.com
Post a Comment