I oened qtp and calculator
and then start recording for calculator
i add 2+3 it generate script for it
then i press "="
calc gives result 5
but in script how will i check wether the correct result has come or not
Automatically generated script is as below
When you need to validate information like this, you commonly use a checkpoint. Refer to the QTP user guide for the types of checkpoints available. You may also want to walk through the QTP tutorial since it covers the basic topics.
I did a quick QTP demo using Calculator a couple months ago. I parameterized my values in the datatable. First and second columns were numbers, third column was add, subtract, multiply, or divide.
I input the first column as a parameter to enter the number into the calculator, then evaluated the third column to decide which operation to perform (+ - * or /), then entered the value from column 2, then hit equal.
I calculated my expected results by having QTP do the same math based on those same three columns and getting a sum (or remainder, product, or quotient).
I then used GetROProperty to get the result from the calculator's display into a variable: