What is the difference between property and method?
Answers were Sorted based on User's Feedback
Property is nothing like a variable and Method is like a
function.
You cannot pass parameters to a property and you can
directly assign value to it.
for a Method, set of lines of code and when it is called
that executes set of lines written in it and generates the
results. you can pass parameters to the method and you can
retirve the result from the method. You cannot directly
assign any value to it but you can pass it by
Parameterizing it.
Ex: Reporter.Filter - Here Filter is a property
Reporter.ReportEvent - Here ReoprtEvent is a mothod.
Reporter.Filter = 0 'this enable the results for the test
results. Here you can directly assig value to it
Reporter.ReportEvent micPass, "Msg1","Msg2". Here we are
passing three parameters to the methos ReportEvent that
send the results to Test Results.
Reporter is either a prepdefined Abstract class/interface
in QTP that has so many Properties and Moethods
| Is This Answer Correct ? | 31 Yes | 6 No |
Answer / ravi
Properties are a useful way of expressing a feature of an object, allowing get/set in a common way that can be used by APIs like data-binding, reflection and serialization. So for simple values of the object, properties are handy. Properties can't take arguments, should not have significant side-effects*, and should return quickly and repeatably. Also, there is no such thing as an "extension property" (to mirror an extension method) nor a generic property.
(*=lazy loading etc isn't uncommon, however)
Methods (C# doesn't have functions) are better for expressing things that either change the state, or which have an expectation of taking some time and not necessarily being reproducible. They don't tend to work in binding / serialization etc.
Note that properties are actually just a special way of writing methods. There is little functional difference. It is all about expressing intent. The one thing you don't want to expose, however, is fields (the actualintEmployeeAge instance variable).
| Is This Answer Correct ? | 2 Yes | 2 No |
What is a Patch in QTP?
Which environments are supported by hp qtp?
What is the entry and exit point of automation testing
what is difference between wait and synchronization point.
suppose u hav a 10 dialog or window opened on screen with same name & value. now how to test each window? i.e. how qtp indetifies these objects separately?
How to Save your test using QTP?
How the exception handling can be done using QTP
What is file database?
How to handle Java tree in QTP?
I am getting the "test object property" Description properties "toolkit class" value By using "gettoproperty" in run time But my problem is how to get Ordinal Identyfier's type and value Type is index, value is 0 How can i keep this values in to required place How can i get these values in runtime I have to insert these "index" and "value" into another area Is there any script for this like "gettoproperties","Getroproperties" If anybody knows,please help me .
I want to open a text file and then search some specified text in it and then replace that text with some other text i found that text in .txt but do not know how to replace that text can any body help me. if possible put the code for qtp
Give me detailed theritical explanation about keyword driven, hybrid framework, environment variables, hybrid frame work