QTP Script for Comparing Actual Values with Expected Values and to Set Result as Pass or Fail

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)
If (Expval=Actval) Then
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


jack said...

Posted this link in www.surfurls.com

F n K said...

Thanx jack

Qualitypoint said...

Nice one.

Related Posts Plugin for WordPress, Blogger...