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 |
Key word driven framework
Suppose there are 100 links in a web page and the number of links will be changing dynamically from time to time. I need code such that every time i had to click on the last link of the web page.
I have many listboxes in my application. I have to check whether the contents inside the listboxes are in sorted order or not..can anyone please send the code as early as possible
How to retrieve the object properties at runtime without the usage of GetROProperty?
How do you invoke any application and write a script to invoke QTP using VB Script.
A web page title might be xxxx@xyz.com or xxxy@xxx.co or xyz@abc.in.Using what mandatory properties can be the page identified.Give the regular expression for that.
explain abt dyanamic changing object with example?
What is the difference between "call" and "callclose"
Pls can anyone give me the entire code for the Keyword driven framework with respect to he Flight Reservation Window in detail with explanation. Pls explain in detail stepwise. Thanks a lot. Pls very urgent?.
How should I click on the right click menu objects When I trying to add the object properties to the OR.It is showing only Window(Window).Not all the objects of the window. Also while recording I found No script. How to solve this>.
Can anyone tell me what is the equivalant method to be used in QTP for "web_obj_get_text" used in winrunner. My winrunner code is below. set_window("Confirm Add Subscriber"); rc = web_obj_get_text("Add subscriber:","#8","#1",orderID,"The order number is","\.",1); basically I need to retrieved the "orderID " from a string present in 8th row & 1st col of table "Add subscriber"
How to get the column count and column name from the resultset in the database connection program?